Audit yes(1)

Oh well, time to simplify the loop.
Also, change the comment on unreachable code to something more clear.
This commit is contained in:
FRIGN 2015-02-28 21:11:10 +01:00
parent bf3210b6de
commit ad9a9dd3e1

14
yes.c
View File

@ -19,14 +19,10 @@ main(int argc, char *argv[])
usage(); usage();
} ARGEND; } ARGEND;
if (argc == 0) { for (i = 0; ; i++, i %= argc ? argc : 1) {
for (;;) fputs(argc ? argv[i] : "y", stdout);
puts("y"); putchar((!argc || i == argc - 1) ? '\n' : ' ');
} else {
for (i = 0; ; i++, i %= argc) {
printf("%s", argv[i]);
putchar(i == argc - 1 ? '\n' : ' ');
} }
}
return 1; /* should not reach */ return 1; /* not reached */
} }