Fix potential modulo 0

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

5
yes.c
View File

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