summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-06-24 06:54:43 +0000
committercharnier <charnier@FreeBSD.org>1997-06-24 06:54:43 +0000
commitc32c798b05406e92635137075abeebf89ecbdaa5 (patch)
tree9069a37535d4312065b093fd8d917dfcccce9e0e /usr.bin
parentc8e3da3b206c2c4e2bc0d8953e763eefd87f254f (diff)
downloadFreeBSD-src-c32c798b05406e92635137075abeebf89ecbdaa5.zip
FreeBSD-src-c32c798b05406e92635137075abeebf89ecbdaa5.tar.gz
Add prototypes to functions. Make -Wall happy.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/checknr/checknr.c119
1 files changed, 74 insertions, 45 deletions
diff --git a/usr.bin/checknr/checknr.c b/usr.bin/checknr/checknr.c
index 336eb67..f8531cc 100644
--- a/usr.bin/checknr/checknr.c
+++ b/usr.bin/checknr/checknr.c
@@ -49,12 +49,27 @@ static char sccsid[] = "@(#)checknr.c 8.1 (Berkeley) 6/6/93";
* structured typesetting.
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <ctype.h>
#define MAXSTK 100 /* Stack size */
#define MAXBR 100 /* Max number of bracket pairs known */
#define MAXCMDS 500 /* Max number of commands known */
+void addcmd __P((char *));
+void addmac __P((char *));
+int binsrch __P((char *));
+void checkknown __P((char *));
+void chkcmd __P((char *, char *));
+void complain __P((int));
+int eq __P((char *, char *));
+void nomatch __P((char *));
+void pe __P((int));
+void process __P((FILE *));
+void prop __P((int));
+static void usage __P((void));
+
/*
* The stack on which we remember what we've seen so far.
*/
@@ -75,53 +90,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, 0}
};
/*
@@ -171,8 +186,7 @@ int sflag; /* -s: ignore \s */
int ncmds; /* size of knowncmds */
int slot; /* slot in knowncmds found by binsrch */
-char *malloc();
-
+int
main(argc, argv)
int argc;
char **argv;
@@ -254,12 +268,15 @@ char **argv;
exit(0);
}
+static void
usage()
{
- printf("Usage: checknr -s -f -a.xx.yy.xx.yy... -c.xx.xx.xx...\n");
+ fprintf(stderr,
+ "usage: checknr [-a.xx.yy.xx.yy...] [-c.xx.xx.xx...] [-s] [-f] file\n");
exit(1);
}
+void
process(f)
FILE *f;
{
@@ -356,7 +373,9 @@ FILE *f;
}
}
+void
complain(i)
+int i;
{
pe(stk[i].lno);
printf("Unmatched ");
@@ -364,7 +383,9 @@ complain(i)
printf("\n");
}
+void
prop(i)
+int i;
{
if (stk[i].pl == 0)
printf(".%s", br[stk[i].opno].opbr);
@@ -381,11 +402,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.
@@ -418,6 +440,7 @@ char *mac;
}
}
+void
nomatch(mac)
char *mac;
{
@@ -463,6 +486,7 @@ char *mac;
}
/* eq: are two strings equal? */
+int
eq(s1, s2)
char *s1, *s2;
{
@@ -470,6 +494,7 @@ char *s1, *s2;
}
/* print the first part of an error message, given the line number */
+void
pe(lineno)
int lineno;
{
@@ -478,6 +503,7 @@ int lineno;
printf("%d: ", lineno);
}
+void
checkknown(mac)
char *mac;
{
@@ -496,6 +522,7 @@ char *mac;
/*
* We have a .de xx line in "line". Add xx to the list of known commands.
*/
+void
addcmd(line)
char *line;
{
@@ -527,6 +554,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;
{
@@ -559,6 +587,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;
{
OpenPOWER on IntegriCloud