mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-20 02:38:43 +00:00
Merge local changes again, against ANSIfied m4(1).
This commit is contained in:
parent
f132072368
commit
bd2bfb5846
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95887
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.8 2001/09/18 14:55:52 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.10 2002/04/26 13:13:41 espie Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
# -DEXTENDED
|
||||
|
@ -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 $ */
|
||||
|
||||
/*
|
||||
@ -38,8 +38,8 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__SCCSID("@(#)eval.c 8.2 (Berkeley) 4/27/95");
|
||||
__RCSID_SOURCE("$OpenBSD: eval.c,v 1.43 2002/02/16 21:27:48 millert Exp $");
|
||||
__SCCSID("@(#)eval.c 8.2 (Berkeley) 4/27/95");
|
||||
__RCSID_SOURCE("$OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
@ -106,10 +106,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;
|
||||
|
||||
@ -131,10 +128,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;
|
||||
@ -498,9 +492,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;
|
||||
@ -573,9 +565,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;
|
||||
@ -611,8 +601,7 @@ dodefine(name, defn)
|
||||
* the given name.
|
||||
*/
|
||||
static void
|
||||
dodefn(name)
|
||||
const char *name;
|
||||
dodefn(const char *name)
|
||||
{
|
||||
ndptr p;
|
||||
const char *real;
|
||||
@ -637,9 +626,7 @@ dodefn(name)
|
||||
* lookup.
|
||||
*/
|
||||
static void
|
||||
dopushdef(name, defn)
|
||||
const char *name;
|
||||
const char *defn;
|
||||
dopushdef(const char *name, const char *defn)
|
||||
{
|
||||
ndptr p;
|
||||
|
||||
@ -660,8 +647,7 @@ dopushdef(name, defn)
|
||||
* dump_one_def - dump the specified definition.
|
||||
*/
|
||||
static void
|
||||
dump_one_def(p)
|
||||
ndptr p;
|
||||
dump_one_def(ndptr p)
|
||||
{
|
||||
const char *real;
|
||||
|
||||
@ -684,9 +670,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;
|
||||
@ -706,10 +690,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;
|
||||
|
||||
@ -724,9 +705,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]))
|
||||
@ -746,8 +725,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.",
|
||||
@ -770,8 +748,7 @@ doincl(ifile)
|
||||
* macro processing.
|
||||
*/
|
||||
static int
|
||||
dopaste(pfile)
|
||||
const char *pfile;
|
||||
dopaste(const char *pfile)
|
||||
{
|
||||
FILE *pf;
|
||||
int c;
|
||||
@ -789,9 +766,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. */
|
||||
@ -811,9 +786,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])
|
||||
@ -834,9 +807,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. */
|
||||
@ -858,9 +829,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])
|
||||
@ -882,8 +851,7 @@ dochc(argv, argc)
|
||||
* dodivert - divert the output to a temporary file
|
||||
*/
|
||||
static void
|
||||
dodiv(n)
|
||||
int n;
|
||||
dodiv(int n)
|
||||
{
|
||||
int fd;
|
||||
|
||||
@ -914,9 +882,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;
|
||||
@ -939,9 +905,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;
|
||||
@ -990,11 +954,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;
|
||||
@ -1066,10 +1026,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;
|
||||
|
||||
@ -1094,4 +1051,3 @@ handledash(buffer, end, src)
|
||||
*p = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: expr.c,v 1.12 2002/02/16 21:27:48 millert 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 $ */
|
||||
|
||||
/*
|
||||
@ -38,8 +38,8 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__SCCSID("@(#)expr.c 8.2 (Berkeley) 4/29/95");
|
||||
__RCSID_SOURCE("$OpenBSD: expr.c,v 1.12 2002/02/16 21:27:48 millert Exp $");
|
||||
__SCCSID("@(#)expr.c 8.2 (Berkeley) 4/29/95");
|
||||
__RCSID_SOURCE("$OpenBSD: expr.c,v 1.14 2002/04/26 16:15:16 espie Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -139,8 +139,7 @@ static jmp_buf expjump;
|
||||
#define getch() *nxtch++
|
||||
|
||||
int
|
||||
expr(expbuf)
|
||||
const char *expbuf;
|
||||
expr(const char *expbuf)
|
||||
{
|
||||
int rval;
|
||||
|
||||
@ -163,12 +162,12 @@ expr(expbuf)
|
||||
static int
|
||||
query()
|
||||
{
|
||||
int bool, true_val, false_val;
|
||||
int result, true_val, false_val;
|
||||
|
||||
bool = lor();
|
||||
result = lor();
|
||||
if (skipws() != '?') {
|
||||
ungetch();
|
||||
return bool;
|
||||
return result;
|
||||
}
|
||||
|
||||
true_val = query();
|
||||
@ -176,7 +175,7 @@ query()
|
||||
experr("bad query");
|
||||
|
||||
false_val = query();
|
||||
return bool ? true_val : false_val;
|
||||
return result ? true_val : false_val;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -610,8 +609,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);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: gnum4.c,v 1.16 2002/02/16 21:27:48 millert Exp $ */
|
||||
/* $OpenBSD: gnum4.c,v 1.18 2002/04/26 16:15:16 espie Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Marc Espie
|
||||
@ -70,8 +70,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;
|
||||
|
||||
@ -86,8 +85,7 @@ new_path_entry(dirname)
|
||||
}
|
||||
|
||||
void
|
||||
addtoincludepath(dirname)
|
||||
const char *dirname;
|
||||
addtoincludepath(const char *dirname)
|
||||
{
|
||||
struct path_entry *n;
|
||||
|
||||
@ -127,9 +125,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;
|
||||
@ -146,9 +142,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;
|
||||
|
||||
@ -166,9 +160,7 @@ fopen_trypath(i, filename)
|
||||
}
|
||||
|
||||
void
|
||||
doindir(argv, argc)
|
||||
const char *argv[];
|
||||
int argc;
|
||||
doindir(const char *argv[], int argc)
|
||||
{
|
||||
ndptr p;
|
||||
|
||||
@ -180,9 +172,7 @@ doindir(argv, argc)
|
||||
}
|
||||
|
||||
void
|
||||
dobuiltin(argv, argc)
|
||||
const char *argv[];
|
||||
int argc;
|
||||
dobuiltin(const char *argv[], int argc)
|
||||
{
|
||||
int n;
|
||||
argv[1] = NULL;
|
||||
@ -201,7 +191,7 @@ static size_t bufsize = 0;
|
||||
static size_t current = 0;
|
||||
|
||||
static void addchars(const char *, size_t);
|
||||
static void addchar(char);
|
||||
static void addchar(int);
|
||||
static char *twiddle(const char *);
|
||||
static char *getstring(void);
|
||||
static void exit_regerror(int, regex_t *);
|
||||
@ -213,9 +203,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;
|
||||
@ -233,8 +221,7 @@ addchars(c, n)
|
||||
}
|
||||
|
||||
static void
|
||||
addchar(c)
|
||||
char c;
|
||||
addchar(int c)
|
||||
{
|
||||
if (current +1 > bufsize) {
|
||||
if (bufsize == 0)
|
||||
@ -258,9 +245,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;
|
||||
@ -272,11 +257,7 @@ exit_regerror(er, re)
|
||||
}
|
||||
|
||||
static void
|
||||
add_sub(n, string, re, pm)
|
||||
size_t n;
|
||||
const char *string;
|
||||
regex_t *re;
|
||||
regmatch_t *pm;
|
||||
add_sub(size_t n, const char *string, regex_t *re, regmatch_t *pm)
|
||||
{
|
||||
if (n > re->re_nsub)
|
||||
warnx("No subexpression %zu", n);
|
||||
@ -293,11 +274,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;
|
||||
|
||||
@ -330,11 +307,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;
|
||||
@ -374,11 +347,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;
|
||||
|
||||
@ -395,10 +364,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;
|
||||
|
||||
@ -418,8 +384,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') {
|
||||
@ -464,9 +429,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;
|
||||
@ -490,9 +453,7 @@ dopatsubst(argv, argc)
|
||||
}
|
||||
|
||||
void
|
||||
doregexp(argv, argc)
|
||||
const char *argv[];
|
||||
int argc;
|
||||
doregexp(const char *argv[], int argc)
|
||||
{
|
||||
int error;
|
||||
regex_t re;
|
||||
@ -517,8 +478,7 @@ doregexp(argv, argc)
|
||||
}
|
||||
|
||||
void
|
||||
doesyscmd(cmd)
|
||||
const char *cmd;
|
||||
doesyscmd(const char *cmd)
|
||||
{
|
||||
int p[2];
|
||||
pid_t pid, cpid;
|
||||
|
@ -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
|
||||
@ -37,7 +37,8 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__SCCSID("@(#)look.c 8.1 (Berkeley) 6/6/93");
|
||||
__SCCSID("@(#)look.c 8.1 (Berkeley) 6/6/93");
|
||||
__RCSID_SOURCE("$OpenBSD: look.c,v 1.10 2002/04/26 16:15:16 espie Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
@ -57,9 +58,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
static void freent(ndptr);
|
||||
|
||||
unsigned
|
||||
hash(name)
|
||||
const char *name;
|
||||
unsigned int
|
||||
hash(const char *name)
|
||||
{
|
||||
unsigned int h = 0;
|
||||
while (*name)
|
||||
@ -71,8 +71,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 +88,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 +103,7 @@ addent(name)
|
||||
}
|
||||
|
||||
static void
|
||||
freent(p)
|
||||
ndptr p;
|
||||
freent(ndptr p)
|
||||
{
|
||||
free((char *) p->name);
|
||||
if (p->defn != null)
|
||||
@ -118,9 +115,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;
|
||||
|
@ -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 $ */
|
||||
|
||||
/*-
|
||||
@ -40,8 +40,8 @@
|
||||
#include <sys/cdefs.h>
|
||||
__COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
__SCCSID("@(#)main.c 8.1 (Berkeley) 6/6/93");
|
||||
__RCSID_SOURCE("$OpenBSD: main.c,v 1.52 2002/02/16 21:27:48 millert Exp $");
|
||||
__SCCSID("@(#)main.c 8.1 (Berkeley) 6/6/93");
|
||||
__RCSID_SOURCE("$OpenBSD: main.c,v 1.53 2002/04/26 16:15:16 espie Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
@ -168,9 +168,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;
|
||||
@ -288,9 +286,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;
|
||||
|
||||
@ -500,8 +496,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)
|
||||
@ -517,9 +512,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;
|
||||
@ -583,8 +576,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;
|
||||
|
||||
@ -595,8 +587,7 @@ builtin_type(key)
|
||||
}
|
||||
|
||||
const char *
|
||||
builtin_realname(n)
|
||||
int n;
|
||||
builtin_realname(int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -607,9 +598,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;
|
||||
@ -618,9 +607,7 @@ record(t, lev)
|
||||
}
|
||||
|
||||
static void
|
||||
dump_stack(t, lev)
|
||||
struct position *t;
|
||||
int lev;
|
||||
dump_stack(struct position *t, int lev)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -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 $ */
|
||||
|
||||
/*
|
||||
@ -38,8 +38,8 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__SCCSID("@(#)misc.c 8.1 (Berkeley) 6/6/93");
|
||||
__RCSID_SOURCE("$OpenBSD: misc.c,v 1.26 2001/11/16 23:50:40 deraadt Exp $");
|
||||
__SCCSID("@(#)misc.c 8.1 (Berkeley) 6/6/93");
|
||||
__RCSID_SOURCE("$OpenBSD: misc.c,v 1.27 2002/04/26 16:15:16 espie Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -73,9 +73,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;
|
||||
|
||||
@ -89,8 +87,7 @@ indx(s1, s2)
|
||||
* putback - push character back onto input
|
||||
*/
|
||||
void
|
||||
putback(c)
|
||||
int c;
|
||||
putback(int c)
|
||||
{
|
||||
if (c == EOF)
|
||||
return;
|
||||
@ -105,8 +102,7 @@ putback(c)
|
||||
* performance.
|
||||
*/
|
||||
void
|
||||
pbstr(s)
|
||||
const char *s;
|
||||
pbstr(const char *s)
|
||||
{
|
||||
size_t n;
|
||||
|
||||
@ -121,8 +117,7 @@ pbstr(s)
|
||||
* pbnum - convert number to string, push back on input.
|
||||
*/
|
||||
void
|
||||
pbnum(n)
|
||||
int n;
|
||||
pbnum(int n)
|
||||
{
|
||||
int num;
|
||||
|
||||
@ -140,8 +135,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');
|
||||
@ -208,8 +202,7 @@ enlarge_bufspace()
|
||||
* chrsave - put single char on string space
|
||||
*/
|
||||
void
|
||||
chrsave(c)
|
||||
int c;
|
||||
chrsave(int c)
|
||||
{
|
||||
if (ep >= endest)
|
||||
enlarge_strspace();
|
||||
@ -220,8 +213,7 @@ chrsave(c)
|
||||
* read in a diversion file, and dispose it.
|
||||
*/
|
||||
void
|
||||
getdiv(n)
|
||||
int n;
|
||||
getdiv(int n)
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -235,8 +227,7 @@ getdiv(n)
|
||||
}
|
||||
|
||||
void
|
||||
onintr(signo)
|
||||
int signo __unused;
|
||||
onintr(int signo __unused)
|
||||
{
|
||||
#define intrmessage "m4: interrupted.\n"
|
||||
write(STDERR_FILENO, intrmessage, sizeof(intrmessage)-1);
|
||||
@ -260,8 +251,7 @@ killdiv()
|
||||
/*
|
||||
* resizedivs: allocate more diversion files */
|
||||
void
|
||||
resizedivs(n)
|
||||
int n;
|
||||
resizedivs(int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -274,8 +264,7 @@ resizedivs(n)
|
||||
}
|
||||
|
||||
void *
|
||||
xalloc(n)
|
||||
size_t n;
|
||||
xalloc(size_t n)
|
||||
{
|
||||
char *p = malloc(n);
|
||||
|
||||
@ -285,8 +274,7 @@ xalloc(n)
|
||||
}
|
||||
|
||||
char *
|
||||
xstrdup(s)
|
||||
const char *s;
|
||||
xstrdup(const char *s)
|
||||
{
|
||||
char *p = strdup(s);
|
||||
if (p == NULL)
|
||||
@ -304,8 +292,7 @@ usage()
|
||||
}
|
||||
|
||||
int
|
||||
obtain_char(f)
|
||||
struct input_file *f;
|
||||
obtain_char(struct input_file *f)
|
||||
{
|
||||
if (f->c == EOF)
|
||||
return EOF;
|
||||
@ -317,10 +304,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;
|
||||
@ -329,8 +313,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);
|
||||
@ -342,15 +325,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);
|
||||
@ -369,9 +350,7 @@ buffer_mark()
|
||||
|
||||
|
||||
void
|
||||
dump_buffer(f, m)
|
||||
FILE *f;
|
||||
size_t m;
|
||||
dump_buffer(FILE *f, size_t m)
|
||||
{
|
||||
char *s;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: trace.c,v 1.4 2002/02/16 21:27:48 millert Exp $ */
|
||||
/* $OpenBSD: trace.c,v 1.6 2002/04/26 16:15:16 espie Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Marc Espie.
|
||||
*
|
||||
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID_SOURCE("$OpenBSD: trace.c,v 1.6 2002/04/26 16:15:16 espie Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -66,8 +67,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;
|
||||
|
||||
@ -79,9 +79,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;
|
||||
|
||||
@ -103,18 +101,17 @@ mark_traced(name, on)
|
||||
} else {
|
||||
n = find_trace_entry(name);
|
||||
if (n == NULL) {
|
||||
n = xalloc(sizeof(struct t));
|
||||
n->name = xstrdup(name);
|
||||
n->next = l;
|
||||
l = n;
|
||||
n = xalloc(sizeof(struct t));
|
||||
n->name = xstrdup(name);
|
||||
n->next = l;
|
||||
l = n;
|
||||
}
|
||||
n->on = on;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
is_traced(name)
|
||||
const char *name;
|
||||
is_traced(const char *name)
|
||||
{
|
||||
struct t *n;
|
||||
|
||||
@ -125,8 +122,7 @@ is_traced(name)
|
||||
}
|
||||
|
||||
void
|
||||
trace_file(name)
|
||||
const char *name;
|
||||
trace_file(const char *name)
|
||||
{
|
||||
|
||||
if (traceout != stderr)
|
||||
@ -137,8 +133,7 @@ trace_file(name)
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
letter_to_flag(c)
|
||||
int c;
|
||||
letter_to_flag(int c)
|
||||
{
|
||||
switch(c) {
|
||||
case 'a':
|
||||
@ -169,8 +164,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;
|
||||
@ -207,8 +201,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)
|
||||
@ -221,10 +214,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) {
|
||||
@ -263,8 +253,7 @@ trace(argv, argc, inp)
|
||||
}
|
||||
|
||||
void
|
||||
finish_trace(mark)
|
||||
size_t mark;
|
||||
finish_trace(size_t mark)
|
||||
{
|
||||
fprintf(traceout, " -> ");
|
||||
if (flags & TRACE_QUOTE)
|
||||
|
Loading…
Reference in New Issue
Block a user