comparison toys/posix/cmp.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
18 18
19 -l show all differing bytes 19 -l show all differing bytes
20 -s silent 20 -s silent
21 */ 21 */
22 22
23 #define FOR_cmp
23 #include "toys.h" 24 #include "toys.h"
24 25
25 #define FLAG_s 1 26 GLOBALS(
26 #define FLAG_l 2
27
28 DEFINE_GLOBALS(
29 int fd; 27 int fd;
30 char *name; 28 char *name;
31 ) 29 )
32
33 #define TT this.cmp
34 30
35 // This handles opening the file and 31 // This handles opening the file and
36 32
37 void do_cmp(int fd, char *name) 33 void do_cmp(int fd, char *name)
38 { 34 {