comparison toys/posix/wc.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 5cb41d56f9d3
children 9414be56b1db
comparison
equal deleted inserted replaced
673:c102f31a753e 674:7e846e281e38
22 22
23 By default outputs lines, words, characters, and filename for each 23 By default outputs lines, words, characters, and filename for each
24 argument (or from stdin if none). 24 argument (or from stdin if none).
25 */ 25 */
26 26
27 #define FOR_wc
27 #include "toys.h" 28 #include "toys.h"
28 29
29 DEFINE_GLOBALS( 30 GLOBALS(
30 unsigned long totals[3]; 31 unsigned long totals[3];
31 ) 32 )
32
33 #define TT this.wc
34 33
35 static void show_lengths(unsigned long *lengths, char *name) 34 static void show_lengths(unsigned long *lengths, char *name)
36 { 35 {
37 int i, nospace = 1; 36 int i, nospace = 1;
38 for (i=0; i<3; i++) { 37 for (i=0; i<3; i++) {