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();
} ARGEND;
if (argc == 0) {
for (;;)
puts("y");
} else {
for (i = 0; ; i++, i %= argc) {
printf("%s", argv[i]);
putchar(i == argc - 1 ? '\n' : ' ');
}
for (i = 0; ; i++, i %= argc ? argc : 1) {
fputs(argc ? argv[i] : "y", stdout);
putchar((!argc || i == argc - 1) ? '\n' : ' ');
}
return 1; /* should not reach */
return 1; /* not reached */
}