From e2d4f36cd909cf60f33ecfef8b6fb02293e22c59 Mon Sep 17 00:00:00 2001 From: lukem Date: Sun, 12 Oct 1997 01:04:43 +0000 Subject: WARNSify --- random/random.6 | 8 ++++---- random/random.c | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'random') diff --git a/random/random.6 b/random/random.6 index 5d238367..5fff3e3e 100644 --- a/random/random.6 +++ b/random/random.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: random.6,v 1.2 1995/04/22 07:44:04 cgd Exp $ +.\" $NetBSD: random.6,v 1.3 1997/10/12 01:14:18 lukem Exp $ .\" .\" Copyright (c) 1994 .\" The Regents of the University of California. All rights reserved. @@ -40,11 +40,11 @@ .Nm random .Nd random lines from a file or random numbers .Sh SYNOPSIS -.Nm random +.Nm .Op Fl er .Op Ar denominator .Sh DESCRIPTION -.Nm Random +.Nm reads lines from the standard input and copies them to the standard output with a probability of 1/denominator. The default value for @@ -57,7 +57,7 @@ The options are as follows: If the .Fl e option is specified, -.Nm random +.Nm does not read or write anything, and simply exits with a random exit value of 0 to .Ar denominator diff --git a/random/random.c b/random/random.c index f48ecbbb..f4c4f1d4 100644 --- a/random/random.c +++ b/random/random.c @@ -1,4 +1,4 @@ -/* $NetBSD: random.c,v 1.4 1997/01/07 12:30:26 tls Exp $ */ +/* $NetBSD: random.c,v 1.5 1997/10/12 01:14:22 lukem Exp $ */ /* * Copyright (c) 1994 @@ -36,17 +36,17 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1994\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1994\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)random.c 8.6 (Berkeley) 6/1/94"; #else -static char rcsid[] = "$NetBSD: random.c,v 1.4 1997/01/07 12:30:26 tls Exp $"; +__RCSID("$NetBSD: random.c,v 1.5 1997/10/12 01:14:22 lukem Exp $"); #endif #endif /* not lint */ @@ -61,6 +61,7 @@ static char rcsid[] = "$NetBSD: random.c,v 1.4 1997/01/07 12:30:26 tls Exp $"; #include #include +int main __P((int, char **)); void usage __P((void)); int @@ -68,14 +69,14 @@ main(argc, argv) int argc; char *argv[]; { - extern int optind; struct timeval tp; double denom; int ch, random_exit, selected, unbuffer_output; char *ep; + denom = 0; random_exit = unbuffer_output = 0; - while ((ch = getopt(argc, argv, "er")) != EOF) + while ((ch = getopt(argc, argv, "er")) != -1) switch (ch) { case 'e': random_exit = 1; -- cgit v1.2.3-56-ge451