aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/tee.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-10-08 00:02:30 -0500
committerRob Landley <rob@landley.net>2012-10-08 00:02:30 -0500
commitc0e56edaf256adb6c60c5a052525a1ffbb927901 (patch)
treed6bcc5c181ca46910a12d4dece4b26d6c71be3e1 /toys/posix/tee.c
parentdc7a77d1940858495f76998f4d13cac9f73e0226 (diff)
downloadtoybox-c0e56edaf256adb6c60c5a052525a1ffbb927901.tar.gz
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.
Diffstat (limited to 'toys/posix/tee.c')
-rw-r--r--toys/posix/tee.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/toys/posix/tee.c b/toys/posix/tee.c
index 15a40fe7..e6342f4c 100644
--- a/toys/posix/tee.c
+++ b/toys/posix/tee.c
@@ -21,14 +21,13 @@ config TEE
-i ignore SIGINT.
*/
+#define FOR_tee
#include "toys.h"
-DEFINE_GLOBALS(
+GLOBALS(
void *outputs;
)
-#define TT this.tee
-
struct fd_list {
struct fd_list *next;
int fd;
@@ -48,12 +47,12 @@ static void do_tee_open(int fd, char *name)
void tee_main(void)
{
- if (toys.optflags&2) signal(SIGINT, SIG_IGN);
+ if (toys.optflags & FLAG_i) signal(SIGINT, SIG_IGN);
// Open output files
loopfiles_rw(toys.optargs,
- O_RDWR|O_CREAT|((toys.optflags&1)?O_APPEND:O_TRUNC), 0666, 0,
- do_tee_open);
+ O_RDWR|O_CREAT|((toys.optflags & FLAG_a)?O_APPEND:O_TRUNC),
+ 0666, 0, do_tee_open);
for (;;) {
struct fd_list *fdl;