diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2002-04-26 16:15:17 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2002-04-26 16:15:17 +0000 |
commit | 751f1207fc4315779434d03c633db0f5a685a704 (patch) | |
tree | 6a606fc3547a1303a7c7a83a07c10fc0a685293e /usr.bin | |
parent | f9893f673eaa78484fd40b361e55bb60053d9266 (diff) |
use ansi function declarations. ok millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/m4/eval.c | 90 | ||||
-rw-r--r-- | usr.bin/m4/expr.c | 10 | ||||
-rw-r--r-- | usr.bin/m4/gnum4.c | 78 | ||||
-rw-r--r-- | usr.bin/m4/look.c | 20 | ||||
-rw-r--r-- | usr.bin/m4/main.c | 33 | ||||
-rw-r--r-- | usr.bin/m4/misc.c | 59 | ||||
-rw-r--r-- | usr.bin/m4/trace.c | 32 |
7 files changed, 92 insertions, 230 deletions
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c index 870bffdeb89..5af3c8774c4 100644 --- a/usr.bin/m4/eval.c +++ b/usr.bin/m4/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.43 2002/02/16 21:27:48 millert Exp $ */ +/* $OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: eval.c,v 1.43 2002/02/16 21:27:48 millert Exp $"; +static char rcsid[] = "$OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $"; #endif #endif /* not lint */ @@ -109,10 +109,7 @@ unsigned long expansion_id; * argc is 3 for macro-or-builtin() and 2 for macro-or-builtin */ void -eval(argv, argc, td) - const char *argv[]; - int argc; - int td; +eval(const char *argv[], int argc, int td) { ssize_t mark = -1; @@ -134,10 +131,7 @@ eval(argv, argc, td) * expand_builtin - evaluate built-in macros. */ void -expand_builtin(argv, argc, td) - const char *argv[]; - int argc; - int td; +expand_builtin(const char *argv[], int argc, int td) { int c, n; int ac; @@ -501,9 +495,7 @@ expand_builtin(argv, argc, td) * expand_macro - user-defined macro expansion */ void -expand_macro(argv, argc) - const char *argv[]; - int argc; +expand_macro(const char *argv[], int argc) { const char *t; const char *p; @@ -576,9 +568,7 @@ expand_macro(argv, argc) * dodefine - install definition in the table */ void -dodefine(name, defn) - const char *name; - const char *defn; +dodefine(const char *name, const char *defn) { ndptr p; int n; @@ -614,8 +604,7 @@ dodefine(name, defn) * the given name. */ static void -dodefn(name) - const char *name; +dodefn(const char *name) { ndptr p; char *real; @@ -640,9 +629,7 @@ dodefn(name) * lookup. */ static void -dopushdef(name, defn) - const char *name; - const char *defn; +dopushdef(const char *name, const char *defn) { ndptr p; @@ -663,8 +650,7 @@ dopushdef(name, defn) * dump_one_def - dump the specified definition. */ static void -dump_one_def(p) - ndptr p; +dump_one_def(ndptr p) { char *real; @@ -687,9 +673,7 @@ dump_one_def(p) * hash table is dumped. */ static void -dodump(argv, argc) - const char *argv[]; - int argc; +dodump(const char *argv[], int argc) { int n; ndptr p; @@ -709,10 +693,7 @@ dodump(argv, argc) * dotrace - mark some macros as traced/untraced depending upon on. */ static void -dotrace(argv, argc, on) - const char *argv[]; - int argc; - int on; +dotrace(const char *argv[], int argc, int on) { int n; @@ -727,9 +708,7 @@ dotrace(argv, argc, on) * doifelse - select one of two alternatives - loop. */ static void -doifelse(argv, argc) - const char *argv[]; - int argc; +doifelse(const char *argv[], int argc) { cycle { if (STREQ(argv[2], argv[3])) @@ -749,8 +728,7 @@ doifelse(argv, argc) * doinclude - include a given file. */ static int -doincl(ifile) - const char *ifile; +doincl(const char *ifile) { if (ilevel + 1 == MAXINP) errx(1, "%s at line %lu: too many include files.", @@ -769,8 +747,7 @@ doincl(ifile) * macro processing. */ static int -dopaste(pfile) - const char *pfile; +dopaste(const char *pfile) { FILE *pf; int c; @@ -786,9 +763,7 @@ dopaste(pfile) #endif static void -gnu_dochq(argv, ac) - const char *argv[]; - int ac; +gnu_dochq(const char *argv[], int ac) { /* In gnu-m4 mode, the only way to restore quotes is to have no * arguments at all. */ @@ -808,9 +783,7 @@ gnu_dochq(argv, ac) * dochq - change quote characters */ static void -dochq(argv, argc) - const char *argv[]; - int argc; +dochq(const char *argv[], int argc) { if (argc > 2) { if (*argv[2]) @@ -831,9 +804,7 @@ dochq(argv, argc) } static void -gnu_dochc(argv, ac) - const char *argv[]; - int ac; +gnu_dochc(const char *argv[], int ac) { /* In gnu-m4 mode, no arguments mean no comment * arguments at all. */ @@ -855,9 +826,7 @@ gnu_dochc(argv, ac) * dochc - change comment characters */ static void -dochc(argv, argc) - const char *argv[]; - int argc; +dochc(const char *argv[], int argc) { if (argc > 2) { if (*argv[2]) @@ -879,8 +848,7 @@ dochc(argv, argc) * dodivert - divert the output to a temporary file */ static void -dodiv(n) - int n; +dodiv(int n) { int fd; @@ -911,9 +879,7 @@ dodiv(n) * other outputs, in numerical order. */ static void -doundiv(argv, argc) - const char *argv[]; - int argc; +doundiv(const char *argv[], int argc) { int ind; int n; @@ -936,9 +902,7 @@ doundiv(argv, argc) * dosub - select substring */ static void -dosub(argv, argc) - const char *argv[]; - int argc; +dosub(const char *argv[], int argc) { const char *ap, *fc, *k; int nc; @@ -987,11 +951,7 @@ dosub(argv, argc) * destination string. */ static void -map(dest, src, from, to) - char *dest; - const char *src; - const char *from; - const char *to; +map(char *dest, const char *src, const char *from, const char *to) { const char *tmp; unsigned char sch, dch; @@ -1063,10 +1023,7 @@ map(dest, src, from, to) * on the way. */ static const char * -handledash(buffer, end, src) - char *buffer; - char *end; - const char *src; +handledash(char *buffer, char *end, const char *src) { char *p; @@ -1091,4 +1048,3 @@ handledash(buffer, end, src) *p = '\0'; return buffer; } - diff --git a/usr.bin/m4/expr.c b/usr.bin/m4/expr.c index 30935ce08a4..10eacc91bd1 100644 --- a/usr.bin/m4/expr.c +++ b/usr.bin/m4/expr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expr.c,v 1.13 2002/04/26 12:55:01 espie Exp $ */ +/* $OpenBSD: expr.c,v 1.14 2002/04/26 16:15:16 espie Exp $ */ /* $NetBSD: expr.c,v 1.7 1995/09/28 05:37:31 tls Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)expr.c 8.2 (Berkeley) 4/29/95"; #else -static char rcsid[] = "$OpenBSD: expr.c,v 1.13 2002/04/26 12:55:01 espie Exp $"; +static char rcsid[] = "$OpenBSD: expr.c,v 1.14 2002/04/26 16:15:16 espie Exp $"; #endif #endif /* not lint */ @@ -142,8 +142,7 @@ static jmp_buf expjump; #define getch() *nxtch++ int -expr(expbuf) - const char *expbuf; +expr(const char *expbuf) { int rval; @@ -615,8 +614,7 @@ skipws() * and forces eval to return FALSE. */ static void -experr(msg) - const char *msg; +experr(const char *msg) { printf("m4: %s in expr %s.\n", msg, where); longjmp(expjump, -1); diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c index c938e8e28be..0383ef4c745 100644 --- a/usr.bin/m4/gnum4.c +++ b/usr.bin/m4/gnum4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gnum4.c,v 1.17 2002/04/26 13:13:41 espie Exp $ */ +/* $OpenBSD: gnum4.c,v 1.18 2002/04/26 16:15:16 espie Exp $ */ /* * Copyright (c) 1999 Marc Espie @@ -67,8 +67,7 @@ static void ensure_m4path(void); static struct input_file *dopath(struct input_file *, const char *); static struct path_entry * -new_path_entry(dirname) - const char *dirname; +new_path_entry(const char *dirname) { struct path_entry *n; @@ -83,8 +82,7 @@ new_path_entry(dirname) } void -addtoincludepath(dirname) - const char *dirname; +addtoincludepath(const char *dirname) { struct path_entry *n; @@ -124,9 +122,7 @@ ensure_m4path() static struct input_file * -dopath(i, filename) - struct input_file *i; - const char *filename; +dopath(struct input_file *i, const char *filename) { char path[MAXPATHLEN]; struct path_entry *pe; @@ -143,9 +139,7 @@ dopath(i, filename) } struct input_file * -fopen_trypath(i, filename) - struct input_file *i; - const char *filename; +fopen_trypath(struct input_file *i, const char *filename) { FILE *f; @@ -163,9 +157,7 @@ fopen_trypath(i, filename) } void -doindir(argv, argc) - const char *argv[]; - int argc; +doindir(const char *argv[], int argc) { ndptr p; @@ -177,9 +169,7 @@ doindir(argv, argc) } void -dobuiltin(argv, argc) - const char *argv[]; - int argc; +dobuiltin(const char *argv[], int argc) { int n; argv[1] = NULL; @@ -210,9 +200,7 @@ static void add_replace(const char *, regex_t *, const char *, regmatch_t *); #define addconstantstring(s) addchars((s), sizeof(s)-1) static void -addchars(c, n) - const char *c; - size_t n; +addchars(const char *c, size_t n) { if (n == 0) return; @@ -230,8 +218,7 @@ addchars(c, n) } static void -addchar(c) - int c; +addchar(int c) { if (current +1 > bufsize) { if (bufsize == 0) @@ -255,9 +242,7 @@ getstring() static void -exit_regerror(er, re) - int er; - regex_t *re; +exit_regerror(int er, regex_t *re) { size_t errlen; char *errbuf; @@ -269,11 +254,7 @@ exit_regerror(er, re) } static void -add_sub(n, string, re, pm) - int n; - const char *string; - regex_t *re; - regmatch_t *pm; +add_sub(int n, const char *string, regex_t *re, regmatch_t *pm) { if (n > re->re_nsub) warnx("No subexpression %d", n); @@ -290,11 +271,7 @@ add_sub(n, string, re, pm) * constructs and replacing them with substrings of the original string. */ static void -add_replace(string, re, replace, pm) - const char *string; - regex_t *re; - const char *replace; - regmatch_t *pm; +add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm) { const char *p; @@ -327,11 +304,7 @@ add_replace(string, re, replace, pm) } static void -do_subst(string, re, replace, pm) - const char *string; - regex_t *re; - const char *replace; - regmatch_t *pm; +do_subst(const char *string, regex_t *re, const char *replace, regmatch_t *pm) { int error; int flags = 0; @@ -371,11 +344,7 @@ do_subst(string, re, replace, pm) } static void -do_regexp(string, re, replace, pm) - const char *string; - regex_t *re; - const char *replace; - regmatch_t *pm; +do_regexp(const char *string, regex_t *re, const char *replace, regmatch_t *pm) { int error; @@ -392,10 +361,7 @@ do_regexp(string, re, replace, pm) } static void -do_regexpindex(string, re, pm) - const char *string; - regex_t *re; - regmatch_t *pm; +do_regexpindex(const char *string, regex_t *re, regmatch_t *pm) { int error; @@ -415,8 +381,7 @@ do_regexpindex(string, re, pm) * says. So we twiddle with the regexp before passing it to regcomp. */ static char * -twiddle(p) - const char *p; +twiddle(const char *p) { /* This could use strcspn for speed... */ while (*p != '\0') { @@ -461,9 +426,7 @@ twiddle(p) * argv[4]: opt rep */ void -dopatsubst(argv, argc) - const char *argv[]; - int argc; +dopatsubst(const char *argv[], int argc) { int error; regex_t re; @@ -487,9 +450,7 @@ dopatsubst(argv, argc) } void -doregexp(argv, argc) - const char *argv[]; - int argc; +doregexp(const char *argv[], int argc) { int error; regex_t re; @@ -514,8 +475,7 @@ doregexp(argv, argc) } void -doesyscmd(cmd) - const char *cmd; +doesyscmd(const char *cmd) { int p[2]; pid_t pid, cpid; diff --git a/usr.bin/m4/look.c b/usr.bin/m4/look.c index ffb58e05167..ba76e805fda 100644 --- a/usr.bin/m4/look.c +++ b/usr.bin/m4/look.c @@ -1,4 +1,4 @@ -/* $OpenBSD: look.c,v 1.9 2002/02/16 21:27:48 millert Exp $ */ +/* $OpenBSD: look.c,v 1.10 2002/04/26 16:15:16 espie Exp $ */ /* * Copyright (c) 1989, 1993 @@ -57,9 +57,8 @@ static char sccsid[] = "@(#)look.c 8.1 (Berkeley) 6/6/93"; static void freent(ndptr); -unsigned -hash(name) - const char *name; +unsigned int +hash(const char *name) { unsigned int h = 0; while (*name) @@ -71,8 +70,7 @@ hash(name) * find name in the hash table */ ndptr -lookup(name) - const char *name; +lookup(const char *name) { ndptr p; unsigned int h; @@ -89,8 +87,7 @@ lookup(name) * The new entry is added in front of a hash bucket. */ ndptr -addent(name) - const char *name; +addent(const char *name) { unsigned int h; ndptr p; @@ -105,8 +102,7 @@ addent(name) } static void -freent(p) - ndptr p; +freent(ndptr p) { free((char *) p->name); if (p->defn != null) @@ -118,9 +114,7 @@ freent(p) * remove an entry from the hashtable */ void -remhash(name, all) - const char *name; - int all; +remhash(const char *name, int all) { unsigned int h; ndptr xp, tp, mp; diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c index 644b8978844..9e29700fcb7 100644 --- a/usr.bin/m4/main.c +++ b/usr.bin/m4/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.52 2002/02/16 21:27:48 millert Exp $ */ +/* $OpenBSD: main.c,v 1.53 2002/04/26 16:15:16 espie Exp $ */ /* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */ /*- @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.52 2002/02/16 21:27:48 millert Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.53 2002/04/26 16:15:16 espie Exp $"; #endif #endif /* not lint */ @@ -172,9 +172,7 @@ static void enlarge_stack(void); int main(int, char *[]); int -main(argc,argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int c; int n; @@ -279,9 +277,7 @@ main(argc,argv) * 0 if `token' not found; all characters pushed back */ static int -do_look_ahead(t, token) - int t; - const char *token; +do_look_ahead(int t, const char *token) { int i; @@ -489,8 +485,7 @@ macro() * output string directly, without pushing it for reparses. */ void -outputstr(s) - const char *s; +outputstr(const char *s) { if (sp < 0) while (*s) @@ -506,9 +501,7 @@ outputstr(s) * combo with lookup to speed things up. */ static ndptr -inspect(c, tp) - int c; - char *tp; +inspect(int c, char *tp) { char *name = tp; char *etp = tp+MAXTOK; @@ -572,8 +565,7 @@ initkwds() /* Look up a builtin type, even if overridden by the user */ int -builtin_type(key) - const char *key; +builtin_type(const char *key) { int i; @@ -584,8 +576,7 @@ builtin_type(key) } char * -builtin_realname(n) - int n; +builtin_realname(int n) { int i; @@ -596,9 +587,7 @@ builtin_realname(n) } static void -record(t, lev) - struct position *t; - int lev; +record(struct position *t, int lev) { if (lev < MAXRECORD) { t[lev].name = CURRENT_NAME; @@ -607,9 +596,7 @@ record(t, lev) } static void -dump_stack(t, lev) - struct position *t; - int lev; +dump_stack(struct position *t, int lev) { int i; diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c index e4bfa7ef1a8..291c2192fde 100644 --- a/usr.bin/m4/misc.c +++ b/usr.bin/m4/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.26 2001/11/16 23:50:40 deraadt Exp $ */ +/* $OpenBSD: misc.c,v 1.27 2002/04/26 16:15:16 espie Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: misc.c,v 1.26 2001/11/16 23:50:40 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: misc.c,v 1.27 2002/04/26 16:15:16 espie Exp $"; #endif #endif /* not lint */ @@ -76,9 +76,7 @@ char *endpbb; /* end of push-back buffer */ * find the index of second str in the first str. */ ptrdiff_t -indx(s1, s2) - const char *s1; - const char *s2; +indx(const char *s1, const char *s2) { char *t; @@ -92,8 +90,7 @@ indx(s1, s2) * putback - push character back onto input */ void -putback(c) - int c; +putback(int c) { if (c == EOF) return; @@ -108,8 +105,7 @@ putback(c) * performance. */ void -pbstr(s) - const char *s; +pbstr(const char *s) { size_t n; @@ -124,8 +120,7 @@ pbstr(s) * pbnum - convert number to string, push back on input. */ void -pbnum(n) - int n; +pbnum(int n) { int num; @@ -143,8 +138,7 @@ pbnum(n) * pbunsigned - convert unsigned long to string, push back on input. */ void -pbunsigned(n) - unsigned long n; +pbunsigned(unsigned long n) { do { putback(n % 10 + '0'); @@ -211,8 +205,7 @@ enlarge_bufspace() * chrsave - put single char on string space */ void -chrsave(c) - int c; +chrsave(int c) { if (ep >= endest) enlarge_strspace(); @@ -223,8 +216,7 @@ chrsave(c) * read in a diversion file, and dispose it. */ void -getdiv(n) - int n; +getdiv(int n) { int c; @@ -238,8 +230,7 @@ getdiv(n) } void -onintr(signo) - int signo; +onintr(int signo) { #define intrmessage "m4: interrupted.\n" write(STDERR_FILENO, intrmessage, sizeof(intrmessage)-1); @@ -263,8 +254,7 @@ killdiv() /* * resizedivs: allocate more diversion files */ void -resizedivs(n) - int n; +resizedivs(int n) { int i; @@ -277,8 +267,7 @@ resizedivs(n) } void * -xalloc(n) - size_t n; +xalloc(size_t n) { char *p = malloc(n); @@ -288,8 +277,7 @@ xalloc(n) } char * -xstrdup(s) - const char *s; +xstrdup(const char *s) { char *p = strdup(s); if (p == NULL) @@ -305,8 +293,7 @@ usage() } int -obtain_char(f) - struct input_file *f; +obtain_char(struct input_file *f) { if (f->c == EOF) return EOF; @@ -318,10 +305,7 @@ obtain_char(f) } void -set_input(f, real, name) - struct input_file *f; - FILE *real; - const char *name; +set_input(struct input_file *f, FILE *real, const char *name) { f->file = real; f->lineno = 1; @@ -330,8 +314,7 @@ set_input(f, real, name) } void -release_input(f) - struct input_file *f; +release_input(struct input_file *f) { if (f->file != stdin) fclose(f->file); @@ -343,15 +326,13 @@ release_input(f) } void -doprintlineno(f) - struct input_file *f; +doprintlineno(struct input_file *f) { pbunsigned(f->lineno); } void -doprintfilename(f) - struct input_file *f; +doprintfilename(struct input_file *f) { pbstr(rquote); pbstr(f->name); @@ -370,9 +351,7 @@ buffer_mark() void -dump_buffer(f, m) - FILE *f; - size_t m; +dump_buffer(FILE *f, size_t m) { char *s; diff --git a/usr.bin/m4/trace.c b/usr.bin/m4/trace.c index 35c3ecb0d62..99c72aba2db 100644 --- a/usr.bin/m4/trace.c +++ b/usr.bin/m4/trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trace.c,v 1.5 2002/04/26 13:12:33 espie Exp $ */ +/* $OpenBSD: trace.c,v 1.6 2002/04/26 16:15:16 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. * @@ -62,8 +62,7 @@ static int frame_level(void); static unsigned int flags = TRACE_QUOTE | TRACE_EXPANSION; static struct t * -find_trace_entry(name) - const char *name; +find_trace_entry(const char *name) { struct t *n; @@ -75,9 +74,7 @@ find_trace_entry(name) void -mark_traced(name, on) - const char *name; - int on; +mark_traced(const char *name, int on) { struct t *n, *n2; @@ -109,8 +106,7 @@ mark_traced(name, on) } int -is_traced(name) - const char *name; +is_traced(const char *name) { struct t *n; @@ -121,8 +117,7 @@ is_traced(name) } void -trace_file(name) - const char *name; +trace_file(const char *name) { if (traceout != stderr) @@ -133,8 +128,7 @@ trace_file(name) } static unsigned int -letter_to_flag(c) - int c; +letter_to_flag(int c) { switch(c) { case 'a': @@ -165,8 +159,7 @@ letter_to_flag(c) } void -set_trace_flags(s) - const char *s; +set_trace_flags(const char *s) { char mode = 0; unsigned int f = 0; @@ -203,8 +196,7 @@ frame_level() } static void -print_header(inp) - struct input_file *inp; +print_header(struct input_file *inp) { fprintf(traceout, "m4trace:"); if (flags & TRACE_FILENAME) @@ -217,10 +209,7 @@ print_header(inp) } ssize_t -trace(argv, argc, inp) - const char **argv; - int argc; - struct input_file *inp; +trace(const char *argv[], int argc, struct input_file *inp) { print_header(inp); if (flags & TRACE_CONT) { @@ -259,8 +248,7 @@ trace(argv, argc, inp) } void -finish_trace(mark) -size_t mark; +finish_trace(size_t mark) { fprintf(traceout, " -> "); if (flags & TRACE_QUOTE) |