cawf: Update K&R function declarations

Change-Id: Ib18171089c7b389f7f2643d7298f9659e882f65c
This commit is contained in:
Jacob Adams 2015-05-16 23:14:24 -04:00 committed by Lionel Sambuc
parent c6748a4a93
commit d9494baa34
14 changed files with 162 additions and 378 deletions

View file

@ -54,10 +54,7 @@ int Ulx = 0; /* underline buffer index */
void Putchar(int ch); void Putchar(int ch);
main(argc, argv) int main(int argc, char *argv[]) {
int argc;
char *argv[];
{
int ax = 1; /* argument index */ int ax = 1; /* argument index */
unsigned char c; /* character buffer */ unsigned char c; /* character buffer */
FILE *fs; /* file stream */ FILE *fs; /* file stream */
@ -165,10 +162,7 @@ main(argc, argv)
* Putchar(ch) - put a character with possible underlining * Putchar(ch) - put a character with possible underlining
*/ */
void void Putchar(int ch) {
Putchar(ch)
int ch;
{
int i; /* temporary index */ int i; /* temporary index */
if ((unsigned char)ch == '\n') { if ((unsigned char)ch == '\n') {

View file

@ -45,10 +45,7 @@ static char Version[] = "4.0";
#endif #endif
main(argc, argv) int main(int argc, char *argv[]) {
int argc;
char *argv[];
{
char *ep; /* environment pointer */ char *ep; /* environment pointer */
int fff = 0; /* final form feed status */ int fff = 0; /* final form feed status */
char **files; /* file names */ char **files; /* file names */
@ -361,10 +358,7 @@ main(argc, argv)
* pass non-macros and macros alike to pass 2 * pass non-macros and macros alike to pass 2
*/ */
void void Macro(unsigned char *inp) { /* possible macro statement pointer */
Macro(inp)
unsigned char *inp; /* possible macro statement pointer */
{
unsigned char c[2]; /* characters */ unsigned char c[2]; /* characters */
int endm; /* end of macro status */ int endm; /* end of macro status */
FILE *fs; /* temporary file stream */ FILE *fs; /* temporary file stream */

View file

@ -44,11 +44,10 @@ static int Convfont(char *nm, char *s, char **fn, unsigned char **fi);
* Convstr(s, len) - convert a string * Convstr(s, len) - convert a string
*/ */
static unsigned char * static unsigned char *Convstr(char *s, int *len) {
Convstr(s, len) /* input string s
char *s; /* input string */ * length of result len
int *len; /* length of result */ */
{
int c; /* character assembly */ int c; /* character assembly */
unsigned char *cp; /* temporary character pointer */ unsigned char *cp; /* temporary character pointer */
char *em; /* error message */ char *em; /* error message */
@ -157,13 +156,12 @@ non_hex_char:
* Convfont(nm, s, fn, fi) - convert a font for a device * Convfont(nm, s, fn, fi) - convert a font for a device
*/ */
static int static int Convfont(char* nm, char *s, char **fn, unsigned char **fi) {
Convfont(nm, s, fn, fi) /* output device name nm
char *nm; /* output device name */ * font definition string s
char *s; /* font definition string */ * font name address fn
char **fn; /* font name address */ * initialization string address fi
unsigned char **fi; /* initialization string address */ */
{
char *cp; /* temporary character pointer */ char *cp; /* temporary character pointer */
int len; /* length */ int len; /* length */
/* /*
@ -195,9 +193,7 @@ Convfont(nm, s, fn, fi)
* Defdev() - define the output device * Defdev() - define the output device
*/ */
int int Defdev(void) {
Defdev()
{
unsigned char *fi = NULL; /* last font initialization string */ unsigned char *fi = NULL; /* last font initialization string */
char *fn = NULL; /* font name */ char *fn = NULL; /* font name */
int fd = 0; /* found-device flag */ int fd = 0; /* found-device flag */

View file

@ -35,12 +35,11 @@
* Error(t, l, s1, s2) - issue error message * Error(t, l, s1, s2) - issue error message
*/ */
void void Error(int t, int l, char *s1, char *s2) {
Error(t, l, s1, s2) /* type: WARN or FATAL t
int t; /* type: WARN or FATAL */ * LINE: display Line[] l
int l; /* LINE: display Line[] */ * optional text s1 and s2
char *s1, *s2; /* optional text */ */
{
char msg[MAXLINE]; /* message */ char msg[MAXLINE]; /* message */
if (t == WARN && !Dowarn) return; if (t == WARN && !Dowarn) return;
@ -69,14 +68,13 @@ Error(t, l, s1, s2)
* Error3(len, word, sarg, narg) - process error in pass3 * Error3(len, word, sarg, narg) - process error in pass3
*/ */
void void Error3(int len, char* word, char *sarg, int narg, char *msg) {
Error3(len, word, sarg, narg, msg) /* length (negative is special) len
int len; /* length (negative is special */ * word word
char *word; /* word */ * string argument sarg
char *sarg; /* string argument */ * numeric argument narg
int narg; /* numeric argument */ * message msg
char *msg; /* message */ */
{
if (len == MESSAGE) { if (len == MESSAGE) {
(void) fprintf(Efs, "%s: (%s, %d) %s\n", (void) fprintf(Efs, "%s: (%s, %d) %s\n",
Pname, Pname,

View file

@ -34,10 +34,8 @@
* Expand(line) - expand macro or if/ie/el line * Expand(line) - expand macro or if/ie/el line
*/ */
void void Expand(unsigned char *line) {
Expand(line)
unsigned char *line;
{
unsigned char buf[2*MAXLINE]; /* line buffer */ unsigned char buf[2*MAXLINE]; /* line buffer */
unsigned char cmd[4]; /* nroff command */ unsigned char cmd[4]; /* nroff command */
int cmdl; /* command length */ int cmdl; /* command length */
@ -108,7 +106,7 @@ Expand(line)
cond = 1; cond = 1;
} }
} }
else if (regexec(Pat[3].pat, lp)) { else if (regexec(Pat[3].pat, lp)) {
/* /*
* Argument string comparison: - "^[.']i[ef] !?'\\\$[0-9]'[^']*' " * Argument string comparison: - "^[.']i[ef] !?'\\\$[0-9]'[^']*' "
@ -129,7 +127,7 @@ Expand(line)
iflen += n2 + 2; iflen += n2 + 2;
} }
} }
else if (regexec(Pat[4].pat, lp)) { else if (regexec(Pat[4].pat, lp)) {
/* /*
* Nroff or troff: - "^[.']i[ef] !?[nt] " * Nroff or troff: - "^[.']i[ef] !?[nt] "
@ -138,7 +136,7 @@ Expand(line)
if (*(lp + iflen - 2) == 'n') if (*(lp + iflen - 2) == 'n')
cond = 1; cond = 1;
} }
else if ((*lp == '.' || *lp == '\'') else if ((*lp == '.' || *lp == '\'')
&& strncmp((char *)lp+1, "el ", 3) == 0) { && strncmp((char *)lp+1, "el ", 3) == 0) {
/* /*
@ -147,7 +145,7 @@ Expand(line)
cond = 1 - prevcond; cond = 1 - prevcond;
iflen = 4; iflen = 4;
} }
else { else {
/* /*
* Unknown conditional: * Unknown conditional:

View file

@ -36,11 +36,10 @@
* definition - e. .g, "\\nPO" * definition - e. .g, "\\nPO"
*/ */
unsigned char * unsigned char *Asmcode(unsigned char **s, unsigned char *c) {
Asmcode(s, c) /* pointer to character after '\\' s
unsigned char **s; /* pointer to character after '\\' */ * code destination (c[3]) c
unsigned char *c; /* code destination (c[3]) */ */
{
unsigned char *s1; unsigned char *s1;
s1 = *s + 1; s1 = *s + 1;
@ -60,10 +59,9 @@ Asmcode(s, c)
* Delnum(nx) - delete number * Delnum(nx) - delete number
*/ */
void void Delnum(int nx) {
Delnum(nx) /* number index nx */
int nx; /* number index */
{
unsigned char buf[MAXLINE]; /* message buffer */ unsigned char buf[MAXLINE]; /* message buffer */
if (nx >= Nnr) { if (nx >= Nnr) {
@ -82,12 +80,12 @@ Delnum(nx)
* Findnum(n, v, e) - find or optionally enter number value * Findnum(n, v, e) - find or optionally enter number value
*/ */
Findnum(n, v, e) int Findnum(unsigned char *n, int v, int e) {
unsigned char *n; /* register name */ /* register name n
int v; /* value */ * value v
int e; /* 0 = find, don't enter * e = 0 = find, don't enter
* 1 = enter, don't find */ * e = 1 = enter, don't find
{ */
int cmp, low, hi, mid; /* binary search controls */ int cmp, low, hi, mid; /* binary search controls */
unsigned char c[3]; /* name buffer */ unsigned char c[3]; /* name buffer */
@ -130,9 +128,8 @@ Findnum(n, v, e)
* Findparms(n) - find parameter registers * Findparms(n) - find parameter registers
*/ */
Findparms(n) int Findparms(unsigned char *n) {
unsigned char *n; /* parameter name */ /* parameter name n */
{
unsigned char c[3]; /* character buffer */ unsigned char c[3]; /* character buffer */
int i; /* temporary index */ int i; /* temporary index */
@ -151,12 +148,12 @@ Findparms(n)
* Findscale(n, v, e) - find and optionally enter scaling factor value * Findscale(n, v, e) - find and optionally enter scaling factor value
*/ */
Findscale(n, v, e) int Findscale(int n, double v, int e) {
int n; /* scaling factor name */ /* scaling factor name n
double v; /* value */ * value v
int e; /* 0 = find, don't enter * e = 0 = find, don't enter
* 1 = enter, don't find */ * e = 1 = enter, don't find
{ */
int i; int i;
double *pval; double *pval;

View file

@ -30,11 +30,7 @@ int optind = 1;
int optopt; int optopt;
char *optarg; char *optarg;
int int getopt(int argc, char **argv, char **opts) {
getopt(argc, argv, opts)
int argc;
char **argv, *opts;
{
static int sp = 1; static int sp = 1;
register int c; register int c;
register char *cp; register char *cp;

View file

@ -35,9 +35,8 @@
* Delmacro(mx) - delete macro * Delmacro(mx) - delete macro
*/ */
Delmacro(mx) int Delmacro(int mx) {
int mx; /* macro index */ /* macro index mx */
{
unsigned char buf[MAXLINE]; /* error message buffer */ unsigned char buf[MAXLINE]; /* error message buffer */
int i, j; /* temporary indexes */ int i, j; /* temporary indexes */
@ -59,12 +58,11 @@ Delmacro(mx)
* Field(n, p, c) - skip to field n in p and optionally return a copy * Field(n, p, c) - skip to field n in p and optionally return a copy
*/ */
unsigned char * unsigned char *Field(int n, unsigned char *p, int c) {
Field(n, p, c) /* field number n
int n; /* field number */ * pointer to line containing fields p
unsigned char *p; /* pointer to line containing fields */ * c = 1: make a copy of the field
int c; /* 1: make a copy of the field */ */
{
unsigned char *fs, *fe, *s; unsigned char *fs, *fe, *s;
if (c) if (c)
@ -101,11 +99,11 @@ Field(n, p, c)
*/ */
Findmacro(p, e) int Findmacro(unsigned char *p, int e) {
unsigned char *p; /* pointer to 2 character macro name */ /* pointer to 2 character macro name p
int e; /* 0 = find, don't enter * e = 0 = find, don't enter
* 1 = enter, don't find */ * e = 1 = enter, don't find
{ */
unsigned char c[3]; unsigned char c[3];
int cmp, hi, low, mid; int cmp, hi, low, mid;
@ -153,10 +151,7 @@ new_macro:
return(mid); return(mid);
} }
void void Free(unsigned char **p) {
Free(p)
unsigned char **p;
{
if (*p != NULL) { if (*p != NULL) {
(void) free(*p); (void) free(*p);
*p = NULL; *p = NULL;
@ -167,10 +162,7 @@ Free(p)
* Newstr(s) - allocate space for string * Newstr(s) - allocate space for string
*/ */
unsigned char * unsigned char *Newstr(unsigned char *s) {
Newstr(s)
unsigned char *s;
{
unsigned char *ns; unsigned char *ns;
if ((ns = (unsigned char *)malloc((size_t)(strlen((char *)s) + 1))) if ((ns = (unsigned char *)malloc((size_t)(strlen((char *)s) + 1)))

View file

@ -116,11 +116,7 @@ static struct nr_req {
* buffer with request status of (brk) * buffer with request status of (brk)
*/ */
void void Nreq(unsigned char *line, int brk) {
Nreq(line, brk)
unsigned char *line;
int brk;
{
unsigned char c[3]; /* command buffer */ unsigned char c[3]; /* command buffer */
int cmp, hi, low, mid; /* binary search indixes */ int cmp, hi, low, mid; /* binary search indixes */
@ -152,11 +148,7 @@ Nreq(line, brk)
* Adjust - "^[.']ad" * Adjust - "^[.']ad"
*/ */
static void static void nr_ad(unsigned char *line, int brk) {
nr_ad(line, brk)
unsigned char *line;
int brk;
{
Pass3(NOBREAK, (unsigned char *)"both", NULL, 0); Pass3(NOBREAK, (unsigned char *)"both", NULL, 0);
} }
@ -165,11 +157,7 @@ nr_ad(line, brk)
* Begin new page - "^[.']bp" * Begin new page - "^[.']bp"
*/ */
static void static void nr_bp(unsigned char *line, int brk) {
nr_bp(line, brk)
unsigned char *line;
int brk;
{
Pass3(brk, (unsigned char *)"need", NULL, 999); Pass3(brk, (unsigned char *)"need", NULL, 999);
} }
@ -178,11 +166,7 @@ nr_bp(line, brk)
* Break - "^[.']br" * Break - "^[.']br"
*/ */
static void static void nr_br(unsigned char *line, int brk) {
nr_br(line, brk)
unsigned char *line;
int brk;
{
Pass3(brk, (unsigned char *)"flush", NULL, 0); Pass3(brk, (unsigned char *)"flush", NULL, 0);
} }
@ -191,11 +175,7 @@ nr_br(line, brk)
* Center - "^[.']ce" * Center - "^[.']ce"
*/ */
static void static void nr_ce(unsigned char *line, int brk) {
nr_ce(line, brk)
unsigned char *line;
int brk;
{
unsigned char *s; /* string poiner */ unsigned char *s; /* string poiner */
if ((s = Field(2, line, 0)) != NULL) if ((s = Field(2, line, 0)) != NULL)
@ -209,11 +189,7 @@ nr_ce(line, brk)
* Diversion on and off - "^[.']di" * Diversion on and off - "^[.']di"
*/ */
static void static void nr_di(unsigned char *line, int brk) {
nr_di(line, brk)
unsigned char *line;
int brk;
{
Pass3(DOBREAK, (unsigned char *)"flush", NULL, 0); Pass3(DOBREAK, (unsigned char *)"flush", NULL, 0);
Divert ^= 1; Divert ^= 1;
} }
@ -223,11 +199,7 @@ nr_di(line, brk)
* Define string - "^[.']ds" * Define string - "^[.']ds"
*/ */
static void static void nr_ds(unsigned char *line, int brk) {
nr_ds(line, brk)
unsigned char *line;
int brk;
{
unsigned char buf[MAXLINE]; /* temporary buffer */ unsigned char buf[MAXLINE]; /* temporary buffer */
unsigned char nm[4], nm1[4]; /* name buffers */ unsigned char nm[4], nm1[4]; /* name buffers */
unsigned char *s1, *s2, *s3, /* temporary string pointers */ unsigned char *s1, *s2, *s3, /* temporary string pointers */
@ -263,11 +235,7 @@ nr_ds(line, brk)
* Fill - "^[.']fi" * Fill - "^[.']fi"
*/ */
static void static void nr_fi(unsigned char *line, int brk) {
nr_fi(line, brk)
unsigned char *line;
int brk;
{
Fill = 1; Fill = 1;
Pass3(brk, (unsigned char *)"flush", NULL, 0); Pass3(brk, (unsigned char *)"flush", NULL, 0);
} }
@ -277,11 +245,7 @@ nr_fi(line, brk)
* Flush - "^[.']fl" * Flush - "^[.']fl"
*/ */
static void static void nr_fl(unsigned char *line, int brk) {
nr_fl(line, brk)
unsigned char *line;
int brk;
{
Pass3(brk, (unsigned char *)"flush", NULL, 0); Pass3(brk, (unsigned char *)"flush", NULL, 0);
} }
@ -290,11 +254,7 @@ nr_fl(line, brk)
* Font - "^[.']ft <font_name>" * Font - "^[.']ft <font_name>"
*/ */
static void static void nr_ft(unsigned char *line, int brk) {
nr_ft(line, brk)
unsigned char *line;
int brk;
{
int i; /* temporary index */ int i; /* temporary index */
if (line[3] == '\0' || line[4] == '\0') if (line[3] == '\0' || line[4] == '\0')
@ -320,12 +280,7 @@ nr_ft(line, brk)
* Input trap - "^[.']it [1 <request>]" * Input trap - "^[.']it [1 <request>]"
*/ */
static void static void nr_it(unsigned char *line, int brk) {
nr_it(line, brk)
unsigned char *line;
int brk;
{
unsigned char buf[MAXLINE]; /* temporary buffer */ unsigned char buf[MAXLINE]; /* temporary buffer */
int i; /* temporary index */ int i; /* temporary index */
unsigned char *s1, *s2; /* temporary string pointers */ unsigned char *s1, *s2; /* temporary string pointers */
@ -367,11 +322,7 @@ nr_it(line, brk)
* *
*/ */
static void static void nr_nil(unsigned char *line, int brk) {
nr_nil(line, brk)
unsigned char *line;
int brk;
{
} }
@ -379,11 +330,7 @@ nr_nil(line, brk)
* No adjust "^[.']na" * No adjust "^[.']na"
*/ */
static void static void nr_na(unsigned char *line, int brk) {
nr_na(line, brk)
unsigned char *line;
int brk;
{
Pass3(NOBREAK, (unsigned char *)"left", NULL, 0); Pass3(NOBREAK, (unsigned char *)"left", NULL, 0);
} }
@ -392,11 +339,7 @@ nr_na(line, brk)
* No fill - "^[.']nf" * No fill - "^[.']nf"
*/ */
static void static void nr_nf(unsigned char *line, int brk) {
nr_nf(line, brk)
unsigned char *line;
int brk;
{
Fill = 0; Fill = 0;
Pass3(brk, (unsigned char *)"flush", NULL, 0); Pass3(brk, (unsigned char *)"flush", NULL, 0);
} }
@ -406,11 +349,7 @@ nr_nf(line, brk)
* No space - "^[.']ns" * No space - "^[.']ns"
*/ */
static void static void nr_ns(unsigned char *line, int brk) {
nr_ns(line, brk)
unsigned char *line;
int brk;
{
Pass3(NOBREAK, (unsigned char *)"nospace", NULL, 0); Pass3(NOBREAK, (unsigned char *)"nospace", NULL, 0);
} }
@ -419,11 +358,7 @@ nr_ns(line, brk)
* Remove macro or string - "^[.']rm" * Remove macro or string - "^[.']rm"
*/ */
static void static void nr_rm(unsigned char *line, int brk) {
nr_rm(line, brk)
unsigned char *line;
int brk;
{
int i; /* temporary index */ int i; /* temporary index */
unsigned char nm[4]; /* name buffer */ unsigned char nm[4]; /* name buffer */
@ -448,11 +383,7 @@ nr_rm(line, brk)
* Rename macro or string - "^[.']rn" * Rename macro or string - "^[.']rn"
*/ */
static void static void nr_rn(unsigned char *line, int brk) {
nr_rn(line, brk)
unsigned char *line;
int brk;
{
int i, j; /* temporary indexes */ int i, j; /* temporary indexes */
unsigned char nm[4], nm1[4]; /* name buffers */ unsigned char nm[4], nm1[4]; /* name buffers */
unsigned char *s1; /* temporary string pointer */ unsigned char *s1; /* temporary string pointer */
@ -491,11 +422,7 @@ nr_rn(line, brk)
* Remove register - "^[.']rr" * Remove register - "^[.']rr"
*/ */
static void static void nr_rr(unsigned char *line, int brk) {
nr_rr(line, brk)
unsigned char *line;
int brk;
{
int i; /* temporary index */ int i; /* temporary index */
unsigned char nm[4]; /* name buffer */ unsigned char nm[4]; /* name buffer */
@ -515,11 +442,7 @@ nr_rr(line, brk)
* Resume space - "^[.']rs" * Resume space - "^[.']rs"
*/ */
static void static void nr_rs(unsigned char *line, int brk) {
nr_rs(line, brk)
unsigned char *line;
int brk;
{
Pass3(NOBREAK, (unsigned char *)"yesspace", NULL, 0); Pass3(NOBREAK, (unsigned char *)"yesspace", NULL, 0);
} }
@ -528,11 +451,7 @@ nr_rs(line, brk)
* Message - "^[.']tm" * Message - "^[.']tm"
*/ */
static void static void nr_tm(unsigned char *line, int brk) {
nr_tm(line, brk)
unsigned char *line;
int brk;
{
Pass3(MESSAGE, Inname, (line[3] == ' ') ? &line[4] : &line[3], NR); Pass3(MESSAGE, Inname, (line[3] == ' ') ? &line[4] : &line[3], NR);
} }
@ -541,11 +460,7 @@ nr_tm(line, brk)
* Translate - "^[.']tr abcd..." * Translate - "^[.']tr abcd..."
*/ */
static void static void nr_tr(unsigned char *line, int brk) {
nr_tr(line, brk)
unsigned char *line;
int brk;
{
unsigned char buf[MAXLINE]; /* temporary buffer */ unsigned char buf[MAXLINE]; /* temporary buffer */
int i, j; /* temporary indexes */ int i, j; /* temporary indexes */
unsigned char nm[4], nm1[4]; /* name buffers */ unsigned char nm[4], nm1[4]; /* name buffers */
@ -720,11 +635,7 @@ assemble_output:
* NH = initialize number headers * NH = initialize number headers
*/ */
static void static void nr_Ub(unsigned char *line, int brk) {
nr_Ub(line, brk)
unsigned char *line;
int brk;
{
int i; /* temporary index */ int i; /* temporary index */
unsigned char *s1, *s2; /* temporary string pointers */ unsigned char *s1, *s2; /* temporary string pointers */
@ -750,11 +661,7 @@ nr_Ub(line, brk)
* Character definitions - "^[.']\^c" * Character definitions - "^[.']\^c"
*/ */
static void static void nr_Uc(unsigned char *line, int brk) {
nr_Uc(line, brk)
unsigned char *line;
int brk;
{
unsigned char buf[MAXLINE]; /* temporary buffer */ unsigned char buf[MAXLINE]; /* temporary buffer */
int i; /* temporary index */ int i; /* temporary index */
unsigned char *s1, *s2, *s3, /* temporary string pointers */ unsigned char *s1, *s2, *s3, /* temporary string pointers */
@ -796,11 +703,7 @@ nr_Uc(line, brk)
* Font is OK - "[.']\^f <font_name_character>" * Font is OK - "[.']\^f <font_name_character>"
*/ */
static void static void nr_Uf(unsigned char *line, int brk) {
nr_Uf(line, brk)
unsigned char *line;
int brk;
{
int i; /* temporary index */ int i; /* temporary index */
if (line[3] != '\0' && line[4] != '\0') { if (line[3] != '\0' && line[4] != '\0') {
@ -819,11 +722,7 @@ nr_Uf(line, brk)
* Resolutions - "[.']\^r cpi horizontal vertical" * Resolutions - "[.']\^r cpi horizontal vertical"
*/ */
static void static void nr_Ur(unsigned char *line, int brk) {
nr_Ur(line, brk)
unsigned char *line;
int brk;
{
unsigned char buf[MAXLINE]; /* temporary buffer */ unsigned char buf[MAXLINE]; /* temporary buffer */
int i, j; /* temporary indexes */ int i, j; /* temporary indexes */
double tval; /* temporary value */ double tval; /* temporary value */
@ -859,11 +758,7 @@ nr_Ur(line, brk)
* Lock line number and file name - "^[.']\^= <number> <file>" * Lock line number and file name - "^[.']\^= <number> <file>"
*/ */
static void static void nr_UL(unsigned char *line, int brk) {
nr_UL(line, brk)
unsigned char *line;
int brk;
{
unsigned char *s1; /* temporary string pointer */ unsigned char *s1; /* temporary string pointer */
if ((s1 = Field(2, line, 0)) != NULL) if ((s1 = Field(2, line, 0)) != NULL)

View file

@ -36,12 +36,12 @@
* interpolation * interpolation
*/ */
LenprtHF(s, p, t) int LenprtHF(unsigned char *s, int p, int t) {
unsigned char *s; /* header/footer string */ /* header/footer string s
int p; /* page number */ * page number p
int t; /* type: 0 = get interpolated length * type t: 0 = get interpolated length
* 1 = print */ * 1 = print
{ */
unsigned char buf[10]; /* buffer for page number */ unsigned char buf[10]; /* buffer for page number */
int len; /* line length */ int len; /* line length */
unsigned char *s1; /* temporary string pointer */ unsigned char *s1; /* temporary string pointer */
@ -74,10 +74,8 @@ LenprtHF(s, p, t)
* Charput(s) - put a character to output, subject to diversion * Charput(s) - put a character to output, subject to diversion
*/ */
void void Charput(int c) {
Charput(c) /* character to put c */
int c; /* character to put */
{
if (Divert == 0) if (Divert == 0)
putchar((unsigned char)c); putchar((unsigned char)c);
} }
@ -87,10 +85,8 @@ Charput(c)
* Stringput(s) - put a string to output, subject to diversion * Stringput(s) - put a string to output, subject to diversion
*/ */
void void Stringput(unsigned char *s) {
Stringput(s) /* string to put s */
unsigned char *s; /* string to put */
{
if (Divert == 0) if (Divert == 0)
fputs((char *)s, stdout); fputs((char *)s, stdout);
} }

View file

@ -36,10 +36,7 @@
* text into words for pass 3 * text into words for pass 3
*/ */
void void Pass2(unsigned char *line) {
Pass2(line)
unsigned char *line;
{
int brk; /* request break status */ int brk; /* request break status */
unsigned char buf[MAXLINE]; /* working buffer */ unsigned char buf[MAXLINE]; /* working buffer */
unsigned char c; /* character buffer */ unsigned char c; /* character buffer */

View file

@ -2,10 +2,7 @@
#include "regexp.h" #include "regexp.h"
#include "proto.h" #include "proto.h"
void void regerror(char *s) {
regerror(s)
char *s;
{
#ifndef DOSPORT #ifndef DOSPORT
#ifdef ERRAVAIL #ifdef ERRAVAIL
error("regexp: %s", s); error("regexp: %s", s);

View file

@ -198,10 +198,7 @@ STATIC int strcspn(unsigned char *s1, unsigned char *s2 );
* Beware that the optimization-preparation code in here knows about some * Beware that the optimization-preparation code in here knows about some
* of the structure of the compiled regexp. * of the structure of the compiled regexp.
*/ */
regexp * regexp *regcomp(char *exp) {
regcomp(exp)
char *exp;
{
register regexp *r; register regexp *r;
register unsigned char *scan; register unsigned char *scan;
register unsigned char *longest; register unsigned char *longest;
@ -286,11 +283,8 @@ char *exp;
* is a trifle forced, but the need to tie the tails of the branches to what * is a trifle forced, but the need to tie the tails of the branches to what
* follows makes it hard to avoid. * follows makes it hard to avoid.
*/ */
STATIC unsigned char * STATIC unsigned char *reg(int paren, int *flagp) {
reg(paren, flagp) /* Parenthesized? paren */
int paren; /* Parenthesized? */
int *flagp;
{
register unsigned char *ret; register unsigned char *ret;
register unsigned char *br; register unsigned char *br;
register unsigned char *ender; register unsigned char *ender;
@ -358,10 +352,7 @@ int *flagp;
* *
* Implements the concatenation operator. * Implements the concatenation operator.
*/ */
STATIC unsigned char * STATIC unsigned char *regbranch(int *flagp) {
regbranch(flagp)
int *flagp;
{
register unsigned char *ret; register unsigned char *ret;
register unsigned char *chain; register unsigned char *chain;
register unsigned char *latest; register unsigned char *latest;
@ -397,10 +388,7 @@ int *flagp;
* It might seem that this node could be dispensed with entirely, but the * It might seem that this node could be dispensed with entirely, but the
* endmarker role is not redundant. * endmarker role is not redundant.
*/ */
STATIC unsigned char * STATIC unsigned char *regpiece(int *flagp) {
regpiece(flagp)
int *flagp;
{
register unsigned char *ret; register unsigned char *ret;
register unsigned char op; register unsigned char op;
register unsigned char *next; register unsigned char *next;
@ -461,10 +449,7 @@ int *flagp;
* faster to run. Backslashed characters are exceptions, each becoming a * faster to run. Backslashed characters are exceptions, each becoming a
* separate node; the code is simpler that way and it's not worth fixing. * separate node; the code is simpler that way and it's not worth fixing.
*/ */
STATIC unsigned char * STATIC unsigned char *regatom(int *flagp) {
regatom(flagp)
int *flagp;
{
register unsigned char *ret; register unsigned char *ret;
int flags; int flags;
@ -574,10 +559,8 @@ int *flagp;
/* /*
- regnode - emit a node - regnode - emit a node
*/ */
STATIC unsigned char * /* Location. */ STATIC unsigned char *regnode(int iop) {
regnode(iop) /* Return value is location */
int iop;
{
register unsigned char *ret; register unsigned char *ret;
register unsigned char *ptr; register unsigned char *ptr;
unsigned char op; unsigned char op;
@ -601,10 +584,7 @@ int iop;
/* /*
- regc - emit (if appropriate) a byte of code - regc - emit (if appropriate) a byte of code
*/ */
STATIC void STATIC void regc(int ib) {
regc(ib)
int ib;
{
unsigned char b; unsigned char b;
b = (unsigned char) ib; b = (unsigned char) ib;
@ -619,11 +599,7 @@ int ib;
* *
* Means relocating the operand. * Means relocating the operand.
*/ */
STATIC void STATIC void reginsert(int iop, unsigned char *opnd) {
reginsert(iop, opnd)
int iop;
unsigned char *opnd;
{
register unsigned char *src; register unsigned char *src;
register unsigned char *dst; register unsigned char *dst;
register unsigned char *place; register unsigned char *place;
@ -650,11 +626,7 @@ unsigned char *opnd;
/* /*
- regtail - set the next-pointer at the end of a node chain - regtail - set the next-pointer at the end of a node chain
*/ */
STATIC void STATIC void regtail(unsigned char *p, unsigned char *val) {
regtail(p, val)
unsigned char *p;
unsigned char *val;
{
register unsigned char *scan; register unsigned char *scan;
register unsigned char *temp; register unsigned char *temp;
register int offset; register int offset;
@ -682,11 +654,7 @@ unsigned char *val;
/* /*
- regoptail - regtail on operand of first argument; nop if operandless - regoptail - regtail on operand of first argument; nop if operandless
*/ */
STATIC void STATIC void regoptail(unsigned char *p, unsigned char *val) {
regoptail(p, val)
unsigned char *p;
unsigned char *val;
{
/* "Operandless" and "op != BRANCH" are synonymous in practice. */ /* "Operandless" and "op != BRANCH" are synonymous in practice. */
if (p == NULL || p == &regdummy || OP(p) != BRANCH) if (p == NULL || p == &regdummy || OP(p) != BRANCH)
return; return;
@ -707,18 +675,15 @@ STATIC unsigned char **regendp; /* Ditto for endp. */
#ifdef DEBUG #ifdef DEBUG
int regnarrate = 0; int regnarrate = 0;
void regdump(); void regdump(void);
STATIC unsigned char *regprop(); STATIC unsigned char *regprop(void);
#endif #endif
/* /*
- regexec - match a regexp against a string - regexec - match a regexp against a string
*/ */
int int
regexec(prog, string) regexec(register regexp *prog, register unsigned char *string) {
register regexp *prog;
register unsigned char *string;
{
register unsigned char *s; register unsigned char *s;
#ifndef STDLIB #ifndef STDLIB
extern char *strchr(); extern char *strchr();
@ -782,11 +747,8 @@ register unsigned char *string;
/* /*
- regtry - try match at specific point - regtry - try match at specific point
*/ */
STATIC int /* 0 failure, 1 success */ STATIC int regtry(regexp *prog, unsigned char *string) {
regtry(prog, string) /* Return value 0 failure, 1 success */
regexp *prog;
unsigned char *string;
{
register int i; register int i;
register unsigned char **sp; register unsigned char **sp;
register unsigned char **ep; register unsigned char **ep;
@ -819,10 +781,8 @@ unsigned char *string;
* need to know whether the rest of the match failed) by a loop instead of * need to know whether the rest of the match failed) by a loop instead of
* by recursion. * by recursion.
*/ */
STATIC int /* 0 failure, 1 success */ STATIC int regmatch( unsigned char *prog) {
regmatch(prog) /* Return value 0 failure 1 success */
unsigned char *prog;
{
register unsigned char *scan; /* Current node. */ register unsigned char *scan; /* Current node. */
unsigned char *next; /* Next node. */ unsigned char *next; /* Next node. */
#ifndef STDLIB #ifndef STDLIB
@ -1013,10 +973,7 @@ unsigned char *prog;
/* /*
- regrepeat - repeatedly match something simple, report how many - regrepeat - repeatedly match something simple, report how many
*/ */
STATIC int STATIC int regrepeat(unsigned char *p) {
regrepeat(p)
unsigned char *p;
{
register int count = 0; register int count = 0;
register unsigned char *scan; register unsigned char *scan;
register unsigned char *opnd; register unsigned char *opnd;
@ -1059,10 +1016,7 @@ unsigned char *p;
/* /*
- regnext - dig the "next" pointer out of a node - regnext - dig the "next" pointer out of a node
*/ */
STATIC unsigned char * STATIC unsigned char *regnext(register unsigned char *p) {
regnext(p)
register unsigned char *p;
{
register int offset; register int offset;
if (p == &regdummy) if (p == &regdummy)
@ -1080,15 +1034,12 @@ register unsigned char *p;
#ifdef DEBUG #ifdef DEBUG
STATIC unsigned char *regprop(); STATIC unsigned char *regprop(void);
/* /*
- regdump - dump a regexp onto stdout in vaguely comprehensible form - regdump - dump a regexp onto stdout in vaguely comprehensible form
*/ */
void void regdump(regexp r) {
regdump(r)
regexp *r;
{
register unsigned char *s; register unsigned char *s;
register unsigned char op = EXACTLY; /* Arbitrary non-END op. */ register unsigned char op = EXACTLY; /* Arbitrary non-END op. */
register unsigned char *next; register unsigned char *next;
@ -1130,10 +1081,8 @@ regexp *r;
- regprop - printable representation of opcode - regprop - printable representation of opcode
*/ */
STATIC unsigned char regprop_buf[50]; STATIC unsigned char regprop_buf[50];
STATIC unsigned char *
regprop(op) STATIC unsigned char *regprop(unsigned char *op) {
unsigned char *op;
{
register unsigned char *p; register unsigned char *p;
(void) strcpy(regprop_buf, ":"); (void) strcpy(regprop_buf, ":");
@ -1221,11 +1170,7 @@ unsigned char *op;
* of characters not from s2 * of characters not from s2
*/ */
STATIC int STATIC int strcspn(unsigned char *s1, unsigned char *s2) {
strcspn(s1, s2)
unsigned char *s1;
unsigned char *s2;
{
register unsigned char *scan1; register unsigned char *scan1;
register unsigned char *scan2; register unsigned char *scan2;
register int count; register int count;

View file

@ -31,18 +31,17 @@
#include "cawf.h" #include "cawf.h"
#include <ctype.h> #include <ctype.h>
static void Setroman(); static void Setroman(void);
/* /*
* Asmname(s, c) - assemble name * Asmname(s, c) - assemble name
*/ */
Asmname(s, c) int Asmname(unsigned char *s, unsigned char *c) {
unsigned char *s; /* pointer to name */ /* pointer to name s
unsigned char *c; /* code destination (c[3]) */ * code destination (c[3])
{ */
c[1] = c[2] = '\0'; c[1] = c[2] = '\0';
while (*s && *s == ' ') while (*s && *s == ' ')
s++; s++;
@ -56,10 +55,8 @@ Asmname(s, c)
* Delstr(sx) - delete string * Delstr(sx) - delete string
*/ */
void void Delstr(int sx) {
Delstr(sx) /* string index sx */
int sx; /* string index */
{
char buf[MAXLINE]; /* message buffer */ char buf[MAXLINE]; /* message buffer */
if (sx >= Nstr) { if (sx >= Nstr) {
@ -79,9 +76,7 @@ Delstr(sx)
* Endword() - end a word * Endword() - end a word
*/ */
void void Endword(void) {
Endword()
{
if (Fontstat != 'R') if (Fontstat != 'R')
Setroman(); Setroman();
Word[Wordx] = '\0'; Word[Wordx] = '\0';
@ -93,13 +88,13 @@ Endword()
* optionally enter it * optionally enter it
*/ */
Findchar(nm, l, s, e) int Findchar(unsigned char *nm, int l, unsigned char *s, int e) {
unsigned char *nm; /* character name */ /* character name nm
int l; /* effective length */ * effective length l
unsigned char *s; /* value string */ * value string s
int e; /* 0 = find, don't enter * e = 0 = find, don't enter
* 1 = don't find, enter */ * e = 1 = don't find, enter
{ */
int cmp, hi, low, mid; int cmp, hi, low, mid;
unsigned char c[3]; unsigned char c[3];
@ -147,12 +142,12 @@ new_char:
* Findhy(s, l, e) - find and optionally enter hyphen * Findhy(s, l, e) - find and optionally enter hyphen
*/ */
Findhy(s, l, e) int Findhy(unsigned char *s, int l, int e) {
unsigned char *s; /* value string */ /* value string s
int l; /* equivalent length */ * equivalent length l
int e; /* 0 = find, don't enter * e = 0 = find, don't enter
* 1 = enter, don't find */ * e = 1 = enter, don't find
{ */
int i; int i;
for (i = 0; i < Nhy; i++) { for (i = 0; i < Nhy; i++) {
@ -183,13 +178,12 @@ Findhy(s, l, e)
* Findstr(nm, s, e) - find and optionally enter string in Str[] * Findstr(nm, s, e) - find and optionally enter string in Str[]
*/ */
unsigned char * unsigned char *Findstr(unsigned char *nm, unsigned char *s, int e) {
Findstr(nm, s, e) /* 2 character string name nm
unsigned char *nm; /* 2 character string name */ * string value s
unsigned char *s; /* string value */ * e = 0 = find, don't enter
int e; /* 0 = find, don't enter * e = 1 = enter, don't find
* 1 = enter, don't find */ */
{
unsigned char c[3]; /* character buffer */ unsigned char c[3]; /* character buffer */
int cmp, hi, low, mid; /* binary search controls */ int cmp, hi, low, mid; /* binary search controls */
int i; /* temporary indexes */ int i; /* temporary indexes */
@ -249,9 +243,7 @@ new_string:
* Setroman() - set Roman font * Setroman() - set Roman font
*/ */
static void static void Setroman(void) {
Setroman()
{
int i; int i;
if ((Wordx + Fstr.rl) >= MAXLINE) if ((Wordx + Fstr.rl) >= MAXLINE)
@ -271,10 +263,7 @@ Setroman()
* Str2word(s, len) - copy len characters from string to Word[] * Str2word(s, len) - copy len characters from string to Word[]
*/ */
Str2word(s, len) int Str2word(unsigned char *s, int len) {
unsigned char *s;
int len;
{
int i; int i;
for (; len > 0; len--, s++) { for (; len > 0; len--, s++) {