• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* yes.c - Repeatedly output a string.
2  *
3  * Copyright 2007 Rob Landley <rob@landley.net>
4 
5 USE_YES(NEWTOY(yes, NULL, TOYFLAG_USR|TOYFLAG_BIN))
6 
7 config YES
8   bool "yes"
9   default y
10   help
11     usage: yes [args...]
12 
13     Repeatedly output line until killed. If no args, output 'y'.
14 */
15 
16 #include "toys.h"
17 
yes_main(void)18 void yes_main(void)
19 {
20   for (;;) {
21     int i;
22     for (i=0; toys.optargs[i]; i++) {
23       if (i) xputc(' ');
24       xprintf("%s", toys.optargs[i]);
25     }
26     if (!i) xputc('y');
27     xputc('\n');
28   }
29 }
30