summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--primes/pattern.c5
-rw-r--r--primes/pr_tbl.c5
-rw-r--r--primes/primes.c27
-rw-r--r--rain/rain.69
-rw-r--r--rain/rain.c64
-rw-r--r--random/random.68
-rw-r--r--random/random.c15
7 files changed, 68 insertions, 65 deletions
diff --git a/primes/pattern.c b/primes/pattern.c
index c770791c..3f55d240 100644
--- a/primes/pattern.c
+++ b/primes/pattern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pattern.c,v 1.3 1995/03/23 08:35:47 cgd Exp $ */
+/* $NetBSD: pattern.c,v 1.4 1997/10/12 01:04:43 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)pattern.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: pattern.c,v 1.3 1995/03/23 08:35:47 cgd Exp $";
+__RCSID("$NetBSD: pattern.c,v 1.4 1997/10/12 01:04:43 lukem Exp $");
#endif
#endif /* not lint */
diff --git a/primes/pr_tbl.c b/primes/pr_tbl.c
index f92f21f3..4f30541c 100644
--- a/primes/pr_tbl.c
+++ b/primes/pr_tbl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pr_tbl.c,v 1.3 1995/03/23 08:35:52 cgd Exp $ */
+/* $NetBSD: pr_tbl.c,v 1.4 1997/10/12 01:04:50 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)pr_tbl.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: pr_tbl.c,v 1.3 1995/03/23 08:35:52 cgd Exp $";
+__RCSID("$NetBSD: pr_tbl.c,v 1.4 1997/10/12 01:04:50 lukem Exp $");
#endif
#endif /* not lint */
diff --git a/primes/primes.c b/primes/primes.c
index 1390e66a..3c1a18ca 100644
--- a/primes/primes.c
+++ b/primes/primes.c
@@ -1,4 +1,4 @@
-/* $NetBSD: primes.c,v 1.6 1997/01/07 12:24:57 tls Exp $ */
+/* $NetBSD: primes.c,v 1.7 1997/10/12 01:04:55 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -36,17 +36,17 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1989, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95";
#else
-static char rcsid[] = "$NetBSD: primes.c,v 1.6 1997/01/07 12:24:57 tls Exp $";
+__RCSID("$NetBSD: primes.c,v 1.7 1997/10/12 01:04:55 lukem Exp $");
#endif
#endif /* not lint */
@@ -107,6 +107,7 @@ extern ubig *pr_limit; /* largest prime in the prime array */
extern char pattern[];
extern int pattern_size; /* length of pattern array */
+int main __P((int, char *[]));
void primes __P((ubig, ubig));
ubig read_num_buf __P((void));
void usage __P((void));
@@ -121,7 +122,7 @@ main(argc, argv)
int ch;
char *p;
- while ((ch = getopt(argc, argv, "")) != EOF)
+ while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
case '?':
default:
@@ -223,11 +224,11 @@ primes(start, stop)
ubig start; /* where to start generating */
ubig stop; /* don't generate at or above this value */
{
- register char *q; /* sieve spot */
- register ubig factor; /* index and factor */
- register char *tab_lim; /* the limit to sieve on the table */
- register ubig *p; /* prime table pointer */
- register ubig fact_lim; /* highest prime for current block */
+ char *q; /* sieve spot */
+ ubig factor; /* index and factor */
+ char *tab_lim; /* the limit to sieve on the table */
+ ubig *p; /* prime table pointer */
+ ubig fact_lim; /* highest prime for current block */
/*
* A number of systems can not convert double values into unsigned
@@ -262,7 +263,7 @@ primes(start, stop)
for (p = &prime[0], factor = prime[0];
factor < stop && p <= pr_limit; factor = *(++p)) {
if (factor >= start) {
- printf("%u\n", factor);
+ printf("%lu\n", (unsigned long) factor);
}
}
/* return early if we are done */
@@ -325,7 +326,7 @@ primes(start, stop)
*/
for (q = table; q < tab_lim; ++q, start+=2) {
if (*q) {
- printf("%u\n", start);
+ printf("%lu\n", (unsigned long) start);
}
}
}
diff --git a/rain/rain.6 b/rain/rain.6
index 3226ac0c..5e11502d 100644
--- a/rain/rain.6
+++ b/rain/rain.6
@@ -1,4 +1,4 @@
-.\" $NetBSD: rain.6,v 1.5 1996/08/17 20:48:06 explorer Exp $
+.\" $NetBSD: rain.6,v 1.6 1997/10/12 01:12:44 lukem Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -40,10 +40,11 @@
.Nm rain
.Nd animated raindrops display
.Sh SYNOPSIS
-.Nm /usr/games/rain
+.Nm
.Sh DESCRIPTION
-.Nm Rain 's
-display is modeled after the
+The output of
+.Nm
+is modeled after the
.Tn VAX/VMS
program of the same name.
The terminal has to be set for 9600 baud to obtain the proper effect.
diff --git a/rain/rain.c b/rain/rain.c
index ef9fbfbf..02f7c32d 100644
--- a/rain/rain.c
+++ b/rain/rain.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rain.c,v 1.7 1995/04/29 00:51:04 mycroft Exp $ */
+/* $NetBSD: rain.c,v 1.8 1997/10/12 01:12:52 lukem Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -33,17 +33,17 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)rain.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: rain.c,v 1.7 1995/04/29 00:51:04 mycroft Exp $";
+__RCSID("$NetBSD: rain.c,v 1.8 1997/10/12 01:12:52 lukem Exp $");
#endif
#endif /* not lint */
@@ -53,51 +53,49 @@ static char rcsid[] = "$NetBSD: rain.c,v 1.7 1995/04/29 00:51:04 mycroft Exp $";
*/
#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <curses.h>
+#include <err.h>
+#include <signal.h>
#include <stdio.h>
+#include <stdlib.h>
#include <termios.h>
-#include <signal.h>
#define cursor(c, r) tputs(tgoto(CM, c, r), 1, fputchar)
static struct termios sg, old_tty;
void fputchar __P((int));
-char *LL, *TE, *tgoto();
+int main __P((int, char **));
+void onsig __P((int));
+
+char *LL, *TE;
+
+int
main(argc, argv)
int argc;
char **argv;
{
- extern speed_t ospeed;
extern char *UP;
- register int x, y, j;
- register char *CM, *BC, *DN, *ND, *term;
- char *TI, *tcp, *mp, tcb[100],
- *malloc(), *getenv(), *strcpy(), *tgetstr();
- long cols, lines, random();
+ int x, y, j;
+ char *CM, *BC, *DN, *ND, *term;
+ char *TI, *tcp, *mp, tcb[100];
+ long cols, lines;
int xpos[5], ypos[5];
- static void onsig();
#ifdef TIOCGWINSZ
struct winsize ws;
#endif
- if (!(term = getenv("TERM"))) {
- fprintf(stderr, "%s: TERM: parameter not set\n", *argv);
- exit(1);
- }
- if (!(mp = malloc((u_int)1024))) {
- fprintf(stderr, "%s: out of space.\n", *argv);
- exit(1);
- }
- if (tgetent(mp, term) <= 0) {
- fprintf(stderr, "%s: %s: unknown terminal type\n", *argv, term);
- exit(1);
- }
+ if (!(term = getenv("TERM")))
+ errx(1, "TERM: parameter not set");
+ if (!(mp = malloc((u_int)1024)))
+ errx(1, "out of space");
+ if (tgetent(mp, term) <= 0)
+ errx(1, "unknown terminal type `%s'", term);
tcp = tcb;
- if (!(CM = tgetstr("cm", &tcp))) {
- fprintf(stderr, "%s: terminal not capable of cursor motion\n", *argv);
- exit(1);
- }
+ if (!(CM = tgetstr("cm", &tcp)))
+ errx(1, "terminal not capable of cursor motion");
if (!(BC = tgetstr("bc", &tcp)))
BC = "\b";
if (!(DN = tgetstr("dn", &tcp)))
@@ -137,7 +135,6 @@ main(argc, argv)
(void)signal(SIGTERM, onsig);
tcgetattr(1, &sg);
old_tty = sg;
- ospeed = cfgetospeed(&sg);
sg.c_iflag &= ~ICRNL;
sg.c_oflag &= ~ONLCR;
sg.c_lflag &= ~ECHO;
@@ -219,8 +216,9 @@ main(argc, argv)
}
}
-static void
-onsig()
+void
+onsig(dummy)
+ int dummy;
{
tputs(LL, 1, fputchar);
if (TE)
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;