Kill extraneous whitespace.

This commit is contained in:
Juli Mallett 2002-07-15 02:15:12 +00:00
parent cd8fb74d84
commit 2c4acd2f49
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100014
10 changed files with 90 additions and 90 deletions

View File

@ -119,7 +119,7 @@ eval(const char *argv[], int argc, int td)
ssize_t mark = -1;
expansion_id++;
if (td & RECDEF)
if (td & RECDEF)
errx(1, "%s at line %lu: expanding recursive definition for %s",
CURRENT_NAME, CURRENT_LINE, argv[1]);
if (traced_macros && is_traced(argv[1]))
@ -249,7 +249,7 @@ expand_builtin(const char *argv[], int argc, int td)
/*
* dosysval - return value of the last
* system call.
*
*
*/
pbnum(sysval);
break;
@ -273,7 +273,7 @@ expand_builtin(const char *argv[], int argc, int td)
case PASTTYPE:
if (argc > 2)
if (!dopaste(argv[2]))
err(1, "%s at line %lu: paste(%s)",
err(1, "%s at line %lu: paste(%s)",
CURRENT_NAME, CURRENT_LINE, argv[2]);
break;
@ -299,7 +299,7 @@ expand_builtin(const char *argv[], int argc, int td)
case SUBSTYPE:
/*
* dosub - select substring
*
*
*/
if (argc > 3)
dosub(argv, argc);
@ -375,11 +375,11 @@ expand_builtin(const char *argv[], int argc, int td)
char *temp;
temp = xstrdup(argv[2]);
fd = mkstemp(temp);
if (fd == -1)
err(1,
"%s at line %lu: couldn't make temp file %s",
err(1,
"%s at line %lu: couldn't make temp file %s",
CURRENT_NAME, CURRENT_LINE, argv[2]);
close(fd);
pbstr(temp);
@ -464,7 +464,7 @@ expand_builtin(const char *argv[], int argc, int td)
if (argc > 2)
doindir(argv, argc);
break;
case BUILTINTYPE: /* Builtins only */
if (argc > 2)
dobuiltin(argv, argc);
@ -876,7 +876,7 @@ dodiv(int n)
if (outfile[n] == NULL) {
char fname[] = _PATH_DIVNAME;
if ((fd = mkstemp(fname)) < 0 ||
if ((fd = mkstemp(fname)) < 0 ||
(outfile[n] = fdopen(fd, "w+")) == NULL)
err(1, "%s: cannot divert", fname);
if (unlink(fname) == -1)
@ -1003,7 +1003,7 @@ map(char *dest, const char *src, const char *from, const char *to)
* "to"
*/
while (*from)
mapvec[(unsigned char)(*from++)] = (*to) ?
mapvec[(unsigned char)(*from++)] = (*to) ?
(unsigned char)(*to++) : 0;
while (*src) {
@ -1037,12 +1037,12 @@ static const char *
handledash(char *buffer, char *end, const char *src)
{
char *p;
p = buffer;
while(*src) {
if (src[1] == '-' && src[2]) {
unsigned char i;
for (i = (unsigned char)src[0];
for (i = (unsigned char)src[0];
i <= (unsigned char)src[2]; i++) {
*p++ = i;
if (p == end) {

View File

@ -525,10 +525,10 @@ num(void)
for(;;) {
switch(c) {
case '8': case '9':
if (base == OCTAL)
if (base == OCTAL)
goto bad_digit;
/*FALLTHRU*/
case '0': case '1': case '2': case '3':
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
rval *= base;
rval += c - '0';
@ -550,10 +550,10 @@ num(void)
}
bad_digit:
ungetch();
if (ndig == 0)
experr("bad constant");
return rval;
}
@ -615,7 +615,7 @@ skipws(void)
}
/*
* resets environment to eval(), prints an error
* resets environment to eval(), prints an error
* and forces eval to return FALSE.
*/
static void

View File

@ -60,7 +60,7 @@ extern void doprintlineno(struct input_file *);
extern void doprintfilename(struct input_file *);
extern void doesyscmd(const char *);
/* look.c */
extern ndptr addent(const char *);
@ -104,7 +104,7 @@ extern void release_input(struct input_file *);
enlarge_bufspace(); \
*bp++ = (c); \
} while(0)
#define CHRSAVE(c) \
do { \
if (ep >= endest) \
@ -162,7 +162,7 @@ static __inline int gpbc(void)
int chscratch; /* Scratch space. */
if (bp > bufbase) {
if (*--bp)
if (*--bp)
return ((unsigned char)*bp);
else
return (EOF);

View File

@ -28,7 +28,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
/*
* functions needed to support gnu-m4 extensions, including a fake freezing
*/
@ -83,8 +83,8 @@ new_path_entry(const char *dirname)
n->next = 0;
return n;
}
void
void
addtoincludepath(const char *dirname)
{
struct path_entry *n;
@ -111,13 +111,13 @@ ensure_m4path(void)
return;
envpathdone = TRUE;
envpath = getenv("M4PATH");
if (!envpath)
if (!envpath)
return;
/* for portability: getenv result is read-only */
envpath = strdup(envpath);
if (!envpath)
errx(1, "out of memory");
for (sweep = envpath;
for (sweep = envpath;
(path = strsep(&sweep, ":")) != NULL;)
addtoincludepath(path);
free(envpath);
@ -159,7 +159,7 @@ fopen_trypath(struct input_file *i, const char *filename)
return dopath(i, filename);
}
void
void
doindir(const char *argv[], int argc)
{
ndptr p;
@ -171,7 +171,7 @@ doindir(const char *argv[], int argc)
eval(argv+1, argc-1, p->type);
}
void
void
dobuiltin(const char *argv[], int argc)
{
int n;
@ -181,7 +181,7 @@ dobuiltin(const char *argv[], int argc)
eval(argv+1, argc-1, n);
else
errx(1, "unknown builtin %s", argv[2]);
}
}
/* We need some temporary buffer space, as pb pushes BACK and substitution
@ -202,7 +202,7 @@ static void add_sub(size_t, const char *, regex_t *, regmatch_t *);
static void add_replace(const char *, regex_t *, const char *, regmatch_t *);
#define addconstantstring(s) addchars((s), sizeof(s)-1)
static void
static void
addchars(const char *c, size_t n)
{
if (n == 0)
@ -220,7 +220,7 @@ addchars(const char *c, size_t n)
current += n;
}
static void
static void
addchar(int c)
{
if (current +1 > bufsize) {
@ -244,7 +244,7 @@ getstring(void)
}
static void
static void
exit_regerror(int er, regex_t *re)
{
size_t errlen;
@ -273,7 +273,7 @@ add_sub(size_t n, const char *string, regex_t *re, regmatch_t *pm)
/* Add replacement string to the output buffer, recognizing special
* constructs and replacing them with substrings of the original string.
*/
static void
static void
add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
{
const char *p;
@ -306,7 +306,7 @@ add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm
}
}
static void
static void
do_subst(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
{
int error;
@ -321,11 +321,11 @@ do_subst(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
flags = REG_NOTBOL;
}
/* NULL length matches are special... We use the `vi-mode'
/* NULL length matches are special... We use the `vi-mode'
* rule: don't allow a NULL-match at the last match
* position.
* position.
*/
if (pm[0].rm_so == pm[0].rm_eo &&
if (pm[0].rm_so == pm[0].rm_eo &&
string + pm[0].rm_so == last_match) {
if (*string == '\0')
return;
@ -346,13 +346,13 @@ do_subst(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
pbstr(string);
}
static void
static void
do_regexp(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
{
int error;
switch(error = regexec(re, string, re->re_nsub+1, pm, 0)) {
case 0:
case 0:
add_replace(string, re, replace, pm);
pbstr(getstring());
break;
@ -363,7 +363,7 @@ do_regexp(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
}
}
static void
static void
do_regexpindex(const char *string, regex_t *re, regmatch_t *pm)
{
int error;
@ -439,13 +439,13 @@ dopatsubst(const char *argv[], int argc)
warnx("Too few arguments to patsubst");
return;
}
error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3],
error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3],
REG_NEWLINE | REG_EXTENDED);
if (error != 0)
exit_regerror(error, &re);
pmatch = xalloc(sizeof(regmatch_t) * (re.re_nsub+1));
do_subst(argv[2], &re,
do_subst(argv[2], &re,
argc != 4 && argv[4] != NULL ? argv[4] : "", pmatch);
pbstr(getstring());
free(pmatch);
@ -463,11 +463,11 @@ doregexp(const char *argv[], int argc)
warnx("Too few arguments to regexp");
return;
}
error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3],
error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3],
REG_EXTENDED);
if (error != 0)
exit_regerror(error, &re);
pmatch = xalloc(sizeof(regmatch_t) * (re.re_nsub+1));
if (argv[4] == NULL || argc == 4)
do_regexpindex(argv[2], &re, pmatch);

View File

@ -74,7 +74,7 @@ hash(const char *name)
/*
* find name in the hash table
*/
ndptr
ndptr
lookup(const char *name)
{
ndptr p;
@ -91,7 +91,7 @@ lookup(const char *name)
* hash and create an entry in the hash table.
* The new entry is added in front of a hash bucket.
*/
ndptr
ndptr
addent(const char *name)
{
unsigned int h;

View File

@ -147,7 +147,7 @@ struct keyblk keywrds[] = { /* m4 keywords to be installed */
{ "traceon", TRACEONTYPE | NOARGS },
{ "traceoff", TRACEOFFTYPE | NOARGS },
#if defined(unix) || defined(__unix__)
#if defined(unix) || defined(__unix__)
{ "unix", SELFTYPE | NOARGS },
#else
#ifdef vms
@ -261,7 +261,7 @@ main(int argc, char *argv[])
continue;
}
sp = -1;
fp = 0;
fp = 0;
if ((inname[0] = strdup(p)) == NULL)
err(1, NULL);
inlineno[0] = 1;
@ -337,7 +337,7 @@ macro(void)
p = inspect(t, token);
if (p != nil)
putback(l = gpbc());
if (p == nil || (l != LPAREN &&
if (p == nil || (l != LPAREN &&
(p->type & NEEDARGS) != 0))
outputstr(token);
else {
@ -355,13 +355,13 @@ macro(void)
pushs1(p->name); /* macro name */
pushs(ep); /* start next..*/
if (l != LPAREN && PARLEV == 0) {
if (l != LPAREN && PARLEV == 0) {
/* no bracks */
chrsave(EOS);
if ((uintptr_t)sp == STACKMAX)
errx(1, "internal stack overflow");
eval((const char **) mstack+fp+1, 2,
eval((const char **) mstack+fp+1, 2,
CALTYP);
ep = PREVEP; /* flush strspace */
@ -461,7 +461,7 @@ macro(void)
if ((uintptr_t)sp == STACKMAX)
errx(1, "internal stack overflow");
eval((const char **) mstack+fp+1, sp-fp,
eval((const char **) mstack+fp+1, sp-fp,
CALTYP);
ep = PREVEP; /* flush strspace */
@ -504,8 +504,8 @@ macro(void)
}
}
/*
* output string directly, without pushing it for reparses.
/*
* output string directly, without pushing it for reparses.
*/
void
outputstr(const char *s)
@ -524,13 +524,13 @@ outputstr(const char *s)
* combo with lookup to speed things up.
*/
static ndptr
inspect(int c, char *tp)
inspect(int c, char *tp)
{
char *name = tp;
char *etp = tp+MAXTOK;
ndptr p;
unsigned int h;
h = *tp++ = c;
while ((isalnum(c = gpbc()) || c == '_') && tp < etp)
@ -559,9 +559,9 @@ inspect(int c, char *tp)
}
/*
* initkwds - initialise m4 keywords as fast as possible.
* initkwds - initialise m4 keywords as fast as possible.
* This very similar to install, but without certain overheads,
* such as calling lookup. Malloc is not used for storing the
* such as calling lookup. Malloc is not used for storing the
* keyword strings, since we simply use the static pointers
* within keywrds block.
*/
@ -587,7 +587,7 @@ initkwds(void)
}
/* Look up a builtin type, even if overridden by the user */
int
int
builtin_type(const char *key)
{
int i;
@ -628,20 +628,20 @@ dump_stack(struct position *t, int lev)
fprintf(stderr, " ...\n");
break;
}
fprintf(stderr, " %s at line %lu\n",
fprintf(stderr, " %s at line %lu\n",
t[i].name, t[i].line);
}
}
static void
static void
enlarge_stack(void)
{
STACKMAX *= 2;
mstack = realloc(mstack, sizeof(stae) * STACKMAX);
sstack = realloc(sstack, STACKMAX);
if (mstack == NULL || sstack == NULL)
errx(1, "Evaluation stack overflow (%lu)",
errx(1, "Evaluation stack overflow (%lu)",
(unsigned long)STACKMAX);
}

View File

@ -84,7 +84,7 @@
#define TRACEONTYPE 42
#define TRACEOFFTYPE 43
#define TYPEMASK 63 /* Keep bits really corresponding to a type. */
#define RECDEF 256 /* Pure recursive def, don't expand it */
#define NOARGS 512 /* builtin needs no args */
@ -93,7 +93,7 @@
/*
* m4 special characters
*/
#define ARGFLAG '$'
#define LPAREN '('
#define RPAREN ')'
@ -120,10 +120,10 @@
#define MAXTOK 512 /* maximum chars in a tokn */
#define HASHSIZE 199 /* maximum size of hashtab */
#define MAXCCHARS 5 /* max size of comment/quote delim */
#define ALL 1
#define TOP 0
#define TRUE 1
#define FALSE 0
#define cycle for(;;)
@ -131,9 +131,9 @@
/*
* m4 data structures
*/
typedef struct ndblock *ndptr;
struct ndblock { /* hastable structure */
char *name; /* entry name.. */
char *defn; /* definition.. */
@ -141,9 +141,9 @@ struct ndblock { /* hastable structure */
unsigned int hv; /* hash function value.. */
ndptr nxtptr; /* link to next entry.. */
};
#define nil ((ndptr) 0)
struct keyblk {
const char *knam; /* keyword name */
int ktyp; /* keyword type */

View File

@ -151,7 +151,7 @@ pbunsigned(unsigned long n)
while ((n /= 10) > 0);
}
void
void
initspaces(void)
{
int i;
@ -167,7 +167,7 @@ initspaces(void)
bbase[i] = buf;
}
void
void
enlarge_strspace(void)
{
char *newstrspace;
@ -178,9 +178,9 @@ enlarge_strspace(void)
if (!newstrspace)
errx(1, "string space overflow");
memcpy(newstrspace, strspace, strsize/2);
for (i = 0; i <= sp; i++)
for (i = 0; i <= sp; i++)
if (sstack[i])
mstack[i].sstr = (mstack[i].sstr - strspace)
mstack[i].sstr = (mstack[i].sstr - strspace)
+ newstrspace;
ep = (ep-strspace) + newstrspace;
free(strspace);
@ -212,7 +212,7 @@ enlarge_bufspace(void)
void
chrsave(int c)
{
if (ep >= endest)
if (ep >= endest)
enlarge_strspace();
*ep++ = c;
}
@ -299,7 +299,7 @@ usage(void)
exit(1);
}
int
int
obtain_char(struct input_file *f)
{
if (f->c == EOF)
@ -311,7 +311,7 @@ obtain_char(struct input_file *f)
return f->c;
}
void
void
set_input(struct input_file *f, FILE *real, const char *name)
{
f->file = real;
@ -320,14 +320,14 @@ set_input(struct input_file *f, FILE *real, const char *name)
f->name = xstrdup(name);
}
void
void
release_input(struct input_file *f)
{
if (f->file != stdin)
fclose(f->file);
f->c = EOF;
/*
* XXX can't free filename, as there might still be
* XXX can't free filename, as there might still be
* error information pointing to it.
*/
}
@ -346,7 +346,7 @@ doprintfilename(struct input_file *f)
pbstr(lquote);
}
/*
/*
* buffer_mark/dump_buffer: allows one to save a mark in a buffer,
* and later dump everything that was added since then to a file.
*/

View File

@ -49,9 +49,9 @@
#define iswhite(c) ((c) == ' ' || (c) == '\t')
/*
* STREQ is an optimised strcmp(a,b)==0
* STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0
/*
* STREQ is an optimised strcmp(a,b)==0
* STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0
*/
#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
#define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)

View File

@ -109,7 +109,7 @@ mark_traced(const char *name, int on)
}
}
int
int
is_traced(const char *name)
{
struct t *n;
@ -193,7 +193,7 @@ frame_level(void)
int level;
int framep;
for (framep = fp, level = 0; framep != 0;
for (framep = fp, level = 0; framep != 0;
level++,framep = mstack[framep-2].sfra)
;
return level;
@ -212,7 +212,7 @@ print_header(struct input_file *inp)
fprintf(traceout, "id %lu: ", expansion_id);
}
ssize_t
ssize_t
trace(const char *argv[], int argc, struct input_file *inp)
{
print_header(inp);
@ -228,9 +228,9 @@ trace(const char *argv[], int argc, struct input_file *inp)
delim[0] = LPAREN;
delim[1] = EOS;
for (i = 2; i < argc; i++) {
fprintf(traceout, "%s%s%s%s", delim,
(flags & TRACE_QUOTE) ? lquote : "",
argv[i],
fprintf(traceout, "%s%s%s%s", delim,
(flags & TRACE_QUOTE) ? lquote : "",
argv[i],
(flags & TRACE_QUOTE) ? rquote : "");
delim[0] = COMMA;
delim[1] = ' ';
@ -251,7 +251,7 @@ trace(const char *argv[], int argc, struct input_file *inp)
}
}
void
void
finish_trace(size_t mark)
{
fprintf(traceout, " -> ");