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