sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 0b5ab80b05d396bb51ef4d7ddda222715c63a7b1
parent f40608ef09cf5d76a6043472bd1683786d452c8e
Author: FRIGN <dev@frign.de>
Date:   Sun,  1 Feb 2015 02:23:35 +0100

Fix potential modulo 0

Diffstat:
Myes.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/yes.c b/yes.c @@ -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 */