minor KNFify

This commit is contained in:
lukem 1997-10-11 02:12:11 +00:00
parent 01e7c03e2e
commit 04f410d254
6 changed files with 44 additions and 46 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bog.c,v 1.7 1997/10/10 12:04:23 lukem Exp $ */
/* $NetBSD: bog.c,v 1.8 1997/10/11 02:12:11 lukem Exp $ */
/*-
* Copyright (c) 1993
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\
#if 0
static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95";
#else
__RCSID("$NetBSD: bog.c,v 1.7 1997/10/10 12:04:23 lukem Exp $");
__RCSID("$NetBSD: bog.c,v 1.8 1997/10/11 02:12:11 lukem Exp $");
#endif
#endif /* not lint */
@ -262,8 +262,8 @@ char *
batchword(fp)
FILE *fp;
{
register int *p, *q;
register char *w;
int *p, *q;
char *w;
q = &wordpath[MAXWORDLEN + 1];
p = wordpath;
@ -290,7 +290,6 @@ batchword(fp)
void
playgame()
{
/* Can't use register variables if setjmp() is used! */
int i, *p, *q;
time_t t;
char buf[MAXWORDLEN + 1];
@ -414,8 +413,8 @@ checkword(word, prev, path)
char *word;
int prev, *path;
{
register char *p, *q;
register int i, *lm;
char *p, *q;
int i, *lm;
if (debug) {
(void) printf("checkword(%s, %d, [", word, prev);
@ -496,8 +495,8 @@ int
validword(word)
char *word;
{
register int j;
register char *q, *w;
int j;
char *q, *w;
j = word[0] - 'a';
if (dictseek(dictfp, dictindex[j].start, 0) < 0) {
@ -530,8 +529,8 @@ validword(word)
void
checkdict()
{
register char *p, **pw, *w;
register int i;
char *p, **pw, *w;
int i;
int prevch, previndex, *pi, *qi, st;
mwordsp = mwords;
@ -610,7 +609,7 @@ void
newgame(b)
char *b;
{
register int i, p, q;
int i, p, q;
char *tmp;
int *lm[26];
static char *cubes[16] = {
@ -656,7 +655,7 @@ newgame(b)
}
for (i = 0; i < 16; i++) {
register int j;
int j;
j = (int) (board[i] - 'a');
*lm[j] = i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mach.c,v 1.6 1997/10/10 12:04:31 lukem Exp $ */
/* $NetBSD: mach.c,v 1.7 1997/10/11 02:12:15 lukem Exp $ */
/*-
* Copyright (c) 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93";
#else
__RCSID("$NetBSD: mach.c,v 1.6 1997/10/10 12:04:31 lukem Exp $");
__RCSID("$NetBSD: mach.c,v 1.7 1997/10/11 02:12:15 lukem Exp $");
#endif
#endif /* not lint */
@ -173,8 +173,8 @@ char *
getline(q)
char *q;
{
register int ch, done;
register char *p;
int ch, done;
char *p;
int row, col;
p = q;
@ -662,7 +662,7 @@ static void
tty_showboard(b)
char *b;
{
register int i;
int i;
int line;
clear();

View File

@ -1,4 +1,4 @@
/* $NetBSD: prtable.c,v 1.3 1997/10/10 12:04:33 lukem Exp $ */
/* $NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $ */
/*-
* Copyright (c) 1993
@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: prtable.c,v 1.3 1997/10/10 12:04:33 lukem Exp $");
__RCSID("$NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $");
#endif /* not lint */
#include <curses.h>
@ -73,8 +73,8 @@ prtable(base, num, d_cols, width, prentry, length)
void (*prentry) __P((char *[], int));
int (*length) __P((char *[], int));
{
register int c, j;
register int a, b, cols, loc, maxlen, nrows, z;
int c, j;
int a, b, cols, loc, maxlen, nrows, z;
int col, row;
if (num == 0)
@ -123,7 +123,7 @@ get_maxlen(base, num, length)
int num;
int (*length) __P((char **, int));
{
register int i, len, max;
int i, len, max;
max = (*length)(base, 0);
for (i = 0; i < num; i++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: word.c,v 1.3 1997/10/10 12:04:39 lukem Exp $ */
/* $NetBSD: word.c,v 1.4 1997/10/11 02:12:18 lukem Exp $ */
/*-
* Copyright (c) 1993
@ -41,13 +41,14 @@
#if 0
static char sccsid[] = "@(#)word.c 8.1 (Berkeley) 6/11/93";
#else
__RCSID("$NetBSD: word.c,v 1.3 1997/10/10 12:04:39 lukem Exp $");
__RCSID("$NetBSD: word.c,v 1.4 1997/10/11 02:12:18 lukem Exp $");
#endif
#endif /* not lint */
#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -69,8 +70,8 @@ nextword(fp)
FILE *fp;
{
extern int wordlen;
register int ch, pcount;
register char *p;
int ch, pcount;
char *p;
static char buf[MAXWORDLEN + 1];
if (fp == NULL) {
@ -172,7 +173,7 @@ loaddict(fp)
}
if (st < 0) {
(void)fclose(fp);
(void)fprintf(stderr, "Error reading dictionary\n");
warnx("Error reading dictionary");
return (-1);
}
*p = '\0';
@ -189,25 +190,24 @@ int
loadindex(indexfile)
char *indexfile;
{
register int i, j;
int i, j;
char buf[BUFSIZ];
FILE *fp;
extern struct dictindex dictindex[];
if ((fp = fopen(indexfile, "r")) == NULL) {
(void) fprintf(stderr, "Can't open '%s'\n", indexfile);
warn("Can't open '%s'", indexfile);
return (-1);
}
i = 0;
while (fgets(buf, sizeof(buf), fp) != NULL) {
if (strchr(buf, '\n') == NULL) {
(void)fprintf(stderr,
"A line in the index file is too long\n");
warnx("A line in the index file is too long");
return(-1);
}
j = *buf - 'a';
if (i != j) {
(void) fprintf(stderr, "Bad index order\n");
warnx("Bad index order");
return(-1);
}
dictindex[j].start = atol(buf + 1);
@ -215,7 +215,7 @@ loadindex(indexfile)
i++;
}
if (i != 26) {
(void) fprintf(stderr, "Bad index length\n");
warnx("Bad index length");
return(-1);
}
(void) fclose(fp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkdict.c,v 1.2 1995/03/21 12:14:49 cgd Exp $ */
/* $NetBSD: mkdict.c,v 1.3 1997/10/11 02:12:21 lukem Exp $ */
/*-
* Copyright (c) 1993
@ -46,7 +46,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mkdict.c 8.1 (Berkeley) 6/11/93";
#else
static char rcsid[] = "$NetBSD: mkdict.c,v 1.2 1995/03/21 12:14:49 cgd Exp $";
static char rcsid[] = "$NetBSD: mkdict.c,v 1.3 1997/10/11 02:12:21 lukem Exp $";
#endif
#endif /* not lint */
@ -70,8 +70,8 @@ main(argc, argv)
int argc;
char *argv[];
{
register char *p, *q;
register int ch, common, n, nwords;
char *p, *q;
int ch, common, n, nwords;
int current, len, prev, qcount;
char buf[2][MAXWORDLEN + 1];
@ -83,9 +83,8 @@ main(argc, argv)
for (nwords = 1;
fgets(buf[current], MAXWORDLEN + 1, stdin) != NULL; ++nwords) {
if ((p = index(buf[current], '\n')) == NULL) {
fprintf(stderr,
"mkdict: word too long: %s\n", buf[current]);
if ((p = strchr(buf[current], '\n')) == NULL) {
warnx("word too long: %s", buf[current]);
while ((ch = getc(stdin)) != EOF && ch != '\n')
;
if (ch == EOF)
@ -125,6 +124,6 @@ main(argc, argv)
prev = !prev;
current = !current;
}
fprintf(stderr, "%d words\n", nwords);
warnx("%d words", nwords);
exit(0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkindex.c,v 1.2 1995/03/21 12:14:52 cgd Exp $ */
/* $NetBSD: mkindex.c,v 1.3 1997/10/11 02:12:23 lukem Exp $ */
/*-
* Copyright (c) 1993
@ -46,7 +46,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mkindex.c 8.1 (Berkeley) 6/11/93";
#else
static char rcsid[] = "$NetBSD: mkindex.c,v 1.2 1995/03/21 12:14:52 cgd Exp $";
static char rcsid[] = "$NetBSD: mkindex.c,v 1.3 1997/10/11 02:12:23 lukem Exp $";
#endif
#endif /* not lint */
@ -92,8 +92,8 @@ nextword(fp, buffer, clen, rlen)
char *buffer;
int *clen, *rlen;
{
register int ch, pcount;
register char *p, *q;
int ch, pcount;
char *p, *q;
static char buf[MAXWORDLEN + 1];
static int first = 1;
static int lastch = 0;