summaryrefslogtreecommitdiffstats
path: root/random
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1997-10-12 01:04:43 +0000
committerlukem <lukem@NetBSD.org>1997-10-12 01:04:43 +0000
commite2d4f36cd909cf60f33ecfef8b6fb02293e22c59 (patch)
treed1c1c05ec3c6aaecec6011a5733e70ea269fc1c4 /random
parent9d96f89bba59d8190721c35fe575b172409c8b37 (diff)
downloadbsdgames-darwin-e2d4f36cd909cf60f33ecfef8b6fb02293e22c59.tar.gz
bsdgames-darwin-e2d4f36cd909cf60f33ecfef8b6fb02293e22c59.tar.zst
bsdgames-darwin-e2d4f36cd909cf60f33ecfef8b6fb02293e22c59.zip
WARNSify
Diffstat (limited to 'random')
-rw-r--r--random/random.68
-rw-r--r--random/random.c15
2 files changed, 12 insertions, 11 deletions
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 <sys/cdefs.h>
#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 <unistd.h>
#include <limits.h>
+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;