Mercurial > hg > toybox
comparison toys/lsb/mktemp.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 | 760494af5163 |
children | 786841fdb1e0 |
comparison
equal
deleted
inserted
replaced
673:c102f31a753e | 674:7e846e281e38 |
---|---|
20 -d, --directory Create directory instead of file | 20 -d, --directory Create directory instead of file |
21 -p DIR, --tmpdir=DIR Put new file in DIR | 21 -p DIR, --tmpdir=DIR Put new file in DIR |
22 -q Quiet | 22 -q Quiet |
23 */ | 23 */ |
24 | 24 |
25 #define FOR_mktemp | |
25 #include "toys.h" | 26 #include "toys.h" |
26 | 27 |
27 DEFINE_GLOBALS( | 28 GLOBALS( |
28 char * tmpdir; | 29 char * tmpdir; |
29 ) | 30 ) |
30 | |
31 #define FLAG_p 1 | |
32 #define FLAG_d 2 | |
33 #define FLAG_q 4 | |
34 | |
35 #define TT this.mktemp | |
36 | 31 |
37 void mktemp_main(void) | 32 void mktemp_main(void) |
38 { | 33 { |
39 int d_flag = toys.optflags & FLAG_d; | 34 int d_flag = toys.optflags & FLAG_d; |
40 char *tmp; | 35 char *tmp; |