Simplify yes(1)

Just pick the first argument if multiple are provided.
This commit is contained in:
sin 2013-10-05 15:04:50 +01:00
parent 3a3cd24092
commit a8ef54bae1

15
yes.c
View File

@ -8,24 +8,13 @@ static void usage(void);
int
main(int argc, char *argv[])
{
char *s = "y";
ARGBEGIN {
default:
usage();
} ARGEND;
switch(argc) {
case 1:
s = argv[0];
/* fallthrough */
case 0:
for(;;)
puts(s);
break;
default:
usage();
}
for (;;)
puts(argc >= 1 ? argv[0] : "y");
return EXIT_FAILURE; /* should not reach */
}