+//usage:#define du_trivial_usage
+//usage: "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..."
+//usage:#define du_full_usage "\n\n"
+//usage: "Summarize disk space used for each FILE and/or directory.\n"
+//usage: "Disk space is printed in units of "
+//usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024")
+//usage: IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512")
+//usage: " bytes.\n"
+//usage: "\n -a Show file sizes too"
+//usage: "\n -L Follow all symlinks"
+//usage: "\n -H Follow symlinks on command line"
+//usage: "\n -d N Limit output to directories (and files with -a) of depth < N"
+//usage: "\n -c Show grand total"
+//usage: "\n -l Count sizes many times if hard linked"
+//usage: "\n -s Display only a total for each argument"
+//usage: "\n -x Skip directories on different filesystems"
+//usage: IF_FEATURE_HUMAN_READABLE(
+//usage: "\n -h Sizes in human readable format (e.g., 1K 243M 2G )"
+//usage: "\n -m Sizes in megabytes"
+//usage: )
+//usage: "\n -k Sizes in kilobytes"
+//usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(" (default)")
+//usage:
+//usage:#define du_example_usage
+//usage: "$ du\n"
+//usage: "16 ./CVS\n"
+//usage: "12 ./kernel-patches/CVS\n"
+//usage: "80 ./kernel-patches\n"
+//usage: "12 ./tests/CVS\n"
+//usage: "36 ./tests\n"
+//usage: "12 ./scripts/CVS\n"
+//usage: "16 ./scripts\n"
+//usage: "12 ./docs/CVS\n"
+//usage: "104 ./docs\n"
+//usage: "2417 .\n"
+
+#include "libbb.h"
+
+enum {
+ OPT_a_files_too = (1 << 0),
+ OPT_H_follow_links = (1 << 1),
+ OPT_k_kbytes = (1 << 2),
+ OPT_L_follow_links = (1 << 3),
+ OPT_s_total_norecurse = (1 << 4),
+ OPT_x_one_FS = (1 << 5),
+ OPT_d_maxdepth = (1 << 6),
+ OPT_l_hardlinks = (1 << 7),
+ OPT_c_total = (1 << 8),
+ OPT_h_for_humans = (1 << 9),
+ OPT_m_mbytes = (1 << 10),
+};
+
+struct globals {
+#if ENABLE_FEATURE_HUMAN_READABLE
+ unsigned long disp_hr;
+#else
+ unsigned disp_k;
+#endif
+ int max_print_depth;
+ bool status;
+ int slink_depth;
+ int du_depth;
+ dev_t dir_dev;
+} FIX_ALIASING;
+#define G (*(struct globals*)&bb_common_bufsiz1)
+
+
+static void print(unsigned long size, const char *filename)