From: Jan-Simon Pendry Date: Tue, 5 Apr 1994 22:18:40 +0000 (-0800) Subject: random wasn't. now uses integer compare with 0, which does X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/e35227859b2b42a38029802c58d60e5f33a8898e random wasn't. now uses integer compare with 0, which does SCCS-vsn: games/random/random.c 8.4 --- diff --git a/usr/src/games/random/random.c b/usr/src/games/random/random.c index 2e44bff413..32303f5e7f 100644 --- a/usr/src/games/random/random.c +++ b/usr/src/games/random/random.c @@ -15,7 +15,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)random.c 8.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)random.c 8.4 (Berkeley) %G%"; #endif /* not lint */ #include @@ -95,7 +95,7 @@ main(argc, argv) * 0 (which has a 1 / denom chance of being true), we select the * line. */ - selected = !((denom * random()) / LONG_MAX); + selected = !(int)((denom * random()) / LONG_MAX); while ((ch = getchar()) != EOF) { if (selected) (void)putchar(ch); @@ -105,7 +105,7 @@ main(argc, argv) err(2, "stdout"); /* Now see if the next line is to be printed. */ - selected = !((denom * random()) / LONG_MAX); + selected = !(int)((denom * random()) / LONG_MAX); } } if (ferror(stdin)) @@ -116,6 +116,7 @@ main(argc, argv) void usage() { + (void)fprintf(stderr, "usage: random [-er] [denominator]\n"); exit(1); }