Simplify yes(1)
Just pick the first argument if multiple are provided.
This commit is contained in:
parent
3a3cd24092
commit
a8ef54bae1
15
yes.c
15
yes.c
@ -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 */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user