comparison toys/posix/chgrp.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
28 -L with -R change target of symlink, follow all symlinks 28 -L with -R change target of symlink, follow all symlinks
29 -P with -R change symlink, do not follow symlinks (default) 29 -P with -R change symlink, do not follow symlinks (default)
30 -v verbose output. 30 -v verbose output.
31 */ 31 */
32 32
33 #define FOR_chgrp
33 #include "toys.h" 34 #include "toys.h"
34 35
35 #define FLAG_v 1 36 GLOBALS(
36 #define FLAG_f 2
37 #define FLAG_R 4
38 #define FLAG_H 8
39 #define FLAG_L 16
40 #define FLAG_P 32
41 #define FLAG_h 64
42
43 DEFINE_GLOBALS(
44 uid_t owner; 37 uid_t owner;
45 gid_t group; 38 gid_t group;
46 char *owner_name, *group_name; 39 char *owner_name, *group_name;
47 int symfollow; 40 int symfollow;
48 ) 41 )
49
50 #define TT this.chgrp
51 42
52 static int do_chgrp(struct dirtree *node) 43 static int do_chgrp(struct dirtree *node)
53 { 44 {
54 int fd, ret, flags = toys.optflags; 45 int fd, ret, flags = toys.optflags;
55 46