Mercurial > hg > toybox
comparison toys/other/dos2unix.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 |
---|---|
15 | 15 |
16 Convert newline format between dos (\r\n) and unix (just \n) | 16 Convert newline format between dos (\r\n) and unix (just \n) |
17 If no files listed copy from stdin, "-" is a synonym for stdin. | 17 If no files listed copy from stdin, "-" is a synonym for stdin. |
18 */ | 18 */ |
19 | 19 |
20 #define FOR_dos2unix | |
20 #include "toys.h" | 21 #include "toys.h" |
21 | 22 |
22 DEFINE_GLOBALS( | 23 GLOBALS( |
23 char *tempfile; | 24 char *tempfile; |
24 ) | 25 ) |
25 | |
26 #define TT this.dos2unix | |
27 | 26 |
28 static void do_dos2unix(int fd, char *name) | 27 static void do_dos2unix(int fd, char *name) |
29 { | 28 { |
30 char c = toys.which->name[0]; | 29 char c = toys.which->name[0]; |
31 int outfd = 1, catch = 0; | 30 int outfd = 1, catch = 0; |