Add prototypes to functions. Make -Wall happy.
This commit is contained in:
parent
afaeb55344
commit
cc42f59889
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26881
@ -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;
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user