Simplify yes(1)
Just pick the first argument if multiple are provided.
This commit is contained in:
parent
3a3cd24092
commit
a8ef54bae1
13
yes.c
13
yes.c
|
@ -8,24 +8,13 @@ static void usage(void);
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *s = "y";
|
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
} ARGEND;
|
} ARGEND;
|
||||||
|
|
||||||
switch(argc) {
|
|
||||||
case 1:
|
|
||||||
s = argv[0];
|
|
||||||
/* fallthrough */
|
|
||||||
case 0:
|
|
||||||
for (;;)
|
for (;;)
|
||||||
puts(s);
|
puts(argc >= 1 ? argv[0] : "y");
|
||||||
break;
|
|
||||||
default:
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
return EXIT_FAILURE; /* should not reach */
|
return EXIT_FAILURE; /* should not reach */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user