From 7aa651a6a4496d848f86de9b1e6b3a003256a01f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 13 Nov 2012 17:14:08 -0600 Subject: Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring. --- toys/posix/wc.c | 126 +++++++++++++++++++++++++++----------------------------- 1 file changed, 61 insertions(+), 65 deletions(-) (limited to 'toys/posix/wc.c') diff --git a/toys/posix/wc.c b/toys/posix/wc.c index 3896b73a..19ba4b8b 100644 --- a/toys/posix/wc.c +++ b/toys/posix/wc.c @@ -1,6 +1,4 @@ -/* vi: set sw=4 ts=4: - * - * wc.c - Word count +/* wc.c - Word count * * Copyright 2011 Rob Landley * @@ -9,90 +7,88 @@ USE_WC(NEWTOY(wc, "mcwl", TOYFLAG_USR|TOYFLAG_BIN)) config WC - bool "wc" - default y - help - usage: wc -lwcm [FILE...] + bool "wc" + default y + help + usage: wc -lwcm [FILE...] - Count lines, words, and characters in input. + Count lines, words, and characters in input. - -l show lines - -w show words - -c show bytes - -m show characters + -l show lines + -w show words + -c show bytes + -m show characters - By default outputs lines, words, bytes, and filename for each - argument (or from stdin if none). Displays only either bytes - or characters. + By default outputs lines, words, bytes, and filename for each + argument (or from stdin if none). Displays only either bytes + or characters. */ #define FOR_wc #include "toys.h" GLOBALS( - unsigned long totals[3]; + unsigned long totals[3]; ) static void show_lengths(unsigned long *lengths, char *name) { - int i, nospace = 1; - for (i=0; i<3; i++) { - if (!toys.optflags || (toys.optflags&(1<>1; - loopfiles(toys.optargs, do_wc); - if (toys.optc>1) show_lengths(TT.totals, "total"); + setlocale(LC_ALL, ""); + toys.optflags |= (toys.optflags&8)>>1; + loopfiles(toys.optargs, do_wc); + if (toys.optc>1) show_lengths(TT.totals, "total"); } -- cgit v1.2.3