toybox/toys/other/yes.c
<<
>>
Prefs
   1/* yes.c - Repeatedly output a string.
   2 *
   3 * Copyright 2007 Rob Landley <rob@landley.net>
   4
   5USE_YES(NEWTOY(yes, NULL, TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LINEBUF))
   6
   7config 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
  18void 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