summaryrefslogtreecommitdiff
path: root/usr.bin/checknr
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-07-12 05:17:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-07-12 05:17:34 +0000
commit937c9a0f84db15a0a64ed0419a42da3a34d96cde (patch)
treeb6b3bfb6f6bbc506426154fc8294316054abb45f /usr.bin/checknr
parent4e5dd980fd1238d635621b9bba7d99533aababd6 (diff)
first pass at a -Wall cleanup
Diffstat (limited to 'usr.bin/checknr')
-rw-r--r--usr.bin/checknr/checknr.c115
1 files changed, 71 insertions, 44 deletions
diff --git a/usr.bin/checknr/checknr.c b/usr.bin/checknr/checknr.c
index 723fca15e38..b1d4e72ce94 100644
--- a/usr.bin/checknr/checknr.c
+++ b/usr.bin/checknr/checknr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checknr.c,v 1.4 2000/11/21 13:43:52 aaron Exp $ */
+/* $OpenBSD: checknr.c,v 1.5 2001/07/12 05:16:56 deraadt Exp $ */
/* $NetBSD: checknr.c,v 1.4 1995/03/26 04:10:19 glass Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)checknr.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: checknr.c,v 1.4 2000/11/21 13:43:52 aaron Exp $";
+static char rcsid[] = "$OpenBSD: checknr.c,v 1.5 2001/07/12 05:16:56 deraadt Exp $";
#endif
#endif /* not lint */
@@ -74,6 +74,19 @@ struct stkstr {
} stk[MAXSTK];
int stktop;
+void usage(void);
+void addmac(char *);
+void process(FILE *);
+void pe(int);
+int eq(char *, char *);
+void complain(int);
+void prop(int);
+void chkcmd(char *, char *);
+void addcmd(char *);
+void nomatch(char *);
+void checkknown(char *);
+int binsrch(char *);
+
/*
* The kinds of opening and closing brackets.
*/
@@ -83,53 +96,53 @@ struct brstr {
} br[MAXBR] = {
/* A few bare bones troff commands */
#define SZ 0
- "sz", "sz", /* also \s */
+ { "sz", "sz" }, /* also \s */
#define FT 1
- "ft", "ft", /* also \f */
+ { "ft", "ft" }, /* also \f */
/* the -mm package */
- "AL", "LE",
- "AS", "AE",
- "BL", "LE",
- "BS", "BE",
- "DF", "DE",
- "DL", "LE",
- "DS", "DE",
- "FS", "FE",
- "ML", "LE",
- "NS", "NE",
- "RL", "LE",
- "VL", "LE",
+ { "AL", "LE" },
+ { "AS", "AE" },
+ { "BL", "LE" },
+ { "BS", "BE" },
+ { "DF", "DE" },
+ { "DL", "LE" },
+ { "DS", "DE" },
+ { "FS", "FE" },
+ { "ML", "LE" },
+ { "NS", "NE" },
+ { "RL", "LE" },
+ { "VL", "LE" },
/* the -ms package */
- "AB", "AE",
- "BD", "DE",
- "CD", "DE",
- "DS", "DE",
- "FS", "FE",
- "ID", "DE",
- "KF", "KE",
- "KS", "KE",
- "LD", "DE",
- "LG", "NL",
- "QS", "QE",
- "RS", "RE",
- "SM", "NL",
- "XA", "XE",
- "XS", "XE",
+ { "AB", "AE" },
+ { "BD", "DE" },
+ { "CD", "DE" },
+ { "DS", "DE" },
+ { "FS", "FE" },
+ { "ID", "DE" },
+ { "KF", "KE" },
+ { "KS", "KE" },
+ { "LD", "DE" },
+ { "LG", "NL" },
+ { "QS", "QE" },
+ { "RS", "RE" },
+ { "SM", "NL" },
+ { "XA", "XE" },
+ { "XS", "XE" },
/* The -me package */
- "(b", ")b",
- "(c", ")c",
- "(d", ")d",
- "(f", ")f",
- "(l", ")l",
- "(q", ")q",
- "(x", ")x",
- "(z", ")z",
+ { "(b", ")b" },
+ { "(c", ")c" },
+ { "(d", ")d" },
+ { "(f", ")f" },
+ { "(l", ")l" },
+ { "(q", ")q" },
+ { "(x", ")x" },
+ { "(z", ")z" },
/* Things needed by preprocessors */
- "EQ", "EN",
- "TS", "TE",
+ { "EQ", "EN" },
+ { "TS", "TE" },
/* Refer */
- "[", "]",
- 0, 0
+ { "[", "]" },
+ { 0, },
};
/*
@@ -181,6 +194,7 @@ int slot; /* slot in knowncmds found by binsrch */
char *malloc();
+int
main(argc, argv)
int argc;
char **argv;
@@ -261,6 +275,7 @@ char **argv;
exit(0);
}
+void
usage()
{
(void)fprintf(stderr,
@@ -269,6 +284,7 @@ usage()
exit(1);
}
+void
process(f)
FILE *f;
{
@@ -365,6 +381,7 @@ FILE *f;
}
}
+void
complain(i)
{
pe(stk[i].lno);
@@ -373,7 +390,9 @@ complain(i)
printf("\n");
}
+void
prop(i)
+ int i;
{
if (stk[i].pl == 0)
printf(".%s", br[stk[i].opno].opbr);
@@ -390,11 +409,12 @@ prop(i)
}
}
+void
chkcmd(line, mac)
char *line;
char *mac;
{
- register int i, n;
+ register int i;
/*
* Check to see if it matches top of stack.
@@ -427,6 +447,7 @@ char *mac;
}
}
+void
nomatch(mac)
char *mac;
{
@@ -472,6 +493,7 @@ char *mac;
}
/* eq: are two strings equal? */
+int
eq(s1, s2)
char *s1, *s2;
{
@@ -479,6 +501,7 @@ char *s1, *s2;
}
/* print the first part of an error message, given the line number */
+void
pe(lineno)
int lineno;
{
@@ -487,6 +510,7 @@ int lineno;
printf("%d: ", lineno);
}
+void
checkknown(mac)
char *mac;
{
@@ -505,6 +529,7 @@ char *mac;
/*
* We have a .de xx line in "line". Add xx to the list of known commands.
*/
+void
addcmd(line)
char *line;
{
@@ -536,6 +561,7 @@ char *line;
* me someday?) Anyway, I claim that .de is fairly rare in user
* nroff programs, and the register loop below is pretty fast.
*/
+void
addmac(mac)
char *mac;
{
@@ -568,6 +594,7 @@ printf("after: %s %s %s %s %s, %d cmds\n", knowncmds[slot-2], knowncmds[slot-1],
* Do a binary search in knowncmds for mac.
* If found, return the index. If not, return -1.
*/
+int
binsrch(mac)
char *mac;
{