yes.c (448B)
1 /* see LICENSE file for copyright and license details */ 2 3 #include <stdio.h> 4 5 #include "util.h" 6 7 static void 8 usage(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 16 int 17 main(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 }