cawf: Update K&R function declarations
Change-Id: Ib18171089c7b389f7f2643d7298f9659e882f65c
This commit is contained in:
parent
c6748a4a93
commit
d9494baa34
14 changed files with 162 additions and 378 deletions
|
@ -54,10 +54,7 @@ int Ulx = 0; /* underline buffer index */
|
|||
|
||||
void Putchar(int ch);
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int main(int argc, char *argv[]) {
|
||||
int ax = 1; /* argument index */
|
||||
unsigned char c; /* character buffer */
|
||||
FILE *fs; /* file stream */
|
||||
|
@ -165,10 +162,7 @@ main(argc, argv)
|
|||
* Putchar(ch) - put a character with possible underlining
|
||||
*/
|
||||
|
||||
void
|
||||
Putchar(ch)
|
||||
int ch;
|
||||
{
|
||||
void Putchar(int ch) {
|
||||
int i; /* temporary index */
|
||||
|
||||
if ((unsigned char)ch == '\n') {
|
||||
|
|
|
@ -45,10 +45,7 @@ static char Version[] = "4.0";
|
|||
#endif
|
||||
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int main(int argc, char *argv[]) {
|
||||
char *ep; /* environment pointer */
|
||||
int fff = 0; /* final form feed status */
|
||||
char **files; /* file names */
|
||||
|
@ -361,10 +358,7 @@ main(argc, argv)
|
|||
* pass non-macros and macros alike to pass 2
|
||||
*/
|
||||
|
||||
void
|
||||
Macro(inp)
|
||||
unsigned char *inp; /* possible macro statement pointer */
|
||||
{
|
||||
void Macro(unsigned char *inp) { /* possible macro statement pointer */
|
||||
unsigned char c[2]; /* characters */
|
||||
int endm; /* end of macro status */
|
||||
FILE *fs; /* temporary file stream */
|
||||
|
|
|
@ -44,11 +44,10 @@ static int Convfont(char *nm, char *s, char **fn, unsigned char **fi);
|
|||
* Convstr(s, len) - convert a string
|
||||
*/
|
||||
|
||||
static unsigned char *
|
||||
Convstr(s, len)
|
||||
char *s; /* input string */
|
||||
int *len; /* length of result */
|
||||
{
|
||||
static unsigned char *Convstr(char *s, int *len) {
|
||||
/* input string s
|
||||
* length of result len
|
||||
*/
|
||||
int c; /* character assembly */
|
||||
unsigned char *cp; /* temporary character pointer */
|
||||
char *em; /* error message */
|
||||
|
@ -157,13 +156,12 @@ non_hex_char:
|
|||
* Convfont(nm, s, fn, fi) - convert a font for a device
|
||||
*/
|
||||
|
||||
static int
|
||||
Convfont(nm, s, fn, fi)
|
||||
char *nm; /* output device name */
|
||||
char *s; /* font definition string */
|
||||
char **fn; /* font name address */
|
||||
unsigned char **fi; /* initialization string address */
|
||||
{
|
||||
static int Convfont(char* nm, char *s, char **fn, unsigned char **fi) {
|
||||
/* output device name nm
|
||||
* font definition string s
|
||||
* font name address fn
|
||||
* initialization string address fi
|
||||
*/
|
||||
char *cp; /* temporary character pointer */
|
||||
int len; /* length */
|
||||
/*
|
||||
|
@ -195,9 +193,7 @@ Convfont(nm, s, fn, fi)
|
|||
* Defdev() - define the output device
|
||||
*/
|
||||
|
||||
int
|
||||
Defdev()
|
||||
{
|
||||
int Defdev(void) {
|
||||
unsigned char *fi = NULL; /* last font initialization string */
|
||||
char *fn = NULL; /* font name */
|
||||
int fd = 0; /* found-device flag */
|
||||
|
|
|
@ -35,12 +35,11 @@
|
|||
* Error(t, l, s1, s2) - issue error message
|
||||
*/
|
||||
|
||||
void
|
||||
Error(t, l, s1, s2)
|
||||
int t; /* type: WARN or FATAL */
|
||||
int l; /* LINE: display Line[] */
|
||||
char *s1, *s2; /* optional text */
|
||||
{
|
||||
void Error(int t, int l, char *s1, char *s2) {
|
||||
/* type: WARN or FATAL t
|
||||
* LINE: display Line[] l
|
||||
* optional text s1 and s2
|
||||
*/
|
||||
char msg[MAXLINE]; /* message */
|
||||
|
||||
if (t == WARN && !Dowarn) return;
|
||||
|
@ -69,14 +68,13 @@ Error(t, l, s1, s2)
|
|||
* Error3(len, word, sarg, narg) - process error in pass3
|
||||
*/
|
||||
|
||||
void
|
||||
Error3(len, word, sarg, narg, msg)
|
||||
int len; /* length (negative is special */
|
||||
char *word; /* word */
|
||||
char *sarg; /* string argument */
|
||||
int narg; /* numeric argument */
|
||||
char *msg; /* message */
|
||||
{
|
||||
void Error3(int len, char* word, char *sarg, int narg, char *msg) {
|
||||
/* length (negative is special) len
|
||||
* word word
|
||||
* string argument sarg
|
||||
* numeric argument narg
|
||||
* message msg
|
||||
*/
|
||||
if (len == MESSAGE) {
|
||||
(void) fprintf(Efs, "%s: (%s, %d) %s\n",
|
||||
Pname,
|
||||
|
|
|
@ -34,10 +34,8 @@
|
|||
* Expand(line) - expand macro or if/ie/el line
|
||||
*/
|
||||
|
||||
void
|
||||
Expand(line)
|
||||
unsigned char *line;
|
||||
{
|
||||
void Expand(unsigned char *line) {
|
||||
|
||||
unsigned char buf[2*MAXLINE]; /* line buffer */
|
||||
unsigned char cmd[4]; /* nroff command */
|
||||
int cmdl; /* command length */
|
||||
|
|
|
@ -36,11 +36,10 @@
|
|||
* definition - e. .g, "\\nPO"
|
||||
*/
|
||||
|
||||
unsigned char *
|
||||
Asmcode(s, c)
|
||||
unsigned char **s; /* pointer to character after '\\' */
|
||||
unsigned char *c; /* code destination (c[3]) */
|
||||
{
|
||||
unsigned char *Asmcode(unsigned char **s, unsigned char *c) {
|
||||
/* pointer to character after '\\' s
|
||||
* code destination (c[3]) c
|
||||
*/
|
||||
unsigned char *s1;
|
||||
|
||||
s1 = *s + 1;
|
||||
|
@ -60,10 +59,9 @@ Asmcode(s, c)
|
|||
* Delnum(nx) - delete number
|
||||
*/
|
||||
|
||||
void
|
||||
Delnum(nx)
|
||||
int nx; /* number index */
|
||||
{
|
||||
void Delnum(int nx) {
|
||||
/* number index nx */
|
||||
|
||||
unsigned char buf[MAXLINE]; /* message buffer */
|
||||
|
||||
if (nx >= Nnr) {
|
||||
|
@ -82,12 +80,12 @@ Delnum(nx)
|
|||
* Findnum(n, v, e) - find or optionally enter number value
|
||||
*/
|
||||
|
||||
Findnum(n, v, e)
|
||||
unsigned char *n; /* register name */
|
||||
int v; /* value */
|
||||
int e; /* 0 = find, don't enter
|
||||
* 1 = enter, don't find */
|
||||
{
|
||||
int Findnum(unsigned char *n, int v, int e) {
|
||||
/* register name n
|
||||
* value v
|
||||
* e = 0 = find, don't enter
|
||||
* e = 1 = enter, don't find
|
||||
*/
|
||||
int cmp, low, hi, mid; /* binary search controls */
|
||||
unsigned char c[3]; /* name buffer */
|
||||
|
||||
|
@ -130,9 +128,8 @@ Findnum(n, v, e)
|
|||
* Findparms(n) - find parameter registers
|
||||
*/
|
||||
|
||||
Findparms(n)
|
||||
unsigned char *n; /* parameter name */
|
||||
{
|
||||
int Findparms(unsigned char *n) {
|
||||
/* parameter name n */
|
||||
unsigned char c[3]; /* character buffer */
|
||||
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)
|
||||
int n; /* scaling factor name */
|
||||
double v; /* value */
|
||||
int e; /* 0 = find, don't enter
|
||||
* 1 = enter, don't find */
|
||||
{
|
||||
int Findscale(int n, double v, int e) {
|
||||
/* scaling factor name n
|
||||
* value v
|
||||
* e = 0 = find, don't enter
|
||||
* e = 1 = enter, don't find
|
||||
*/
|
||||
int i;
|
||||
double *pval;
|
||||
|
||||
|
|
|
@ -30,11 +30,7 @@ int optind = 1;
|
|||
int optopt;
|
||||
char *optarg;
|
||||
|
||||
int
|
||||
getopt(argc, argv, opts)
|
||||
int argc;
|
||||
char **argv, *opts;
|
||||
{
|
||||
int getopt(int argc, char **argv, char **opts) {
|
||||
static int sp = 1;
|
||||
register int c;
|
||||
register char *cp;
|
||||
|
|
|
@ -35,9 +35,8 @@
|
|||
* Delmacro(mx) - delete macro
|
||||
*/
|
||||
|
||||
Delmacro(mx)
|
||||
int mx; /* macro index */
|
||||
{
|
||||
int Delmacro(int mx) {
|
||||
/* macro index mx */
|
||||
unsigned char buf[MAXLINE]; /* error message buffer */
|
||||
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
|
||||
*/
|
||||
|
||||
unsigned char *
|
||||
Field(n, p, c)
|
||||
int n; /* field number */
|
||||
unsigned char *p; /* pointer to line containing fields */
|
||||
int c; /* 1: make a copy of the field */
|
||||
{
|
||||
unsigned char *Field(int n, unsigned char *p, int c) {
|
||||
/* field number n
|
||||
* pointer to line containing fields p
|
||||
* c = 1: make a copy of the field
|
||||
*/
|
||||
unsigned char *fs, *fe, *s;
|
||||
|
||||
if (c)
|
||||
|
@ -101,11 +99,11 @@ Field(n, p, c)
|
|||
*/
|
||||
|
||||
|
||||
Findmacro(p, e)
|
||||
unsigned char *p; /* pointer to 2 character macro name */
|
||||
int e; /* 0 = find, don't enter
|
||||
* 1 = enter, don't find */
|
||||
{
|
||||
int Findmacro(unsigned char *p, int e) {
|
||||
/* pointer to 2 character macro name p
|
||||
* e = 0 = find, don't enter
|
||||
* e = 1 = enter, don't find
|
||||
*/
|
||||
unsigned char c[3];
|
||||
int cmp, hi, low, mid;
|
||||
|
||||
|
@ -153,10 +151,7 @@ new_macro:
|
|||
return(mid);
|
||||
}
|
||||
|
||||
void
|
||||
Free(p)
|
||||
unsigned char **p;
|
||||
{
|
||||
void Free(unsigned char **p) {
|
||||
if (*p != NULL) {
|
||||
(void) free(*p);
|
||||
*p = NULL;
|
||||
|
@ -167,10 +162,7 @@ Free(p)
|
|||
* Newstr(s) - allocate space for string
|
||||
*/
|
||||
|
||||
unsigned char *
|
||||
Newstr(s)
|
||||
unsigned char *s;
|
||||
{
|
||||
unsigned char *Newstr(unsigned char *s) {
|
||||
unsigned char *ns;
|
||||
|
||||
if ((ns = (unsigned char *)malloc((size_t)(strlen((char *)s) + 1)))
|
||||
|
|
|
@ -116,11 +116,7 @@ static struct nr_req {
|
|||
* buffer with request status of (brk)
|
||||
*/
|
||||
|
||||
void
|
||||
Nreq(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
void Nreq(unsigned char *line, int brk) {
|
||||
unsigned char c[3]; /* command buffer */
|
||||
int cmp, hi, low, mid; /* binary search indixes */
|
||||
|
||||
|
@ -152,11 +148,7 @@ Nreq(line, brk)
|
|||
* Adjust - "^[.']ad"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_ad(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_ad(unsigned char *line, int brk) {
|
||||
Pass3(NOBREAK, (unsigned char *)"both", NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -165,11 +157,7 @@ nr_ad(line, brk)
|
|||
* Begin new page - "^[.']bp"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_bp(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_bp(unsigned char *line, int brk) {
|
||||
Pass3(brk, (unsigned char *)"need", NULL, 999);
|
||||
}
|
||||
|
||||
|
@ -178,11 +166,7 @@ nr_bp(line, brk)
|
|||
* Break - "^[.']br"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_br(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_br(unsigned char *line, int brk) {
|
||||
Pass3(brk, (unsigned char *)"flush", NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -191,11 +175,7 @@ nr_br(line, brk)
|
|||
* Center - "^[.']ce"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_ce(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_ce(unsigned char *line, int brk) {
|
||||
unsigned char *s; /* string poiner */
|
||||
|
||||
if ((s = Field(2, line, 0)) != NULL)
|
||||
|
@ -209,11 +189,7 @@ nr_ce(line, brk)
|
|||
* Diversion on and off - "^[.']di"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_di(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_di(unsigned char *line, int brk) {
|
||||
Pass3(DOBREAK, (unsigned char *)"flush", NULL, 0);
|
||||
Divert ^= 1;
|
||||
}
|
||||
|
@ -223,11 +199,7 @@ nr_di(line, brk)
|
|||
* Define string - "^[.']ds"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_ds(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_ds(unsigned char *line, int brk) {
|
||||
unsigned char buf[MAXLINE]; /* temporary buffer */
|
||||
unsigned char nm[4], nm1[4]; /* name buffers */
|
||||
unsigned char *s1, *s2, *s3, /* temporary string pointers */
|
||||
|
@ -263,11 +235,7 @@ nr_ds(line, brk)
|
|||
* Fill - "^[.']fi"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_fi(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_fi(unsigned char *line, int brk) {
|
||||
Fill = 1;
|
||||
Pass3(brk, (unsigned char *)"flush", NULL, 0);
|
||||
}
|
||||
|
@ -277,11 +245,7 @@ nr_fi(line, brk)
|
|||
* Flush - "^[.']fl"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_fl(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_fl(unsigned char *line, int brk) {
|
||||
Pass3(brk, (unsigned char *)"flush", NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -290,11 +254,7 @@ nr_fl(line, brk)
|
|||
* Font - "^[.']ft <font_name>"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_ft(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_ft(unsigned char *line, int brk) {
|
||||
int i; /* temporary index */
|
||||
|
||||
if (line[3] == '\0' || line[4] == '\0')
|
||||
|
@ -320,12 +280,7 @@ nr_ft(line, brk)
|
|||
* Input trap - "^[.']it [1 <request>]"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_it(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
|
||||
{
|
||||
static void nr_it(unsigned char *line, int brk) {
|
||||
unsigned char buf[MAXLINE]; /* temporary buffer */
|
||||
int i; /* temporary index */
|
||||
unsigned char *s1, *s2; /* temporary string pointers */
|
||||
|
@ -367,11 +322,7 @@ nr_it(line, brk)
|
|||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_nil(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_nil(unsigned char *line, int brk) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -379,11 +330,7 @@ nr_nil(line, brk)
|
|||
* No adjust "^[.']na"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_na(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_na(unsigned char *line, int brk) {
|
||||
Pass3(NOBREAK, (unsigned char *)"left", NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -392,11 +339,7 @@ nr_na(line, brk)
|
|||
* No fill - "^[.']nf"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_nf(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_nf(unsigned char *line, int brk) {
|
||||
Fill = 0;
|
||||
Pass3(brk, (unsigned char *)"flush", NULL, 0);
|
||||
}
|
||||
|
@ -406,11 +349,7 @@ nr_nf(line, brk)
|
|||
* No space - "^[.']ns"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_ns(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_ns(unsigned char *line, int brk) {
|
||||
Pass3(NOBREAK, (unsigned char *)"nospace", NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -419,11 +358,7 @@ nr_ns(line, brk)
|
|||
* Remove macro or string - "^[.']rm"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_rm(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_rm(unsigned char *line, int brk) {
|
||||
int i; /* temporary index */
|
||||
unsigned char nm[4]; /* name buffer */
|
||||
|
||||
|
@ -448,11 +383,7 @@ nr_rm(line, brk)
|
|||
* Rename macro or string - "^[.']rn"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_rn(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_rn(unsigned char *line, int brk) {
|
||||
int i, j; /* temporary indexes */
|
||||
unsigned char nm[4], nm1[4]; /* name buffers */
|
||||
unsigned char *s1; /* temporary string pointer */
|
||||
|
@ -491,11 +422,7 @@ nr_rn(line, brk)
|
|||
* Remove register - "^[.']rr"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_rr(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_rr(unsigned char *line, int brk) {
|
||||
int i; /* temporary index */
|
||||
unsigned char nm[4]; /* name buffer */
|
||||
|
||||
|
@ -515,11 +442,7 @@ nr_rr(line, brk)
|
|||
* Resume space - "^[.']rs"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_rs(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_rs(unsigned char *line, int brk) {
|
||||
Pass3(NOBREAK, (unsigned char *)"yesspace", NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -528,11 +451,7 @@ nr_rs(line, brk)
|
|||
* Message - "^[.']tm"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_tm(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_tm(unsigned char *line, int brk) {
|
||||
Pass3(MESSAGE, Inname, (line[3] == ' ') ? &line[4] : &line[3], NR);
|
||||
}
|
||||
|
||||
|
@ -541,11 +460,7 @@ nr_tm(line, brk)
|
|||
* Translate - "^[.']tr abcd..."
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_tr(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_tr(unsigned char *line, int brk) {
|
||||
unsigned char buf[MAXLINE]; /* temporary buffer */
|
||||
int i, j; /* temporary indexes */
|
||||
unsigned char nm[4], nm1[4]; /* name buffers */
|
||||
|
@ -720,11 +635,7 @@ assemble_output:
|
|||
* NH = initialize number headers
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_Ub(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_Ub(unsigned char *line, int brk) {
|
||||
int i; /* temporary index */
|
||||
unsigned char *s1, *s2; /* temporary string pointers */
|
||||
|
||||
|
@ -750,11 +661,7 @@ nr_Ub(line, brk)
|
|||
* Character definitions - "^[.']\^c"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_Uc(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_Uc(unsigned char *line, int brk) {
|
||||
unsigned char buf[MAXLINE]; /* temporary buffer */
|
||||
int i; /* temporary index */
|
||||
unsigned char *s1, *s2, *s3, /* temporary string pointers */
|
||||
|
@ -796,11 +703,7 @@ nr_Uc(line, brk)
|
|||
* Font is OK - "[.']\^f <font_name_character>"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_Uf(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_Uf(unsigned char *line, int brk) {
|
||||
int i; /* temporary index */
|
||||
|
||||
if (line[3] != '\0' && line[4] != '\0') {
|
||||
|
@ -819,11 +722,7 @@ nr_Uf(line, brk)
|
|||
* Resolutions - "[.']\^r cpi horizontal vertical"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_Ur(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_Ur(unsigned char *line, int brk) {
|
||||
unsigned char buf[MAXLINE]; /* temporary buffer */
|
||||
int i, j; /* temporary indexes */
|
||||
double tval; /* temporary value */
|
||||
|
@ -859,11 +758,7 @@ nr_Ur(line, brk)
|
|||
* Lock line number and file name - "^[.']\^= <number> <file>"
|
||||
*/
|
||||
|
||||
static void
|
||||
nr_UL(line, brk)
|
||||
unsigned char *line;
|
||||
int brk;
|
||||
{
|
||||
static void nr_UL(unsigned char *line, int brk) {
|
||||
unsigned char *s1; /* temporary string pointer */
|
||||
|
||||
if ((s1 = Field(2, line, 0)) != NULL)
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
* interpolation
|
||||
*/
|
||||
|
||||
LenprtHF(s, p, t)
|
||||
unsigned char *s; /* header/footer string */
|
||||
int p; /* page number */
|
||||
int t; /* type: 0 = get interpolated length
|
||||
* 1 = print */
|
||||
{
|
||||
int LenprtHF(unsigned char *s, int p, int t) {
|
||||
/* header/footer string s
|
||||
* page number p
|
||||
* type t: 0 = get interpolated length
|
||||
* 1 = print
|
||||
*/
|
||||
unsigned char buf[10]; /* buffer for page number */
|
||||
int len; /* line length */
|
||||
unsigned char *s1; /* temporary string pointer */
|
||||
|
@ -74,10 +74,8 @@ LenprtHF(s, p, t)
|
|||
* Charput(s) - put a character to output, subject to diversion
|
||||
*/
|
||||
|
||||
void
|
||||
Charput(c)
|
||||
int c; /* character to put */
|
||||
{
|
||||
void Charput(int c) {
|
||||
/* character to put c */
|
||||
if (Divert == 0)
|
||||
putchar((unsigned char)c);
|
||||
}
|
||||
|
@ -87,10 +85,8 @@ Charput(c)
|
|||
* Stringput(s) - put a string to output, subject to diversion
|
||||
*/
|
||||
|
||||
void
|
||||
Stringput(s)
|
||||
unsigned char *s; /* string to put */
|
||||
{
|
||||
void Stringput(unsigned char *s) {
|
||||
/* string to put s */
|
||||
if (Divert == 0)
|
||||
fputs((char *)s, stdout);
|
||||
}
|
||||
|
|
|
@ -36,10 +36,7 @@
|
|||
* text into words for pass 3
|
||||
*/
|
||||
|
||||
void
|
||||
Pass2(line)
|
||||
unsigned char *line;
|
||||
{
|
||||
void Pass2(unsigned char *line) {
|
||||
int brk; /* request break status */
|
||||
unsigned char buf[MAXLINE]; /* working buffer */
|
||||
unsigned char c; /* character buffer */
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
#include "regexp.h"
|
||||
#include "proto.h"
|
||||
|
||||
void
|
||||
regerror(s)
|
||||
char *s;
|
||||
{
|
||||
void regerror(char *s) {
|
||||
#ifndef DOSPORT
|
||||
#ifdef ERRAVAIL
|
||||
error("regexp: %s", s);
|
||||
|
|
|
@ -198,10 +198,7 @@ STATIC int strcspn(unsigned char *s1, unsigned char *s2 );
|
|||
* Beware that the optimization-preparation code in here knows about some
|
||||
* of the structure of the compiled regexp.
|
||||
*/
|
||||
regexp *
|
||||
regcomp(exp)
|
||||
char *exp;
|
||||
{
|
||||
regexp *regcomp(char *exp) {
|
||||
register regexp *r;
|
||||
register unsigned char *scan;
|
||||
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
|
||||
* follows makes it hard to avoid.
|
||||
*/
|
||||
STATIC unsigned char *
|
||||
reg(paren, flagp)
|
||||
int paren; /* Parenthesized? */
|
||||
int *flagp;
|
||||
{
|
||||
STATIC unsigned char *reg(int paren, int *flagp) {
|
||||
/* Parenthesized? paren */
|
||||
register unsigned char *ret;
|
||||
register unsigned char *br;
|
||||
register unsigned char *ender;
|
||||
|
@ -358,10 +352,7 @@ int *flagp;
|
|||
*
|
||||
* Implements the concatenation operator.
|
||||
*/
|
||||
STATIC unsigned char *
|
||||
regbranch(flagp)
|
||||
int *flagp;
|
||||
{
|
||||
STATIC unsigned char *regbranch(int *flagp) {
|
||||
register unsigned char *ret;
|
||||
register unsigned char *chain;
|
||||
register unsigned char *latest;
|
||||
|
@ -397,10 +388,7 @@ int *flagp;
|
|||
* It might seem that this node could be dispensed with entirely, but the
|
||||
* endmarker role is not redundant.
|
||||
*/
|
||||
STATIC unsigned char *
|
||||
regpiece(flagp)
|
||||
int *flagp;
|
||||
{
|
||||
STATIC unsigned char *regpiece(int *flagp) {
|
||||
register unsigned char *ret;
|
||||
register unsigned char op;
|
||||
register unsigned char *next;
|
||||
|
@ -461,10 +449,7 @@ int *flagp;
|
|||
* faster to run. Backslashed characters are exceptions, each becoming a
|
||||
* separate node; the code is simpler that way and it's not worth fixing.
|
||||
*/
|
||||
STATIC unsigned char *
|
||||
regatom(flagp)
|
||||
int *flagp;
|
||||
{
|
||||
STATIC unsigned char *regatom(int *flagp) {
|
||||
register unsigned char *ret;
|
||||
int flags;
|
||||
|
||||
|
@ -574,10 +559,8 @@ int *flagp;
|
|||
/*
|
||||
- regnode - emit a node
|
||||
*/
|
||||
STATIC unsigned char * /* Location. */
|
||||
regnode(iop)
|
||||
int iop;
|
||||
{
|
||||
STATIC unsigned char *regnode(int iop) {
|
||||
/* Return value is location */
|
||||
register unsigned char *ret;
|
||||
register unsigned char *ptr;
|
||||
unsigned char op;
|
||||
|
@ -601,10 +584,7 @@ int iop;
|
|||
/*
|
||||
- regc - emit (if appropriate) a byte of code
|
||||
*/
|
||||
STATIC void
|
||||
regc(ib)
|
||||
int ib;
|
||||
{
|
||||
STATIC void regc(int ib) {
|
||||
unsigned char b;
|
||||
|
||||
b = (unsigned char) ib;
|
||||
|
@ -619,11 +599,7 @@ int ib;
|
|||
*
|
||||
* Means relocating the operand.
|
||||
*/
|
||||
STATIC void
|
||||
reginsert(iop, opnd)
|
||||
int iop;
|
||||
unsigned char *opnd;
|
||||
{
|
||||
STATIC void reginsert(int iop, unsigned char *opnd) {
|
||||
register unsigned char *src;
|
||||
register unsigned char *dst;
|
||||
register unsigned char *place;
|
||||
|
@ -650,11 +626,7 @@ unsigned char *opnd;
|
|||
/*
|
||||
- regtail - set the next-pointer at the end of a node chain
|
||||
*/
|
||||
STATIC void
|
||||
regtail(p, val)
|
||||
unsigned char *p;
|
||||
unsigned char *val;
|
||||
{
|
||||
STATIC void regtail(unsigned char *p, unsigned char *val) {
|
||||
register unsigned char *scan;
|
||||
register unsigned char *temp;
|
||||
register int offset;
|
||||
|
@ -682,11 +654,7 @@ unsigned char *val;
|
|||
/*
|
||||
- regoptail - regtail on operand of first argument; nop if operandless
|
||||
*/
|
||||
STATIC void
|
||||
regoptail(p, val)
|
||||
unsigned char *p;
|
||||
unsigned char *val;
|
||||
{
|
||||
STATIC void regoptail(unsigned char *p, unsigned char *val) {
|
||||
/* "Operandless" and "op != BRANCH" are synonymous in practice. */
|
||||
if (p == NULL || p == ®dummy || OP(p) != BRANCH)
|
||||
return;
|
||||
|
@ -707,18 +675,15 @@ STATIC unsigned char **regendp; /* Ditto for endp. */
|
|||
|
||||
#ifdef DEBUG
|
||||
int regnarrate = 0;
|
||||
void regdump();
|
||||
STATIC unsigned char *regprop();
|
||||
void regdump(void);
|
||||
STATIC unsigned char *regprop(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
- regexec - match a regexp against a string
|
||||
*/
|
||||
int
|
||||
regexec(prog, string)
|
||||
register regexp *prog;
|
||||
register unsigned char *string;
|
||||
{
|
||||
regexec(register regexp *prog, register unsigned char *string) {
|
||||
register unsigned char *s;
|
||||
#ifndef STDLIB
|
||||
extern char *strchr();
|
||||
|
@ -782,11 +747,8 @@ register unsigned char *string;
|
|||
/*
|
||||
- regtry - try match at specific point
|
||||
*/
|
||||
STATIC int /* 0 failure, 1 success */
|
||||
regtry(prog, string)
|
||||
regexp *prog;
|
||||
unsigned char *string;
|
||||
{
|
||||
STATIC int regtry(regexp *prog, unsigned char *string) {
|
||||
/* Return value 0 failure, 1 success */
|
||||
register int i;
|
||||
register unsigned char **sp;
|
||||
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
|
||||
* by recursion.
|
||||
*/
|
||||
STATIC int /* 0 failure, 1 success */
|
||||
regmatch(prog)
|
||||
unsigned char *prog;
|
||||
{
|
||||
STATIC int regmatch( unsigned char *prog) {
|
||||
/* Return value 0 failure 1 success */
|
||||
register unsigned char *scan; /* Current node. */
|
||||
unsigned char *next; /* Next node. */
|
||||
#ifndef STDLIB
|
||||
|
@ -1013,10 +973,7 @@ unsigned char *prog;
|
|||
/*
|
||||
- regrepeat - repeatedly match something simple, report how many
|
||||
*/
|
||||
STATIC int
|
||||
regrepeat(p)
|
||||
unsigned char *p;
|
||||
{
|
||||
STATIC int regrepeat(unsigned char *p) {
|
||||
register int count = 0;
|
||||
register unsigned char *scan;
|
||||
register unsigned char *opnd;
|
||||
|
@ -1059,10 +1016,7 @@ unsigned char *p;
|
|||
/*
|
||||
- regnext - dig the "next" pointer out of a node
|
||||
*/
|
||||
STATIC unsigned char *
|
||||
regnext(p)
|
||||
register unsigned char *p;
|
||||
{
|
||||
STATIC unsigned char *regnext(register unsigned char *p) {
|
||||
register int offset;
|
||||
|
||||
if (p == ®dummy)
|
||||
|
@ -1080,15 +1034,12 @@ register unsigned char *p;
|
|||
|
||||
#ifdef DEBUG
|
||||
|
||||
STATIC unsigned char *regprop();
|
||||
STATIC unsigned char *regprop(void);
|
||||
|
||||
/*
|
||||
- regdump - dump a regexp onto stdout in vaguely comprehensible form
|
||||
*/
|
||||
void
|
||||
regdump(r)
|
||||
regexp *r;
|
||||
{
|
||||
void regdump(regexp r) {
|
||||
register unsigned char *s;
|
||||
register unsigned char op = EXACTLY; /* Arbitrary non-END op. */
|
||||
register unsigned char *next;
|
||||
|
@ -1130,10 +1081,8 @@ regexp *r;
|
|||
- regprop - printable representation of opcode
|
||||
*/
|
||||
STATIC unsigned char regprop_buf[50];
|
||||
STATIC unsigned char *
|
||||
regprop(op)
|
||||
unsigned char *op;
|
||||
{
|
||||
|
||||
STATIC unsigned char *regprop(unsigned char *op) {
|
||||
register unsigned char *p;
|
||||
|
||||
(void) strcpy(regprop_buf, ":");
|
||||
|
@ -1221,11 +1170,7 @@ unsigned char *op;
|
|||
* of characters not from s2
|
||||
*/
|
||||
|
||||
STATIC int
|
||||
strcspn(s1, s2)
|
||||
unsigned char *s1;
|
||||
unsigned char *s2;
|
||||
{
|
||||
STATIC int strcspn(unsigned char *s1, unsigned char *s2) {
|
||||
register unsigned char *scan1;
|
||||
register unsigned char *scan2;
|
||||
register int count;
|
||||
|
|
|
@ -31,18 +31,17 @@
|
|||
#include "cawf.h"
|
||||
#include <ctype.h>
|
||||
|
||||
static void Setroman();
|
||||
static void Setroman(void);
|
||||
|
||||
|
||||
/*
|
||||
* Asmname(s, c) - assemble name
|
||||
*/
|
||||
|
||||
Asmname(s, c)
|
||||
unsigned char *s; /* pointer to name */
|
||||
unsigned char *c; /* code destination (c[3]) */
|
||||
{
|
||||
|
||||
int Asmname(unsigned char *s, unsigned char *c) {
|
||||
/* pointer to name s
|
||||
* code destination (c[3])
|
||||
*/
|
||||
c[1] = c[2] = '\0';
|
||||
while (*s && *s == ' ')
|
||||
s++;
|
||||
|
@ -56,10 +55,8 @@ Asmname(s, c)
|
|||
* Delstr(sx) - delete string
|
||||
*/
|
||||
|
||||
void
|
||||
Delstr(sx)
|
||||
int sx; /* string index */
|
||||
{
|
||||
void Delstr(int sx) {
|
||||
/* string index sx */
|
||||
char buf[MAXLINE]; /* message buffer */
|
||||
|
||||
if (sx >= Nstr) {
|
||||
|
@ -79,9 +76,7 @@ Delstr(sx)
|
|||
* Endword() - end a word
|
||||
*/
|
||||
|
||||
void
|
||||
Endword()
|
||||
{
|
||||
void Endword(void) {
|
||||
if (Fontstat != 'R')
|
||||
Setroman();
|
||||
Word[Wordx] = '\0';
|
||||
|
@ -93,13 +88,13 @@ Endword()
|
|||
* optionally enter it
|
||||
*/
|
||||
|
||||
Findchar(nm, l, s, e)
|
||||
unsigned char *nm; /* character name */
|
||||
int l; /* effective length */
|
||||
unsigned char *s; /* value string */
|
||||
int e; /* 0 = find, don't enter
|
||||
* 1 = don't find, enter */
|
||||
{
|
||||
int Findchar(unsigned char *nm, int l, unsigned char *s, int e) {
|
||||
/* character name nm
|
||||
* effective length l
|
||||
* value string s
|
||||
* e = 0 = find, don't enter
|
||||
* e = 1 = don't find, enter
|
||||
*/
|
||||
int cmp, hi, low, mid;
|
||||
unsigned char c[3];
|
||||
|
||||
|
@ -147,12 +142,12 @@ new_char:
|
|||
* Findhy(s, l, e) - find and optionally enter hyphen
|
||||
*/
|
||||
|
||||
Findhy(s, l, e)
|
||||
unsigned char *s; /* value string */
|
||||
int l; /* equivalent length */
|
||||
int e; /* 0 = find, don't enter
|
||||
* 1 = enter, don't find */
|
||||
{
|
||||
int Findhy(unsigned char *s, int l, int e) {
|
||||
/* value string s
|
||||
* equivalent length l
|
||||
* e = 0 = find, don't enter
|
||||
* e = 1 = enter, don't find
|
||||
*/
|
||||
int 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[]
|
||||
*/
|
||||
|
||||
unsigned char *
|
||||
Findstr(nm, s, e)
|
||||
unsigned char *nm; /* 2 character string name */
|
||||
unsigned char *s; /* string value */
|
||||
int e; /* 0 = find, don't enter
|
||||
* 1 = enter, don't find */
|
||||
{
|
||||
unsigned char *Findstr(unsigned char *nm, unsigned char *s, int e) {
|
||||
/* 2 character string name nm
|
||||
* string value s
|
||||
* e = 0 = find, don't enter
|
||||
* e = 1 = enter, don't find
|
||||
*/
|
||||
unsigned char c[3]; /* character buffer */
|
||||
int cmp, hi, low, mid; /* binary search controls */
|
||||
int i; /* temporary indexes */
|
||||
|
@ -249,9 +243,7 @@ new_string:
|
|||
* Setroman() - set Roman font
|
||||
*/
|
||||
|
||||
static void
|
||||
Setroman()
|
||||
{
|
||||
static void Setroman(void) {
|
||||
int i;
|
||||
|
||||
if ((Wordx + Fstr.rl) >= MAXLINE)
|
||||
|
@ -271,10 +263,7 @@ Setroman()
|
|||
* Str2word(s, len) - copy len characters from string to Word[]
|
||||
*/
|
||||
|
||||
Str2word(s, len)
|
||||
unsigned char *s;
|
||||
int len;
|
||||
{
|
||||
int Str2word(unsigned char *s, int len) {
|
||||
int i;
|
||||
|
||||
for (; len > 0; len--, s++) {
|
||||
|
|
Loading…
Reference in a new issue