Mercurial > hg > toybox
comparison toys/posix/chmod.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 | 6df4ccc0acbe |
children | 786841fdb1e0 |
comparison
equal
deleted
inserted
replaced
673:c102f31a753e | 674:7e846e281e38 |
---|---|
32 Examples: | 32 Examples: |
33 chmod u+w file - allow owner of "file" to write to it. | 33 chmod u+w file - allow owner of "file" to write to it. |
34 chmod 744 file - user can read/write/execute, everyone else read only | 34 chmod 744 file - user can read/write/execute, everyone else read only |
35 */ | 35 */ |
36 | 36 |
37 #define FOR_chmod | |
37 #include "toys.h" | 38 #include "toys.h" |
38 | 39 |
39 DEFINE_GLOBALS( | 40 GLOBALS( |
40 char *mode; | 41 char *mode; |
41 ) | 42 ) |
42 | |
43 #define TT this.chmod | |
44 | |
45 #define FLAG_R 1 | |
46 #define FLAG_v 2 | |
47 | 43 |
48 int do_chmod(struct dirtree *try) | 44 int do_chmod(struct dirtree *try) |
49 { | 45 { |
50 mode_t mode; | 46 mode_t mode; |
51 | 47 |