summaryrefslogtreecommitdiffstats
path: root/worms
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1997-10-12 02:12:45 +0000
committerlukem <lukem@NetBSD.org>1997-10-12 02:12:45 +0000
commit005769031bfe3c881881d8f65b9703ff7a349c4b (patch)
tree331f9770273c34be1fc828dc6bb2fddae4523fba /worms
parente0fada49e2f6fe9e3304c580dbc4fa389ae0f70d (diff)
downloadbsdgames-darwin-005769031bfe3c881881d8f65b9703ff7a349c4b.tar.gz
bsdgames-darwin-005769031bfe3c881881d8f65b9703ff7a349c4b.tar.zst
bsdgames-darwin-005769031bfe3c881881d8f65b9703ff7a349c4b.zip
WARNSify
Diffstat (limited to 'worms')
-rw-r--r--worms/worms.64
-rw-r--r--worms/worms.c39
2 files changed, 24 insertions, 19 deletions
diff --git a/worms/worms.6 b/worms/worms.6
index 4a757bed..ff74123c 100644
--- a/worms/worms.6
+++ b/worms/worms.6
@@ -1,4 +1,4 @@
-.\" $NetBSD: worms.6,v 1.6 1995/04/22 08:07:59 cgd Exp $
+.\" $NetBSD: worms.6,v 1.7 1997/10/12 02:18:22 lukem Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -39,7 +39,7 @@
.Nm worms
.Nd animate worms on a display terminal
.Sh SYNOPSIS
-.Nm worms
+.Nm
.Op Fl ft
.Op Fl l Ar length
.Op Fl n Ar number
diff --git a/worms/worms.c b/worms/worms.c
index dbf9511a..b0731afd 100644
--- a/worms/worms.c
+++ b/worms/worms.c
@@ -1,4 +1,4 @@
-/* $NetBSD: worms.c,v 1.8 1995/04/22 08:09:22 cgd Exp $ */
+/* $NetBSD: worms.c,v 1.9 1997/10/12 02:18:25 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[] = "@(#)worms.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: worms.c,v 1.8 1995/04/22 08:09:22 cgd Exp $";
+__RCSID("$NetBSD: worms.c,v 1.9 1997/10/12 02:18:25 lukem Exp $");
#endif
#endif /* not lint */
@@ -184,7 +184,12 @@ static struct worm {
} *worm;
void fputchar __P((int));
+int main __P((int, char **));
+void nomem __P((void));
void onsig __P((int));
+int tgetent __P((char *, char *));
+int tgetflag __P((char *));
+int tgetnum __P((char *));
char *tgetstr __P((char *, char **));
char *tgoto __P((char *, int, int));
int tputs __P((char *, int, void (*)(int)));
@@ -194,28 +199,27 @@ main(argc, argv)
int argc;
char *argv[];
{
- extern int optind;
- extern char *optarg, *UP;
- register int x, y, h, n;
- register struct worm *w;
- register struct options *op;
- register short *ip;
- register char *term;
+ extern char *UP;
+ int x, y, h, n;
+ struct worm *w;
+ struct options *op;
+ short *ip;
+ char *term;
int CO, IN, LI, last, bottom, ch, length, number, trail, Wrap;
short **ref;
char *AL, *BC, *CM, *EI, *HO, *IC, *IM, *IP, *SR;
char *field, tcb[100], *mp;
- long random();
struct termios ti;
#ifdef TIOCGWINSZ
struct winsize ws;
#endif
+ mp = NULL;
length = 16;
number = 3;
trail = ' ';
field = NULL;
- while ((ch = getopt(argc, argv, "fl:n:t")) != EOF)
+ while ((ch = getopt(argc, argv, "fl:n:t")) != -1)
switch(ch) {
case 'f':
field = "WORM";
@@ -326,7 +330,7 @@ main(argc, argv)
tputs(tgetstr("ti", &tcp), 1, fputchar);
tputs(tgetstr("cl", &tcp), 1, fputchar);
if (field) {
- register char *p = field;
+ char *p = field;
for (y = bottom; --y >= 0;) {
for (x = CO; --x >= 0;) {
@@ -402,7 +406,7 @@ main(argc, argv)
if (++h == length)
h = 0;
if (w->xpos[w->head = h] >= 0) {
- register int x1, y1;
+ int x1, y1;
x1 = w->xpos[h];
y1 = w->ypos[h];
@@ -417,7 +421,7 @@ main(argc, argv)
case 0:
(void)fflush(stdout);
abort();
- return;
+ return(1);
case 1:
w->orientation = op->opts[0];
break;
@@ -450,6 +454,7 @@ fputchar(c)
(void)putchar(c);
}
+void
nomem()
{
(void)fprintf(stderr, "worms: not enough memory.\n");