comparison toys/posix/id.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
23 -g Show only the effective group ID 23 -g Show only the effective group ID
24 -r Show real ID instead of effective ID 24 -r Show real ID instead of effective ID
25 -u Show only the effective user ID 25 -u Show only the effective user ID
26 */ 26 */
27 27
28 #define FOR_id
28 #include "toys.h" 29 #include "toys.h"
29
30 #define FLAG_n (1<<4)
31 #define FLAG_G (1<<3)
32 #define FLAG_g (1<<2)
33 #define FLAG_r (1<<1)
34 #define FLAG_u 1
35 30
36 static void s_or_u(char *s, unsigned u, int done) 31 static void s_or_u(char *s, unsigned u, int done)
37 { 32 {
38 if (toys.optflags & FLAG_n) printf("%s", s); 33 if (toys.optflags & FLAG_n) printf("%s", s);
39 else printf("%u", u); 34 else printf("%u", u);