1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Style: kill register and indent properly.

Let indx match netbsd flavor, to simplify diffs.
Show how many quotes were not closed.
Increase stack slightly, now that we're no longer bound by argspace.
This commit is contained in:
espie 1999-09-14 08:35:16 +00:00
parent a4479db320
commit 53f6f6bfbd
8 changed files with 137 additions and 132 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: eval.c,v 1.16 1999/09/14 08:23:09 espie Exp $ */
/* $OpenBSD: eval.c,v 1.17 1999/09/14 08:35: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.16 1999/09/14 08:23:09 espie Exp $";
static char rcsid[] = "$OpenBSD: eval.c,v 1.17 1999/09/14 08:35:16 espie Exp $";
#endif
#endif /* not lint */
@ -86,11 +86,11 @@ static char rcsid[] = "$OpenBSD: eval.c,v 1.16 1999/09/14 08:23:09 espie Exp $";
void
eval(argv, argc, td)
register char *argv[];
register int argc;
register int td;
char *argv[];
int argc;
int td;
{
register int c, n;
int c, n;
static int sysval = 0;
#ifdef DEBUG
@ -392,13 +392,13 @@ char *dumpfmt = "`%s'\t`%s'\n"; /* format string for dumpdef */
*/
void
expand(argv, argc)
register char *argv[];
register int argc;
char *argv[];
int argc;
{
register char *t;
register char *p;
register int n;
register int argno;
char *t;
char *p;
int n;
int argno;
t = argv[0]; /* defn string as a whole */
p = t;
@ -463,10 +463,10 @@ register int argc;
*/
void
dodefine(name, defn)
register char *name;
register char *defn;
char *name;
char *defn;
{
register ndptr p;
ndptr p;
if (!*name)
errx(1, "null definition.");
@ -489,9 +489,9 @@ register char *defn;
*/
void
dodefn(name)
char *name;
char *name;
{
register ndptr p;
ndptr p;
if ((p = lookup(name)) != nil && p->defn != null) {
pbstr(rquote);
@ -509,10 +509,10 @@ char *name;
*/
void
dopushdef(name, defn)
register char *name;
register char *defn;
char *name;
char *defn;
{
register ndptr p;
ndptr p;
if (!*name)
errx(1, "null definition");
@ -533,10 +533,10 @@ register char *defn;
*/
void
dodump(argv, argc)
register char *argv[];
register int argc;
char *argv[];
int argc;
{
register int n;
int n;
ndptr p;
if (argc > 2) {
@ -557,8 +557,8 @@ register int argc;
*/
void
doifelse(argv, argc)
register char *argv[];
register int argc;
char *argv[];
int argc;
{
cycle {
if (STREQ(argv[2], argv[3]))
@ -579,7 +579,7 @@ register int argc;
*/
int
doincl(ifile)
char *ifile;
char *ifile;
{
if (ilevel + 1 == MAXINP)
errx(1, "too many include files.");
@ -598,10 +598,10 @@ char *ifile;
*/
int
dopaste(pfile)
char *pfile;
char *pfile;
{
FILE *pf;
register int c;
int c;
if ((pf = fopen(pfile, "r")) != NULL) {
while ((c = getc(pf)) != EOF)
@ -618,8 +618,8 @@ char *pfile;
*/
void
dochq(argv, argc)
register char *argv[];
register int argc;
char *argv[];
int argc;
{
if (argc > 2) {
if (*argv[2])
@ -644,8 +644,8 @@ register int argc;
*/
void
dochc(argv, argc)
register char *argv[];
register int argc;
char *argv[];
int argc;
{
if (argc > 2) {
if (*argv[2])
@ -668,7 +668,7 @@ register int argc;
*/
void
dodiv(n)
register int n;
int n;
{
int fd;
@ -693,11 +693,11 @@ register int n;
*/
void
doundiv(argv, argc)
register char *argv[];
register int argc;
char *argv[];
int argc;
{
register int ind;
register int n;
int ind;
int n;
if (argc > 2) {
for (ind = 2; ind < argc; ind++) {
@ -718,11 +718,11 @@ register int argc;
*/
void
dosub(argv, argc)
register char *argv[];
register int argc;
char *argv[];
int argc;
{
register char *ap, *fc, *k;
register int nc;
char *ap, *fc, *k;
int nc;
if (argc < 5)
nc = MAXTOK;
@ -770,13 +770,13 @@ register int argc;
*/
void
map(dest, src, from, to)
register char *dest;
register char *src;
register char *from;
register char *to;
char *dest;
char *src;
char *from;
char *to;
{
register char *tmp;
register char sch, dch;
char *tmp;
char sch, dch;
static char mapvec[128] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: expr.c,v 1.6 1999/09/14 08:30:20 espie Exp $ */
/* $OpenBSD: expr.c,v 1.7 1999/09/14 08:35: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.6 1999/09/14 08:30:20 espie Exp $";
static char rcsid[] = "$OpenBSD: expr.c,v 1.7 1999/09/14 08:35:16 espie Exp $";
#endif
#endif /* not lint */
@ -139,9 +139,9 @@ static jmp_buf expjump;
int
expr(expbuf)
char *expbuf;
char *expbuf;
{
register int rval;
int rval;
nxtch = expbuf;
if (setjmp(expjump) != 0)
@ -161,7 +161,7 @@ char *expbuf;
static int
query()
{
register int bool, true_val, false_val;
int bool, true_val, false_val;
bool = lor();
if (skipws() != '?') {
@ -183,7 +183,7 @@ query()
static int
lor()
{
register int c, vl, vr;
int c, vl, vr;
vl = land();
while ((c = skipws()) == '|') {
@ -203,7 +203,7 @@ lor()
static int
land()
{
register int c, vl, vr;
int c, vl, vr;
vl = not();
while ((c = skipws()) == '&') {
@ -223,7 +223,7 @@ land()
static int
not()
{
register int val, c;
int val, c;
if ((c = skipws()) == '!' && getch() != '=') {
ungetch();
@ -243,7 +243,7 @@ not()
static int
eqrel()
{
register int vl, vr, eqrel;
int vl, vr, eqrel;
vl = shift();
while ((eqrel = geteqrel()) != -1) {
@ -281,7 +281,7 @@ eqrel()
static int
shift()
{
register int vl, vr, c;
int vl, vr, c;
vl = primary();
while (((c = skipws()) == '<' || c == '>') && getch() == c) {
@ -305,7 +305,7 @@ shift()
static int
primary()
{
register int c, vl, vr;
int c, vl, vr;
vl = term();
while ((c = skipws()) == '+' || c == '-') {
@ -327,7 +327,7 @@ primary()
static int
term()
{
register int c, vl, vr;
int c, vl, vr;
vl = exp();
while ((c = skipws()) == '*' || c == '/' || c == '%') {
@ -355,7 +355,7 @@ term()
static int
exp()
{
register int c, vl, vr, n;
int c, vl, vr, n;
vl = unary();
switch (c = skipws()) {
@ -384,7 +384,7 @@ exp()
static int
unary()
{
register int val, c;
int val, c;
if ((c = skipws()) == '+' || c == '-' || c == '~') {
val = unary();
@ -409,7 +409,7 @@ unary()
static int
factor()
{
register int val;
int val;
if (skipws() == '(') {
val = query();
@ -429,9 +429,9 @@ factor()
static int
constant()
{
register int i;
register int value;
register int c;
int i;
int value;
int c;
int v[sizeof(int)];
if (skipws() != '\'') {
@ -490,7 +490,7 @@ constant()
static int
num()
{
register int rval, c, base;
int rval, c, base;
int ndig;
rval = 0;
@ -540,7 +540,6 @@ bad_digit:
experr("bad constant");
return rval;
}
/*
@ -549,7 +548,7 @@ bad_digit:
static int
geteqrel()
{
register int c1, c2;
int c1, c2;
c1 = skipws();
c2 = getch();
@ -593,7 +592,7 @@ geteqrel()
static int
skipws()
{
register int c;
int c;
while ((c = getch()) <= ' ' && c > EOS)
;
@ -606,7 +605,7 @@ skipws()
*/
static void
experr(msg)
char *msg;
char *msg;
{
printf("m4: %s in expr.\n", msg);
longjmp(expjump, -1);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: extern.h,v 1.9 1999/09/14 08:21:36 espie Exp $ */
/* $OpenBSD: extern.h,v 1.10 1999/09/14 08:35:16 espie Exp $ */
/* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */
/*-

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gnum4.c,v 1.1 1999/09/14 08:21:36 espie Exp $ */
/* $OpenBSD: gnum4.c,v 1.2 1999/09/14 08:35:16 espie Exp $ */
/*
* Copyright (c) 1999 Marc Espie

View File

@ -1,4 +1,4 @@
/* $OpenBSD: look.c,v 1.3 1999/09/06 13:10:48 espie Exp $ */
/* $OpenBSD: look.c,v 1.4 1999/09/14 08:35:16 espie Exp $ */
/*
* Copyright (c) 1989, 1993
@ -57,9 +57,9 @@ static char sccsid[] = "@(#)look.c 8.1 (Berkeley) 6/6/93";
int
hash(name)
register char *name;
char *name;
{
register unsigned long h = 0;
unsigned long h = 0;
while (*name)
h = (h << 5) + h + *name++;
return (h % HASHSIZE);
@ -70,9 +70,9 @@ register char *name;
*/
ndptr
lookup(name)
char *name;
char *name;
{
register ndptr p;
ndptr p;
for (p = hashtab[hash(name)]; p != nil; p = p->nxtptr)
if (STREQ(name, p->name))
@ -86,9 +86,9 @@ char *name;
*/
ndptr
addent(name)
char *name;
char *name;
{
register int h;
int h;
ndptr p;
h = hash(name);
@ -101,7 +101,7 @@ char *name;
static void
freent(p)
ndptr p;
ndptr p;
{
if (!(p->type & STATIC)) {
free((char *) p->name);
@ -116,11 +116,11 @@ ndptr p;
*/
void
remhash(name, all)
char *name;
int all;
char *name;
int all;
{
register int h;
register ndptr xp, tp, mp;
int h;
ndptr xp, tp, mp;
h = hash(name);
mp = hashtab[h];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.16 1999/09/14 08:30:20 espie Exp $ */
/* $OpenBSD: main.c,v 1.17 1999/09/14 08:35: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.16 1999/09/14 08:30:20 espie Exp $";
static char rcsid[] = "$OpenBSD: main.c,v 1.17 1999/09/14 08:35:16 espie Exp $";
#endif
#endif /* not lint */
@ -146,10 +146,10 @@ main(argc,argv)
int argc;
char *argv[];
{
register int c;
register int n;
int c;
int n;
char *p;
register FILE *ifp;
FILE *ifp;
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, onintr);
@ -263,12 +263,13 @@ do_look_ahead(t, token)
* macro - the work horse..
*/
void
macro() {
macro()
{
char token[MAXTOK], chars[2];
register char *s;
register int t, l;
register ndptr p;
register int nlpar;
char *s;
int t, l;
ndptr p;
int nlpar;
cycle {
t = gpbc();
@ -330,9 +331,12 @@ macro() {
} else if (LOOK_AHEAD(l,lquote)) {
nlpar++;
s = lquote;
} else if (l == EOF)
errx(1, "missing right quote");
else {
} else if (l == EOF) {
if (nlpar == 1)
errx(1, "missing right quote.");
else
errx(1, "missing %d right quotes.", nlpar);
} else {
chars[0] = l;
chars[1] = EOS;
s = chars;
@ -428,13 +432,13 @@ macro() {
*/
ndptr
inspect(tp)
register char *tp;
char *tp;
{
register char c;
register char *name = tp;
register char *etp = tp+MAXTOK;
register ndptr p;
register unsigned long h = 0;
char c;
char *name = tp;
char *etp = tp+MAXTOK;
ndptr p;
unsigned long h = 0;
while ((isalnum(c = gpbc()) || c == '_') && tp < etp)
h = (h << 5) + h + (*tp++ = c);
@ -454,14 +458,15 @@ register char *tp;
* 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
* keyword strings, since we simply use the static pointers
* keyword strings, since we simply use the static pointers
* within keywrds block.
*/
void
initkwds() {
register int i;
register int h;
register ndptr p;
initkwds()
{
size_t i;
int h;
ndptr p;
for (i = 0; i < MAXKEYS; i++) {
h = hash(keywrds[i].knam);
@ -473,3 +478,4 @@ initkwds() {
p->type = keywrds[i].ktyp | STATIC;
}
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mdef.h,v 1.6 1999/09/06 13:29:32 espie Exp $ */
/* $OpenBSD: mdef.h,v 1.7 1999/09/14 08:35:17 espie Exp $ */
/* $NetBSD: mdef.h,v 1.7 1996/01/13 23:25:27 pk Exp $ */
/*
@ -101,7 +101,7 @@
#define MAXOUT 10 /* maximum # of diversions */
#define MAXSTR 512 /* maximum size of string */
#define BUFSIZE 4096 /* starting size of pushback buffer */
#define STACKMAX 1024 /* size of call stack */
#define STACKMAX 4096 /* size of call stack */
#define STRSPMAX 4096 /* starting size of string space */
#define MAXTOK MAXSTR /* maximum chars in a tokn */
#define HASHSIZE 199 /* maximum size of hashtab */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: misc.c,v 1.11 1999/09/14 08:21:37 espie Exp $ */
/* $OpenBSD: misc.c,v 1.12 1999/09/14 08:35:17 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.11 1999/09/14 08:21:37 espie Exp $";
static char rcsid[] = "$OpenBSD: misc.c,v 1.12 1999/09/14 08:35:17 espie Exp $";
#endif
#endif /* not lint */
@ -80,23 +80,23 @@ static void enlarge_strspace();
*/
ptrdiff_t
indx(s1, s2)
const char *s1;
const char *s2;
const char *s1;
const char *s2;
{
char *r;
char *t;
r = strstr(s1, s2);
if (r)
return (r - s1);
else
t = strstr(s1, s2);
if (t == NULL)
return (-1);
else
return (t - s1);
}
/*
* putback - push character back onto input
*/
void
putback(c)
pbent c;
pbent c;
{
if (bp >= endpbb)
enlarge_bufspace();
@ -110,12 +110,12 @@ pbent c;
*/
void
pbstr(s)
register char *s;
char *s;
{
size_t n;
n = strlen(s);
while (endpbb - bp < n)
while (endpbb - bp <= n)
enlarge_bufspace();
while (n > 0)
*bp++ = s[--n];
@ -126,9 +126,9 @@ register char *s;
*/
void
pbnum(n)
int n;
int n;
{
register int num;
int num;
num = (n < 0) ? -n : n;
do {
@ -205,7 +205,7 @@ void enlarge_bufspace()
*/
void
chrsave(c)
char c;
char c;
{
if (ep >= endest)
enlarge_strspace();
@ -233,9 +233,9 @@ compute_prevep()
*/
void
getdiv(n)
int n;
int n;
{
register int c;
int c;
if (active == outfile[n])
errx(1, "undivert: diversion still active");
@ -258,7 +258,7 @@ onintr(signo)
void
killdiv()
{
register int n;
int n;
for (n = 0; n < MAXOUT; n++)
if (outfile[n] != NULL) {
@ -268,9 +268,9 @@ killdiv()
char *
xalloc(n)
unsigned long n;
unsigned long n;
{
register char *p = malloc(n);
char *p = malloc(n);
if (p == NULL)
err(1, "malloc");
@ -279,9 +279,9 @@ unsigned long n;
char *
xstrdup(s)
const char *s;
const char *s;
{
register char *p = strdup(s);
char *p = strdup(s);
if (p == NULL)
err(1, "strdup");
return p;