Fix potential modulo 0

This commit is contained in:
FRIGN 2015-02-01 02:23:35 +01:00
parent f40608ef09
commit 0b5ab80b05

7
yes.c
View File

@ -20,8 +20,11 @@ main(int argc, char *argv[])
usage();
} ARGEND;
for (i = 0; ;i++, i %= argc) {
printf("%s", (argc > 0) ? argv[i] : "y");
if (argc == 0)
for (;;)
puts("y");
for (i = 0; ; i++, i %= argc) {
printf("%s", argv[i]);
putchar((i == argc - 1) ? '\n' : ' ');
}
return 1; /* should not reach */