Mercurial > hg > toybox
comparison toys/posix/du.c @ 674:7e846e281e38
New build infrastructure to generate FLAG_ macros and TT alias, #define FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 08 Oct 2012 00:02:30 -0500 |
parents | 2b957eaa00c7 |
children | 786841fdb1e0 |
comparison
equal
deleted
inserted
replaced
673:c102f31a753e | 674:7e846e281e38 |
---|---|
26 -l Count sizes many times if hard linked | 26 -l Count sizes many times if hard linked |
27 -h Sizes in human readable format (e.g., 1K 243M 2G ) | 27 -h Sizes in human readable format (e.g., 1K 243M 2G ) |
28 -m Sizes in megabytes | 28 -m Sizes in megabytes |
29 */ | 29 */ |
30 | 30 |
31 #define FOR_du | |
31 #include "toys.h" | 32 #include "toys.h" |
32 | 33 |
33 DEFINE_GLOBALS( | 34 GLOBALS( |
34 long maxdepth; | 35 long maxdepth; |
35 long depth; | 36 long depth; |
36 long *dirsum; | 37 long *dirsum; |
37 long total; | 38 long total; |
38 dev_t st_dev; | 39 dev_t st_dev; |
39 struct arg_list *inodes; | 40 struct arg_list *inodes; |
40 ) | 41 ) |
41 | |
42 #define TT this.du | |
43 | |
44 #define FLAG_x 1 | |
45 #define FLAG_s 2 | |
46 #define FLAG_L 4 | |
47 #define FLAG_k 8 | |
48 #define FLAG_H 16 | |
49 #define FLAG_a 32 | |
50 #define FLAG_c 64 | |
51 #define FLAG_l 128 | |
52 #define FLAG_m 256 | |
53 #define FLAG_h 512 | |
54 #define FLAG_d 1024 | |
55 | 42 |
56 typedef struct node_size { | 43 typedef struct node_size { |
57 struct dirtree *node; | 44 struct dirtree *node; |
58 long size; | 45 long size; |
59 }node_size; | 46 }node_size; |