yes.c (430B)
1 /* See LICENSE file for copyright and license details. */ 2 #include <stdio.h> 3 4 #include "util.h" 5 6 static void 7 usage(void) 8 { 9 eprintf("usage: %s [string ...]\n", argv0); 10 } 11 12 int 13 main(int argc, char *argv[]) 14 { 15 char **p; 16 17 ARGBEGIN { 18 default: 19 usage(); 20 } ARGEND 21 22 for (p = argv; ; p = (*p && *(p + 1)) ? p + 1 : argv) { 23 fputs(*p ? *p : "y", stdout); 24 putchar((!*p || !*(p + 1)) ? '\n' : ' '); 25 } 26 27 return 1; /* not reached */ 28 }