master xplshn/aruu / cmd / pseudo / yes.c
 1/* See LICENSE file for copyright and license details. */
 2
 3#include <stdio.h>
 4
 5#include "util.h"
 6
 7static void
 8usage(void)
 9{
10  eprintf("usage: %s [string]\n", argv0);
11}
12
13// ?man yes: output string repeatedly
14// ?man arguments: string
15// ?man output a string repeatedly until terminated
16int
17main(int argc, char *argv[])
18{
19  const char *s;
20
21  ARGBEGIN
22  {
23    default:
24      usage();
25  }
26  ARGEND
27
28  s = argc ? argv[0] : "y";
29  for (;;)
30    puts(s);
31}