comparison toys/other/yes.c @ 694:786841fdb1e0

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.
author Rob Landley <rob@landley.net>
date Tue, 13 Nov 2012 17:14:08 -0600
parents 6df4ccc0acbe
children
comparison
equal deleted inserted replaced
693:4a5a250e0633 694:786841fdb1e0
1 /* vi: set sw=4 ts=4: 1 /* yes.c - Repeatedly output a string.
2 *
3 * yes.c - Repeatedly output a string.
4 * 2 *
5 * Copyright 2007 Rob Landley <rob@landley.net> 3 * Copyright 2007 Rob Landley <rob@landley.net>
6 4
7 USE_YES(NEWTOY(yes, NULL, TOYFLAG_USR|TOYFLAG_BIN)) 5 USE_YES(NEWTOY(yes, NULL, TOYFLAG_USR|TOYFLAG_BIN))
8 6
9 config YES 7 config YES
10 bool "yes" 8 bool "yes"
11 default y 9 default y
12 help 10 help
13 usage: yes [args...] 11 usage: yes [args...]
14 12
15 Repeatedly output line until killed. If no args, output 'y'. 13 Repeatedly output line until killed. If no args, output 'y'.
16 */ 14 */
17 15
18 #include "toys.h" 16 #include "toys.h"
19 17
20 void yes_main(void) 18 void yes_main(void)
21 { 19 {
22 for (;;) { 20 for (;;) {
23 int i; 21 int i;
24 for (i=0; toys.optargs[i]; i++) { 22 for (i=0; toys.optargs[i]; i++) {
25 if (i) xputc(' '); 23 if (i) xputc(' ');
26 xprintf("%s", toys.optargs[i]); 24 xprintf("%s", toys.optargs[i]);
27 } 25 }
28 if (!i) xputc('y'); 26 if (!i) xputc('y');
29 xputc('\n'); 27 xputc('\n');
30 } 28 }
31 } 29 }