zap trailing whitespace and tabs

This commit is contained in:
purplerain 2023-09-16 04:38:16 +00:00
parent 8b897ac235
commit 2990d002be
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
179 changed files with 992 additions and 992 deletions

View File

@ -549,7 +549,7 @@ slot_mix_badd(struct slot *s, adata_t *odata)
odone = 0; odone = 0;
otodo = dev_round; otodo = dev_round;
if (s->skip > 0) { if (s->skip > 0) {
ocnt = otodo; ocnt = otodo;
if (ocnt > s->skip) if (ocnt > s->skip)
ocnt = s->skip; ocnt = s->skip;

View File

@ -626,7 +626,7 @@ int input(void) /* get next lexical input character */
void unput(int c) /* put lexical character back on input */ void unput(int c) /* put lexical character back on input */
{ {
if (c == '\n') if (c == '\n')
lineno--; lineno--;
if (yysptr >= yysbuf + sizeof(yysbuf)) if (yysptr >= yysbuf + sizeof(yysbuf))
FATAL("pushed back too much: %.20s...", yysbuf); FATAL("pushed back too much: %.20s...", yysbuf);

View File

@ -2292,7 +2292,7 @@ Cell *gensub(Node **a, int nnn) /* global selective substitute */
FATAL("gensub doesn't support backreferences (subst \"%s\")", rptr); FATAL("gensub doesn't support backreferences (subst \"%s\")", rptr);
} }
} }
do { do {
if (whichm >= 0 && whichm != num) { if (whichm >= 0 && whichm != num) {
num++; num++;

View File

@ -5,17 +5,17 @@
* Changes for banner(1) * Changes for banner(1)
* *
* @(#)Copyright (c) 1995, Simon J. Gerraty. * @(#)Copyright (c) 1995, Simon J. Gerraty.
* *
* This is free software. It comes with NO WARRANTY. * This is free software. It comes with NO WARRANTY.
* Permission to use, modify and distribute this source code * Permission to use, modify and distribute this source code
* is granted subject to the following conditions. * is granted subject to the following conditions.
* 1/ that the above copyright notice and this notice * 1/ that the above copyright notice and this notice
* are preserved in all copies and that due credit be given * are preserved in all copies and that due credit be given
* to the author. * to the author.
* 2/ that any changes to this code are clearly commented * 2/ that any changes to this code are clearly commented
* as such so that the author does not get blamed for bugs * as such so that the author does not get blamed for bugs
* other than his own. * other than his own.
* *
* Please send copies of changes and bug-fixes to: * Please send copies of changes and bug-fixes to:
* sjg@zen.void.oz.au * sjg@zen.void.oz.au
*/ */
@ -72,7 +72,7 @@ scnline(int key, char *p, int c)
* banner(1) does is more consistent. * banner(1) does is more consistent.
*/ */
c = '#'; c = '#';
for (scnwidth = WIDTH; --scnwidth;) { for (scnwidth = WIDTH; --scnwidth;) {
key <<= 1; key <<= 1;
*p++ = key & 0200 ? c : BACKGND; *p++ = key & 0200 ? c : BACKGND;
@ -135,7 +135,7 @@ scan_out(int scfd, char *scsp, int dlm)
while (*--strp == BACKGND && strp >= outbuf) while (*--strp == BACKGND && strp >= outbuf)
; ;
strp++; strp++;
*strp++ = '\n'; *strp++ = '\n';
(void) write(scfd, outbuf, strp-outbuf); (void) write(scfd, outbuf, strp-outbuf);
} }
} }
@ -147,7 +147,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char word[10+1]; /* strings limited to 10 chars */ char word[10+1]; /* strings limited to 10 chars */
if (pledge("stdio", NULL) == -1) if (pledge("stdio", NULL) == -1)
err(1, "pledge"); err(1, "pledge");

View File

@ -3,19 +3,19 @@
/* /*
* Various defines needed for code lifted from lpd. * Various defines needed for code lifted from lpd.
* *
* @(#)Copyright (c) 1995, Simon J. Gerraty. * @(#)Copyright (c) 1995, Simon J. Gerraty.
* *
* This is free software. It comes with NO WARRANTY. * This is free software. It comes with NO WARRANTY.
* Permission to use, modify and distribute this source code * Permission to use, modify and distribute this source code
* is granted subject to the following conditions. * is granted subject to the following conditions.
* 1/ that the above copyright notice and this notice * 1/ that the above copyright notice and this notice
* are preserved in all copies and that due credit be given * are preserved in all copies and that due credit be given
* to the author. * to the author.
* 2/ that any changes to this code are clearly commented * 2/ that any changes to this code are clearly commented
* as such so that the author does not get blamed for bugs * as such so that the author does not get blamed for bugs
* other than his own. * other than his own.
* *
* Please send copies of changes and bug-fixes to: * Please send copies of changes and bug-fixes to:
* sjg@zen.void.oz.au * sjg@zen.void.oz.au
*/ */

View File

@ -4,17 +4,17 @@
/* /*
* Changes for banner(1) * Changes for banner(1)
* @(#)Copyright (c) 1995, Simon J. Gerraty. * @(#)Copyright (c) 1995, Simon J. Gerraty.
* *
* This is free software. It comes with NO WARRANTY. * This is free software. It comes with NO WARRANTY.
* Permission to use, modify and distribute this source code * Permission to use, modify and distribute this source code
* is granted subject to the following conditions. * is granted subject to the following conditions.
* 1/ that the above copyright notice and this notice * 1/ that the above copyright notice and this notice
* are preserved in all copies and that due credit be given * are preserved in all copies and that due credit be given
* to the author. * to the author.
* 2/ that any changes to this code are clearly commented * 2/ that any changes to this code are clearly commented
* as such so that the author does not get blamed for bugs * as such so that the author does not get blamed for bugs
* other than his own. * other than his own.
* *
* Please send copies of changes and bug-fixes to: * Please send copies of changes and bug-fixes to:
* sjg@zen.void.oz.au * sjg@zen.void.oz.au
*/ */
@ -187,7 +187,7 @@
char scnkey[][HEIGHT] = /* this is relatively easy to modify */ char scnkey[][HEIGHT] = /* this is relatively easy to modify */
/* just look: */ /* just look: */
{ {
/* <sjg> this is the real banner char set */ /* <sjg> this is the real banner char set */
{ {
c_______, c_______,

View File

@ -52,7 +52,7 @@ tstpcont(int sig)
if (sig == SIGTSTP) { if (sig == SIGTSTP) {
signal(SIGCONT, tstpcont); signal(SIGCONT, tstpcont);
gettty(&ttyedit); gettty(&ttyedit);
settty(&ttysaved); settty(&ttysaved);
} else { } else {
signal(SIGTSTP, tstpcont); signal(SIGTSTP, tstpcont);
settty(&ttyedit); settty(&ttyedit);

View File

@ -248,7 +248,7 @@ week(int day, int month, int year)
int firstday; int firstday;
int firstsunday; int firstsunday;
int shift; int shift;
if (mflag) if (mflag)
return isoweek(day, month, year); return isoweek(day, month, year);
@ -261,7 +261,7 @@ week(int day, int month, int year)
shift = 1; shift = 1;
if (yearday < firstsunday) if (yearday < firstsunday)
return (1); return (1);
if (firstweekday > THURSDAY - 1) if (firstweekday > THURSDAY - 1)
shift = 2; shift = 2;
return ((((yearday + 1) - (weekday - 1)) / 7) + shift); return ((((yearday + 1) - (weekday - 1)) / 7) + shift);
} }
@ -291,7 +291,7 @@ isoweek(int day, int month, int year)
return 53 - (g - s) / 5; return 53 - (g - s) / 5;
else if (n > 364 + s) else if (n > 364 + s)
return 1; return 1;
else else
return n/7 + 1; return n/7 + 1;
} }
@ -388,7 +388,7 @@ yearly(int year)
for (row = 0; row < 6; row++) { for (row = 0; row < 6; row++) {
for (which_cal = 0; which_cal < 3; which_cal++) { for (which_cal = 0; which_cal < 3; which_cal++) {
p = lineout + which_cal * (week_len + 2); p = lineout + which_cal * (week_len + 2);
dp = &days[month + which_cal][row * 7]; dp = &days[month + which_cal][row * 7];
firstday = SPACE; firstday = SPACE;
for (col = 0; col < 7; col++, p += DAY_LEN) { for (col = 0; col < 7; col++, p += DAY_LEN) {

View File

@ -24,7 +24,7 @@
04/17 An unexpected party (LOTR) 04/17 An unexpected party (LOTR)
04/23 Crowning of King Ellesar (LOTR) 04/23 Crowning of King Ellesar (LOTR)
05/19 Arwen leaves Lorien to wed King Ellesar (LOTR) 05/19 Arwen leaves Lorien to wed King Ellesar (LOTR)
05/25 Towel Day (The Hitchhiker's Guide to the Galaxy) 05/25 Towel Day (The Hitchhiker's Guide to the Galaxy)
06/11 Sauron attacks Osgilliath (LOTR) 06/11 Sauron attacks Osgilliath (LOTR)
06/13 Bilbo returns to Bag End (LOTR) 06/13 Bilbo returns to Bag End (LOTR)
06/23 Wedding of Ellesar & Arwen (LOTR) 06/23 Wedding of Ellesar & Arwen (LOTR)

View File

@ -450,7 +450,7 @@
11/21 Birmingham Pub Bombings by the IRA kill 21 people, 1974 11/21 Birmingham Pub Bombings by the IRA kill 21 people, 1974
11/22 John F. Kennedy is assassinated in Dallas, Texas, 1963 11/22 John F. Kennedy is assassinated in Dallas, Texas, 1963
11/23 The first edition of Life is published. 1936 11/23 The first edition of Life is published. 1936
11/24 Alleged assassin Lee Harvey Oswald is killed by 11/24 Alleged assassin Lee Harvey Oswald is killed by
Jack Ruby in Dallas, Texas, 1963 Jack Ruby in Dallas, Texas, 1963
11/25 Alfred Nobel invents dynamite, 1867 11/25 Alfred Nobel invents dynamite, 1867
11/26 Last flight ever with a Concorde made over Bristol, UK, 2003 11/26 Last flight ever with a Concorde made over Bristol, UK, 2003

View File

@ -333,7 +333,7 @@
08/12 Maurice Greene is born in London, 1696 08/12 Maurice Greene is born in London, 1696
08/12 Leos Janacek dies in Ostrava, Czechoslovakia, 1928 08/12 Leos Janacek dies in Ostrava, Czechoslovakia, 1928
08/13 Dan Fogelberg is born in Peoria, Illinois, 1951 08/13 Dan Fogelberg is born in Peoria, Illinois, 1951
08/13 The Bayreuth Festspielhaus opens with the first complete 08/13 The Bayreuth Festspielhaus opens with the first complete
performance of Wagner's "Ring Cycle", 1876 performance of Wagner's "Ring Cycle", 1876
08/13 John Ireland is born, 1879 08/13 John Ireland is born, 1879
08/13 Jules Emile Frederic Massenet dies, 1912 08/13 Jules Emile Frederic Massenet dies, 1912
@ -520,7 +520,7 @@
12/18 Horatio Parker dies in Cedarhurst, New York, 1919 12/18 Horatio Parker dies in Cedarhurst, New York, 1919
12/21 Frank Zappa is born in Baltimore, 1940 12/21 Frank Zappa is born in Baltimore, 1940
12/21 Silvestre Revueltas born in Santiago Papasquiaro, Durango, Mexico, 1899 12/21 Silvestre Revueltas born in Santiago Papasquiaro, Durango, Mexico, 1899
12/22 Beethoven's Symphony No. 5 and Symphony No. 6 premier, under 12/22 Beethoven's Symphony No. 5 and Symphony No. 6 premier, under
rehearsed, at Theater an der Wien in Vienna, Austria, 1808 rehearsed, at Theater an der Wien in Vienna, Austria, 1808
12/22 Edgard Varese is born in France, 1883 12/22 Edgard Varese is born in France, 1883
12/22 Jean-Joseph Mouret dies in Charenton, France, 1738 12/22 Jean-Joseph Mouret dies in Charenton, France, 1738

View File

@ -30,7 +30,7 @@ Easter+39 Christi Himmelfahrt
03/21* Frühlingsanfang 03/21* Frühlingsanfang
06/21* Sommeranfang 06/21* Sommeranfang
09/21* Herbstanfang 09/21* Herbstanfang
12/21* Winteranfang 12/21* Winteranfang
/* Sommer- und Winterzeit */ /* Sommer- und Winterzeit */
03/SundayLast Anfang der Sommerzeit 03/SundayLast Anfang der Sommerzeit

View File

@ -12,8 +12,8 @@ LANG=hr_HR.UTF-8
/* slobodni državni praznici */ /* slobodni državni praznici */
01/01 Nova godina 01/01 Nova godina
05/01 Prvi maj 05/01 Prvi maj
/* slobodni kršćanski praznici */ /* slobodni kršćanski praznici */
Easter-2 Veliki petak Easter-2 Veliki petak
Easter Uskrs Easter Uskrs
@ -29,7 +29,7 @@ Easter+39 Uzašašće
06/21* Početak ljeta 06/21* Početak ljeta
09/21* Početak jesena 09/21* Početak jesena
12/21* Početak zime 12/21* Početak zime
/* ljetno vrijeme */ /* ljetno vrijeme */
03/SundayLast Početak ljetnog vremena 03/SundayLast Početak ljetnog vremena
10/SundayLast Kraj ljetnog vremena 10/SundayLast Kraj ljetnog vremena

View File

@ -219,7 +219,7 @@ CALENDAR=julian
на овес с ячменем. Пронеси, Господи, Калиника мороком, а не морозом. на овес с ячменем. Пронеси, Господи, Калиника мороком, а не морозом.
07/30 Силин день. На Силы и Селуяна рожь бывает пьяна (т.е. полна зерном 07/30 Силин день. На Силы и Селуяна рожь бывает пьяна (т.е. полна зерном
и клонится к земле). На Силу рожь посеянная родится сильно, а и клонится к земле). На Силу рожь посеянная родится сильно, а
ведьмы обмирают, опившись молока. ведьмы обмирают, опившись молока.
08/01 Первый, мокрый, медовый Спас. Пчелиный праздник. На Маковея собирают 08/01 Первый, мокрый, медовый Спас. Пчелиный праздник. На Маковея собирают
мак. Дождь на Маковея - мало пожаров. Во что Маковея, в то и мак. Дождь на Маковея - мало пожаров. Во что Маковея, в то и

View File

@ -38,7 +38,7 @@ struct track_info {
char *file; char *file;
SLIST_ENTRY(track_info) track_list; SLIST_ENTRY(track_info) track_list;
char type; char type;
int speed; int speed;
}; };
SLIST_HEAD(track_head, track_info); SLIST_HEAD(track_head, track_info);
extern struct track_head tracks; extern struct track_head tracks;

View File

@ -133,7 +133,7 @@ main(int argc, char *argv[])
max_bufd_lines = strtonum(optarg, 1, max_bufd_lines = strtonum(optarg, 1,
(INT_MAX - BUFFER_MARGIN) / 2, &errstr) * 2; (INT_MAX - BUFFER_MARGIN) / 2, &errstr) * 2;
if (errstr != NULL) if (errstr != NULL)
errx(1, "bad -l argument, %s: %s", errstr, errx(1, "bad -l argument, %s: %s", errstr,
optarg); optarg);
break; break;
case 'x': /* do not compress spaces into tabs */ case 'x': /* do not compress spaces into tabs */

View File

@ -113,7 +113,7 @@ main(int argc, char *argv[])
putchar('\b'); putchar('\b');
if (width > 1 && p[1] == '\b') if (width > 1 && p[1] == '\b')
putchar('\b'); putchar('\b');
} }
if (width > 1 && p[1] == '\b') if (width > 1 && p[1] == '\b')
p++; p++;
column -= width; column -= width;

View File

@ -83,4 +83,4 @@ extern int null_write(void *, const char *, int);
extern int null_close(void *, struct z_info *, const char *, struct stat *); extern int null_close(void *, struct z_info *, const char *, struct stat *);
extern int null_flush(void *, int); extern int null_flush(void *, int);
extern void setfile(const char *, int, struct stat *); extern void setfile(const char *, int, struct stat *);

View File

@ -463,5 +463,5 @@ do_lineno(const char *expr)
if (reps-- == 0) if (reps-- == 0)
break; break;
lastline += tgtline; lastline += tgtline;
} }
} }

View File

@ -246,7 +246,7 @@ endtok: if (sp > tok) {
/* hell... truncate it */ /* hell... truncate it */
if (sp == tok + sizeof tok - 1) if (sp == tok + sizeof tok - 1)
*sp = EOS; *sp = EOS;
else else
*sp++ = c; *sp++ = c;
token = YES; token = YES;
} }
@ -385,7 +385,7 @@ hash_entry(void)
/* hell... truncate it */ /* hell... truncate it */
if (sp == tok + sizeof tok - 1) if (sp == tok + sizeof tok - 1)
*sp = EOS; *sp = EOS;
else else
*sp++ = c; *sp++ = c;
} }
*sp = EOS; *sp = EOS;
@ -401,7 +401,7 @@ hash_entry(void)
/* hell... truncate it */ /* hell... truncate it */
if (sp == tok + sizeof tok - 1) if (sp == tok + sizeof tok - 1)
*sp = EOS; *sp = EOS;
else else
*sp++ = c; *sp++ = c;
if (GETC(==, EOF)) if (GETC(==, EOF))
return; return;
@ -446,7 +446,7 @@ str_entry(int c)
/* hell... truncate it */ /* hell... truncate it */
if (sp == tok + sizeof tok - 1) if (sp == tok + sizeof tok - 1)
*sp = EOS; *sp = EOS;
else else
*sp++ = c; *sp++ = c;
if (GETC(==, EOF)) if (GETC(==, EOF))
return (NO); return (NO);

View File

@ -837,7 +837,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
struct msghdr msghdr; struct msghdr msghdr;
char m[RECVCMSGBUFLEN]; char m[RECVCMSGBUFLEN];
} cmsgbuf; } cmsgbuf;
memset(&cmsgbuf, 0, sizeof(cmsgbuf)); memset(&cmsgbuf, 0, sizeof(cmsgbuf));
build_msghdr_recv(sock, cmsgbuf.m, dev, &msghdr, iov, &read_count); build_msghdr_recv(sock, cmsgbuf.m, dev, &msghdr, iov, &read_count);
@ -997,7 +997,7 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
struct msghdr msghdr; struct msghdr msghdr;
char m[SENDCMSGBUFLEN]; char m[SENDCMSGBUFLEN];
} cmsgbuf; } cmsgbuf;
memset(&cmsgbuf, 0, sizeof(cmsgbuf)); memset(&cmsgbuf, 0, sizeof(cmsgbuf));
build_msghdr_send(sock, cmsgbuf.m, dev, &msghdr, iov, &write_count); build_msghdr_send(sock, cmsgbuf.m, dev, &msghdr, iov, &write_count);

View File

@ -166,7 +166,7 @@ main(int argc, char *argv[])
case FTS_D: /* Ignore. */ case FTS_D: /* Ignore. */
break; break;
case FTS_DP: case FTS_DP:
p->fts_parent->fts_number += p->fts_parent->fts_number +=
p->fts_number += p->fts_statp->st_blocks; p->fts_number += p->fts_statp->st_blocks;
if (cflag) if (cflag)
totalblocks += p->fts_statp->st_blocks; totalblocks += p->fts_statp->st_blocks;

View File

@ -61,7 +61,7 @@ struct macro {
}; };
/* /*
* FCode header -- assumes big-endian machine, * FCode header -- assumes big-endian machine,
* otherwise the bits need twiddling. * otherwise the bits need twiddling.
*/ */
struct fcode_header { struct fcode_header {
@ -72,21 +72,21 @@ struct fcode_header {
}; };
/* Tokenizer tokens */ /* Tokenizer tokens */
enum toktypes { enum toktypes {
TOK_OCTAL = 8, TOK_OCTAL = 8,
TOK_DECIMAL = 10, TOK_DECIMAL = 10,
TOK_HEX = 16, TOK_HEX = 16,
TOK_NUMBER, TOK_NUMBER,
TOK_STRING_LIT, TOK_STRING_LIT,
TOK_C_LIT, TOK_C_LIT,
TOK_PSTRING, TOK_PSTRING,
TOK_TOKENIZE, TOK_TOKENIZE,
TOK_COMMENT, TOK_COMMENT,
TOK_COLON, TOK_COLON,
TOK_SEMICOLON, TOK_SEMICOLON,
TOK_TOSTRING, TOK_TOSTRING,
/* These are special */ /* These are special */
TOK_ABORT_S, TOK_ABORT_S,
TOK_AGAIN, TOK_AGAIN,

View File

@ -2,7 +2,7 @@
/* $OpenBSD: fgen.l,v 1.15 2022/12/26 19:16:00 jmc Exp $ */ /* $OpenBSD: fgen.l,v 1.15 2022/12/26 19:16:00 jmc Exp $ */
/* $NetBSD: fgen.l,v 1.37 2016/03/08 20:13:44 christos Exp $ */ /* $NetBSD: fgen.l,v 1.37 2016/03/08 20:13:44 christos Exp $ */
/* FLEX input for FORTH input file scanner */ /* FLEX input for FORTH input file scanner */
/* /*
* Copyright (c) 1998 Eduardo Horvath. * Copyright (c) 1998 Eduardo Horvath.
* All rights reserved. * All rights reserved.
* *
@ -72,7 +72,7 @@ static struct fcode *dictionary = NULL;
static struct macro *aliases = NULL; static struct macro *aliases = NULL;
static int outf = 1; /* stdout */ static int outf = 1; /* stdout */
static int state = 0; static int state = 0;
static int nextfcode = 0x800; static int nextfcode = 0x800;
static int numbase = TOK_HEX; static int numbase = TOK_HEX;
static long outpos; static long outpos;
static char *outbuf = NULL; static char *outbuf = NULL;
@ -152,16 +152,16 @@ erealloc(void *p, size_t sz)
\'.\' { ltoken.type = TOK_C_LIT; ltoken.text = yytext; return &ltoken; } \'.\' { ltoken.type = TOK_C_LIT; ltoken.text = yytext; return &ltoken; }
\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_STRING_LIT; ltoken.text = yytext; \"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_STRING_LIT; ltoken.text = yytext;
return &ltoken; } /* String started by `"' or `."' */ return &ltoken; } /* String started by `"' or `."' */
\.\({white}*(\\\"|[^)])*\) { ltoken.type = TOK_PSTRING; ltoken.text = yytext; \.\({white}*(\\\"|[^)])*\) { ltoken.type = TOK_PSTRING; ltoken.text = yytext;
return &ltoken; } /* String of type `.(.....)' */ return &ltoken; } /* String of type `.(.....)' */
\.\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_PSTRING; ltoken.text = yytext; \.\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_PSTRING; ltoken.text = yytext;
return &ltoken; } return &ltoken; }
[aA][bB][oO][rR][tT]\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_ABORT_S; [aA][bB][oO][rR][tT]\"{white}*(\\\"|[^"])*\" { ltoken.type = TOK_ABORT_S;
ltoken.text = yytext; return &ltoken; } ltoken.text = yytext; return &ltoken; }
"(" { ltoken.type = TOK_COMMENT; ltoken.text = yytext; "(" { ltoken.type = TOK_COMMENT; ltoken.text = yytext;
@ -233,7 +233,7 @@ erealloc(void *p, size_t sz)
[eE][xX][tT][eE][rR][nN][aA][lL] { ltoken.type = TOK_EXTERNAL; ltoken.text = yytext; [eE][xX][tT][eE][rR][nN][aA][lL] { ltoken.type = TOK_EXTERNAL; ltoken.text = yytext;
return &ltoken; } return &ltoken; }
[fF][cC][oO][dD][eE]-[vV][eE][rR][sS][iI][oO][nN]2 { [fF][cC][oO][dD][eE]-[vV][eE][rR][sS][iI][oO][nN]2 {
ltoken.type = TOK_FCODE_VERSION2; ltoken.text = yytext; ltoken.type = TOK_FCODE_VERSION2; ltoken.text = yytext;
return &ltoken; } return &ltoken; }
@ -281,7 +281,7 @@ erealloc(void *p, size_t sz)
[sS][tT][aA][rR][tT][0124] { ltoken.type = TOK_STARTX; ltoken.text = yytext; [sS][tT][aA][rR][tT][0124] { ltoken.type = TOK_STARTX; ltoken.text = yytext;
return &ltoken; } return &ltoken; }
[tT][hH][eE][nN] { ltoken.type = TOK_THEN; ltoken.text = yytext; [tT][hH][eE][nN] { ltoken.type = TOK_THEN; ltoken.text = yytext;
return &ltoken; } return &ltoken; }
@ -778,7 +778,7 @@ cvt(const char *s, char **e, int base)
for (c = *s; (c = *s); s++) { for (c = *s; (c = *s); s++) {
/* Ignore `.' */ /* Ignore `.' */
if (c == '.') if (c == '.')
continue; continue;
if (c >= '0' && c <= '9') if (c >= '0' && c <= '9')
c -= '0'; c -= '0';
@ -838,9 +838,9 @@ fadd(struct fcode *dict, struct fcode *new)
new->type = FCODE; new->type = FCODE;
ASSERT(dict->type == FCODE); ASSERT(dict->type == FCODE);
if (!res) { if (!res) {
/* /*
* Duplicate entry. Give the old name the new FCode * Duplicate entry. Give the old name the new FCode
* number. * number.
*/ */
dict->num = new->num; dict->num = new->num;
return (0); return (0);
@ -850,7 +850,7 @@ fadd(struct fcode *dict, struct fcode *new)
return fadd(dict->l, new); return fadd(dict->l, new);
else { else {
if (debug > 5) if (debug > 5)
printf("fadd: new FCode `%s' is %lx\n", printf("fadd: new FCode `%s' is %lx\n",
new->name, new->num); new->name, new->num);
new->l = new->r = NULL; new->l = new->r = NULL;
dict->l = new; dict->l = new;
@ -860,7 +860,7 @@ fadd(struct fcode *dict, struct fcode *new)
return fadd(dict->r, new); return fadd(dict->r, new);
else { else {
if (debug > 5) if (debug > 5)
printf("fadd: new FCode `%s' is %lx\n", printf("fadd: new FCode `%s' is %lx\n",
new->name, new->num); new->name, new->num);
new->l = new->r = NULL; new->l = new->r = NULL;
dict->r = new; dict->r = new;
@ -881,12 +881,12 @@ flookup(struct fcode *dict, const char *str)
res = strcmp(dict->name, str); res = strcmp(dict->name, str);
ASSERT(dict->type == FCODE); ASSERT(dict->type == FCODE);
if (debug > 5) if (debug > 5)
printf("flookup: `%s' and `%s' %s match\n", printf("flookup: `%s' and `%s' %s match\n",
str, dict->name, res?"don't":"do"); str, dict->name, res?"don't":"do");
if (!res) return (dict); if (!res) return (dict);
if (res < 0) if (res < 0)
return (flookup(dict->l, str)); return (flookup(dict->l, str));
else else
return (flookup(dict->r, str)); return (flookup(dict->r, str));
} }
@ -914,7 +914,7 @@ aadd(struct macro *dict, struct macro *new)
new->l = new->r = NULL; new->l = new->r = NULL;
dict->l = new; dict->l = new;
if (debug > 5) if (debug > 5)
printf("aadd: new alias `%s' to `%s'\n", printf("aadd: new alias `%s' to `%s'\n",
new->name, new->equiv); new->name, new->equiv);
} }
} else { } else {
@ -924,7 +924,7 @@ aadd(struct macro *dict, struct macro *new)
new->l = new->r = NULL; new->l = new->r = NULL;
dict->r = new; dict->r = new;
if (debug > 5) if (debug > 5)
printf("aadd: new alias `%s' to `%s'\n", printf("aadd: new alias `%s' to `%s'\n",
new->name, new->equiv); new->name, new->equiv);
} }
} }
@ -945,7 +945,7 @@ alookup(struct macro *dict, const char *str)
if (!res) return (dict); if (!res) return (dict);
if (res < 0) if (res < 0)
return (alookup(dict->l, str)); return (alookup(dict->l, str));
else else
return (alookup(dict->r, str)); return (alookup(dict->r, str));
} }
@ -989,11 +989,11 @@ static int
apply_macros(YY_BUFFER_STATE yinput, const char *str) apply_macros(YY_BUFFER_STATE yinput, const char *str)
{ {
struct macro *xform = alookup(aliases, str); struct macro *xform = alookup(aliases, str);
if (xform) { if (xform) {
YY_BUFFER_STATE newbuf; YY_BUFFER_STATE newbuf;
if (debug > 1) if (debug > 1)
printf("Expanding %s to %s\n", str, xform->equiv); printf("Expanding %s to %s\n", str, xform->equiv);
newbuf = yy_scan_string(xform->equiv); newbuf = yy_scan_string(xform->equiv);
@ -1039,10 +1039,10 @@ main(int argc, char *argv[])
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc != 1) if (argc != 1)
usage(); usage();
infile = argv[0]; infile = argv[0];
/* /*
@ -1056,7 +1056,7 @@ main(int argc, char *argv[])
emit(hdrtype); emit(hdrtype);
outpos = sizeof(*fheader); outpos = sizeof(*fheader);
/* /*
* Do it. * Do it.
*/ */
if ((inf = fopen(infile, "r")) == NULL) if ((inf = fopen(infile, "r")) == NULL)
@ -1109,10 +1109,10 @@ tokenize(YY_BUFFER_STATE yinput)
switch (token->type) { switch (token->type) {
case TOK_NUMBER: case TOK_NUMBER:
STATE(token->text, "TOK_NUMBER"); STATE(token->text, "TOK_NUMBER");
{ {
char *end; char *end;
Cell value; Cell value;
if (tokenizer) { if (tokenizer) {
push(strtol(token->text, &end, 16)); push(strtol(token->text, &end, 16));
break; break;
@ -1122,7 +1122,7 @@ tokenize(YY_BUFFER_STATE yinput)
token_err(yylineno, infile, yytext, token_err(yylineno, infile, yytext,
"illegal number conversion"); "illegal number conversion");
/* /*
* If this is a 64-bit value we need to store two literals * If this is a 64-bit value we need to store two literals
* and issue a `lxjoin' to combine them. But that's a future * and issue a `lxjoin' to combine them. But that's a future
* project. * project.
@ -1132,7 +1132,7 @@ tokenize(YY_BUFFER_STATE yinput)
spit((value>>16)&0x0ff); spit((value>>16)&0x0ff);
spit((value>>8)&0x0ff); spit((value>>8)&0x0ff);
spit(value&0x0ff); spit(value&0x0ff);
if ((value>>32) != value && (value>>32) != 0 && if ((value>>32) != value && (value>>32) != 0 &&
(value>>32) != -1) { (value>>32) != -1) {
emit("b(lit)"); emit("b(lit)");
spit((value>>56)&0x0ff); spit((value>>56)&0x0ff);
@ -1151,12 +1151,12 @@ tokenize(YY_BUFFER_STATE yinput)
spit(0); spit(0);
spit(token->text[1]); spit(token->text[1]);
break; break;
case TOK_STRING_LIT: case TOK_STRING_LIT:
STATE(token->text, "TOK_STRING_LIT:"); STATE(token->text, "TOK_STRING_LIT:");
{ {
size_t len; size_t len;
char *p = token->text; char *p = token->text;
++p; /* Skip the quote */ ++p; /* Skip the quote */
len = strlen(++p); /* Skip the 1st space */ len = strlen(++p); /* Skip the 1st space */
@ -1174,7 +1174,7 @@ tokenize(YY_BUFFER_STATE yinput)
sspit(p); sspit(p);
} }
break; break;
case TOK_PSTRING: case TOK_PSTRING:
STATE(token->text, "TOK_PSTRING:"); STATE(token->text, "TOK_PSTRING:");
{ {
size_t len; size_t len;
@ -1239,21 +1239,21 @@ tokenize(YY_BUFFER_STATE yinput)
/* The next pass should tokenize the FCODE number */ /* The next pass should tokenize the FCODE number */
emit("b(')"); emit("b(')");
break; break;
case TOK_COMMENT: case TOK_COMMENT:
STATE(token->text, "TOK_COMMENT:"); STATE(token->text, "TOK_COMMENT:");
do { do {
off = input(); off = input();
} while ((off != ')') && (off != '\n') && } while ((off != ')') && (off != '\n') &&
(off != EOF)); (off != EOF));
break; break;
case TOK_COLON: case TOK_COLON:
STATE(token->text, "TOK_COLON:"); STATE(token->text, "TOK_COLON:");
token = yylex(); token = yylex();
if (token == NULL) if (token == NULL)
token_err(yylineno, infile, yytext, token_err(yylineno, infile, yytext,
"EOF in colon definition"); "EOF in colon definition");
/* Add new code to dictionary */ /* Add new code to dictionary */
fcode = emalloc(sizeof(*fcode)); fcode = emalloc(sizeof(*fcode));
fcode->num = nextfcode++; fcode->num = nextfcode++;
@ -1267,7 +1267,7 @@ tokenize(YY_BUFFER_STATE yinput)
free(fcode); free(fcode);
} }
if (debug) if (debug)
printf("Adding %s to dictionary\n", token->text); printf("Adding %s to dictionary\n", token->text);
if (state == 0) if (state == 0)
emit("new-token"); emit("new-token");
else { else {
@ -1283,7 +1283,7 @@ tokenize(YY_BUFFER_STATE yinput)
last_token = fcode->name; last_token = fcode->name;
defining = 1; defining = 1;
break; break;
case TOK_SEMICOLON: case TOK_SEMICOLON:
STATE(token->text, "TOK_SEMICOLON:"); STATE(token->text, "TOK_SEMICOLON:");
emit("b(;)"); emit("b(;)");
defining = 0; defining = 0;
@ -1325,7 +1325,7 @@ tokenize(YY_BUFFER_STATE yinput)
free((void *)alias->name); free((void *)alias->name);
free(alias); free(alias);
return; return;
} }
alias->equiv = estrdup(token->text); alias->equiv = estrdup(token->text);
if (!aadd(aliases, alias)) { if (!aadd(aliases, alias)) {
free((void *)alias->name); free((void *)alias->name);
@ -1371,13 +1371,13 @@ tokenize(YY_BUFFER_STATE yinput)
warnx("EOF in colon definition"); warnx("EOF in colon definition");
return; return;
} }
/* Add new code to dictionary */ /* Add new code to dictionary */
fcode = emalloc(sizeof(*fcode)); fcode = emalloc(sizeof(*fcode));
fcode->num = nextfcode++; fcode->num = nextfcode++;
fcode->name = estrdup(token->text); fcode->name = estrdup(token->text);
fadd(dictionary, fcode); fadd(dictionary, fcode);
if (state == 0) if (state == 0)
emit("new-token"); emit("new-token");
else { else {
@ -1404,13 +1404,13 @@ tokenize(YY_BUFFER_STATE yinput)
warnx("EOF in constant definition"); warnx("EOF in constant definition");
return; return;
} }
/* Add new code to dictionary */ /* Add new code to dictionary */
fcode = emalloc(sizeof(*fcode)); fcode = emalloc(sizeof(*fcode));
fcode->num = nextfcode++; fcode->num = nextfcode++;
fcode->name = estrdup(token->text); fcode->name = estrdup(token->text);
fadd(dictionary, fcode); fadd(dictionary, fcode);
if (state == 0) if (state == 0)
emit("new-token"); emit("new-token");
else { else {
@ -1443,13 +1443,13 @@ tokenize(YY_BUFFER_STATE yinput)
warnx("EOF in create definition"); warnx("EOF in create definition");
return; return;
} }
/* Add new code to dictionary */ /* Add new code to dictionary */
fcode = emalloc(sizeof(*fcode)); fcode = emalloc(sizeof(*fcode));
fcode->num = nextfcode++; fcode->num = nextfcode++;
fcode->name = estrdup(token->text); fcode->name = estrdup(token->text);
fadd(dictionary, fcode); fadd(dictionary, fcode);
if (state == 0) if (state == 0)
emit("new-token"); emit("new-token");
else { else {
@ -1496,7 +1496,7 @@ tokenize(YY_BUFFER_STATE yinput)
token_err(yylineno, infile, NULL, token_err(yylineno, infile, NULL,
"Illegal number conversion: %s", token->text); "Illegal number conversion: %s", token->text);
/* /*
* If this is a 64-bit value we need to store two literals * If this is a 64-bit value we need to store two literals
* and issue a `lxjoin' to combine them. But that's a future * and issue a `lxjoin' to combine them. But that's a future
* project. * project.
@ -1524,13 +1524,13 @@ tokenize(YY_BUFFER_STATE yinput)
warnx("EOF in colon definition"); warnx("EOF in colon definition");
return; return;
} }
/* Add new code to dictionary */ /* Add new code to dictionary */
fcode = emalloc(sizeof(*fcode)); fcode = emalloc(sizeof(*fcode));
fcode->num = nextfcode++; fcode->num = nextfcode++;
fcode->name = estrdup(token->text); fcode->name = estrdup(token->text);
fadd(dictionary, fcode); fadd(dictionary, fcode);
if (state == 0) if (state == 0)
emit("new-token"); emit("new-token");
else { else {
@ -1563,7 +1563,7 @@ tokenize(YY_BUFFER_STATE yinput)
* it generates the FCode and returns, with outpos at b2. We then * it generates the FCode and returns, with outpos at b2. We then
* calculate the offsets, put them in the right slots and finishup. * calculate the offsets, put them in the right slots and finishup.
*/ */
if (token->text[0] == '?') if (token->text[0] == '?')
emit("b(?do)"); emit("b(?do)");
else else
@ -1595,7 +1595,7 @@ tokenize(YY_BUFFER_STATE yinput)
/* revert to the end */ /* revert to the end */
outpos = pos; outpos = pos;
break; break;
case TOK_ENDCASE: case TOK_ENDCASE:
STATE(token->text, "TOK_ENDCASE:"); STATE(token->text, "TOK_ENDCASE:");
emit("b(endcase)"); emit("b(endcase)");
pos = outpos; /* Remember where we need to branch to */ pos = outpos; /* Remember where we need to branch to */
@ -1611,7 +1611,7 @@ tokenize(YY_BUFFER_STATE yinput)
/* Load next offset to process */ /* Load next offset to process */
disp = (signed char)(outbuf[outpos]); disp = (signed char)(outbuf[outpos]);
if (offsetsize == 16) { if (offsetsize == 16) {
disp = (disp << 8) | disp = (disp << 8) |
(unsigned char)outbuf[outpos+1]; (unsigned char)outbuf[outpos+1];
} }
next = outpos + disp; next = outpos + disp;
@ -1631,7 +1631,7 @@ tokenize(YY_BUFFER_STATE yinput)
STATE(token->text, "TOK_ENDOF"); STATE(token->text, "TOK_ENDOF");
off = pop(); off = pop();
emit("b(endof)"); emit("b(endof)");
/* /*
* Save back pointer in the offset field so we can traverse * Save back pointer in the offset field so we can traverse
* the linked list and patch it in the endcase. * the linked list and patch it in the endcase.
*/ */
@ -1665,7 +1665,7 @@ tokenize(YY_BUFFER_STATE yinput)
outpos = pos; outpos = pos;
break; break;
case TOK_FCODE_END: case TOK_FCODE_END:
/* /*
* Another tokenizer directive. * Another tokenizer directive.
* *
* This should generate end0 and finish filling in * This should generate end0 and finish filling in
@ -1675,19 +1675,19 @@ tokenize(YY_BUFFER_STATE yinput)
return; return;
case TOK_FIELD: case TOK_FIELD:
STATE(token->text, "TOK_FIELD"); STATE(token->text, "TOK_FIELD");
token = yylex(); token = yylex();
if (token == NULL) { if (token == NULL) {
warnx("EOF in field definition"); warnx("EOF in field definition");
return; return;
} }
/* Add new code to dictionary */ /* Add new code to dictionary */
fcode = emalloc(sizeof(*fcode)); fcode = emalloc(sizeof(*fcode));
fcode->num = nextfcode++; fcode->num = nextfcode++;
fcode->name = estrdup(token->text); fcode->name = estrdup(token->text);
fadd(dictionary, fcode); fadd(dictionary, fcode);
if (state == 0) if (state == 0)
emit("new-token"); emit("new-token");
else { else {
@ -1701,7 +1701,7 @@ tokenize(YY_BUFFER_STATE yinput)
spit(fcode->num); spit(fcode->num);
emit("b(field)"); emit("b(field)");
break; break;
case TOK_HEX: case TOK_HEX:
STATE(token->text, "TOK_HEX"); STATE(token->text, "TOK_HEX");
if (token->text[1] != '#') { if (token->text[1] != '#') {
@ -1729,7 +1729,7 @@ tokenize(YY_BUFFER_STATE yinput)
errx(EXIT_FAILURE, "Illegal number" errx(EXIT_FAILURE, "Illegal number"
" conversion:%s:%d: %s\n", " conversion:%s:%d: %s\n",
infile, yylineno, yytext); infile, yylineno, yytext);
/* /*
* If this is a 64-bit value we need to store two literals * If this is a 64-bit value we need to store two literals
* and issue a `lxjoin' to combine them. But that's a future * and issue a `lxjoin' to combine them. But that's a future
* project. * project.
@ -1813,7 +1813,7 @@ tokenize(YY_BUFFER_STATE yinput)
" conversion:%s:%d: %s\n", " conversion:%s:%d: %s\n",
infile, yylineno, yytext); infile, yylineno, yytext);
} }
/* /*
* If this is a 64-bit value we need to store two literals * If this is a 64-bit value we need to store two literals
* and issue a `lxjoin' to combine them. But that's a future * and issue a `lxjoin' to combine them. But that's a future
* project. * project.
@ -1844,7 +1844,7 @@ tokenize(YY_BUFFER_STATE yinput)
* `endcase'. Here we will generate a temporary * `endcase'. Here we will generate a temporary
* offset of the `of' associated with the `endof'. * offset of the `of' associated with the `endof'.
* Then in `endcase' we should be pointing just * Then in `endcase' we should be pointing just
* after the offset of the last `endof' so we * after the offset of the last `endof' so we
* calculate the offset and thread our way backwards * calculate the offset and thread our way backwards
* searching for the previous `b(case)' or `b(endof)'. * searching for the previous `b(case)' or `b(endof)'.
*/ */
@ -1912,13 +1912,13 @@ tokenize(YY_BUFFER_STATE yinput)
warnx("EOF in value definition"); warnx("EOF in value definition");
return; return;
} }
/* Add new code to dictionary */ /* Add new code to dictionary */
fcode = emalloc(sizeof(*fcode)); fcode = emalloc(sizeof(*fcode));
fcode->num = nextfcode++; fcode->num = nextfcode++;
fcode->name = estrdup(token->text); fcode->name = estrdup(token->text);
fadd(dictionary, fcode); fadd(dictionary, fcode);
if (state == 0) if (state == 0)
emit("new-token"); emit("new-token");
else { else {
@ -1940,13 +1940,13 @@ tokenize(YY_BUFFER_STATE yinput)
warnx("EOF in variable definition"); warnx("EOF in variable definition");
return; return;
} }
/* Add new code to dictionary */ /* Add new code to dictionary */
fcode = emalloc(sizeof(*fcode)); fcode = emalloc(sizeof(*fcode));
fcode->num = nextfcode++; fcode->num = nextfcode++;
fcode->name = estrdup(token->text); fcode->name = estrdup(token->text);
fadd(dictionary, fcode); fadd(dictionary, fcode);
if (state == 0) if (state == 0)
emit("new-token"); emit("new-token");
else { else {
@ -2002,7 +2002,7 @@ tokenize(YY_BUFFER_STATE yinput)
} }
infile = estrdup(token->text); infile = estrdup(token->text);
if (mark_fload) { if (mark_fload) {
/* /*
* Insert commands to print out the * Insert commands to print out the
* filename into the instruction * filename into the instruction
* stream * stream
@ -2026,7 +2026,7 @@ tokenize(YY_BUFFER_STATE yinput)
yy_delete_buffer(inbuf); yy_delete_buffer(inbuf);
fclose(inf); fclose(inf);
if (mark_fload) { if (mark_fload) {
/* /*
* Insert commands to print out the * Insert commands to print out the
* filename into the instruction * filename into the instruction
* stream * stream
@ -2052,7 +2052,7 @@ tokenize(YY_BUFFER_STATE yinput)
if (emit(token->text)) { if (emit(token->text)) {
#if 0 #if 0
/* /*
* Call an external command * Call an external command
* *
* XXXXX assumes it will always find the command * XXXXX assumes it will always find the command
*/ */
@ -2185,7 +2185,7 @@ offspit(long n)
} }
} }
int int
yywrap(void) yywrap(void)
{ {
/* Always generate EOF */ /* Always generate EOF */

View File

@ -20,7 +20,7 @@
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@ -296,7 +296,7 @@ getmsg(int fd, char *cptr, char quote)
if (quote && *cptr == quote) { if (quote && *cptr == quote) {
++cptr; ++cptr;
} }
clen = strlen(cptr) + 1; clen = strlen(cptr) + 1;
if (clen > msglen) { if (clen > msglen) {
@ -367,7 +367,7 @@ getmsg(int fd, char *cptr, char quote)
* escape ' and ", let's accept * escape ' and ", let's accept
* them escaped and not complain. * them escaped and not complain.
* (XPG4 states that '\' should be * (XPG4 states that '\' should be
* ignored when not used in a * ignored when not used in a
* valid escape sequence) * valid escape sequence)
*/ */
*tptr++ = '"'; *tptr++ = '"';

View File

@ -127,7 +127,7 @@ dfn_pre_visit(nltype *parentp)
bool bool
dfn_numbered(nltype *childp) dfn_numbered(nltype *childp)
{ {
return ( childp -> toporder != DFN_NAN && childp -> toporder != DFN_BUSY ); return ( childp -> toporder != DFN_NAN && childp -> toporder != DFN_BUSY );
} }
@ -202,7 +202,7 @@ dfn_findcycle(nltype *childp)
* if what we think is the top of the cycle * if what we think is the top of the cycle
* has a cyclehead field, then it's not really the * has a cyclehead field, then it's not really the
* head of the cycle, which is really what we want * head of the cycle, which is really what we want
*/ */
if ( cycleheadp -> cyclehead != cycleheadp ) { if ( cycleheadp -> cyclehead != cycleheadp ) {
cycleheadp = cycleheadp -> cyclehead; cycleheadp = cycleheadp -> cyclehead;
# ifdef DEBUG # ifdef DEBUG

View File

@ -224,15 +224,15 @@ main(int argc, char *argv[])
/* /*
* print the dynamic profile * print the dynamic profile
*/ */
printgprof( timesortnlp ); printgprof( timesortnlp );
/* /*
* print the flat profile * print the flat profile
*/ */
printprof(); printprof();
/* /*
* print the index * print the index
*/ */
printindex(); printindex();
return (0); return (0);
} }
@ -410,7 +410,7 @@ readsamples(FILE *pfile)
{ {
UNIT sample; UNIT sample;
int i; int i;
if (samples == 0) { if (samples == 0) {
samples = calloc(sampbytes, sizeof (UNIT)); samples = calloc(sampbytes, sizeof (UNIT));
if (samples == 0) if (samples == 0)
@ -491,7 +491,7 @@ asgnsamples(void)
svalue0 = nl[j].svalue; svalue0 = nl[j].svalue;
svalue1 = nl[j+1].svalue; svalue1 = nl[j+1].svalue;
/* /*
* if high end of tick is below entry address, * if high end of tick is below entry address,
* go for next tick. * go for next tick.
*/ */
if (pch < svalue0) if (pch < svalue0)
@ -508,7 +508,7 @@ asgnsamples(void)
if (debug & SAMPLEDEBUG) { if (debug & SAMPLEDEBUG) {
printf("[asgnsamples] (0x%lx->0x%lx-0x%lx) %s gets %f ticks %ld overlap\n", printf("[asgnsamples] (0x%lx->0x%lx-0x%lx) %s gets %f ticks %ld overlap\n",
nl[j].value/sizeof(UNIT), svalue0, svalue1, nl[j].value/sizeof(UNIT), svalue0, svalue1,
nl[j].name, nl[j].name,
overlap * time / scale, overlap); overlap * time / scale, overlap);
} }
# endif /* DEBUG */ # endif /* DEBUG */

View File

@ -105,4 +105,4 @@ index the index of this child in the call graph listing,
fields as a function entry. Below it are listed fields as a function entry. Below it are listed
the members of the cycle, and their contributions the members of the cycle, and their contributions
to the time and call counts of the cycle. to the time and call counts of the cycle.

View File

@ -15,13 +15,13 @@ seconds function alone. This is the major sort for this
calls the number of times this function was invoked, if calls the number of times this function was invoked, if
this function is profiled, else blank. this function is profiled, else blank.
self the average number of milliseconds spent in this self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled, ms/call function per call, if this function is profiled,
else blank. else blank.
total the average number of milliseconds spent in this total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this ms/call function and its descendents per call, if this
function is profiled, else blank. function is profiled, else blank.
name the name of the function. This is the minor sort name the name of the function. This is the minor sort
@ -29,4 +29,4 @@ name the name of the function. This is the minor sort
the function in the gprof listing. If the index is the function in the gprof listing. If the index is
in parenthesis it shows where it would appear in in parenthesis it shows where it would appear in
the gprof listing if it were to be printed. the gprof listing if it were to be printed.

View File

@ -154,7 +154,7 @@ extern int cyclecnt; /* the number of cycles found */
#define DFN_BUSY -1 #define DFN_BUSY -1
#define DFN_NAN 0 #define DFN_NAN 0
/* /*
* namelist entries for cycle headers. * namelist entries for cycle headers.
* the number of discovered cycles. * the number of discovered cycles.
*/ */

View File

@ -34,7 +34,7 @@
/* /*
* look up an address in a sorted-by-address namelist * look up an address in a sorted-by-address namelist
* this deals with misses by mapping them to the next lower * this deals with misses by mapping them to the next lower
* entry point. * entry point.
*/ */
nltype * nltype *

View File

@ -88,7 +88,7 @@ timecmp(const void *v1, const void *v2)
void void
flatprofheader() flatprofheader()
{ {
if (bflag) if (bflag)
printblurb( _PATH_FLAT_BLURB ); printblurb( _PATH_FLAT_BLURB );
printf("\ngranularity: each sample hit covers %ld byte(s)", printf("\ngranularity: each sample hit covers %ld byte(s)",
@ -268,7 +268,7 @@ totalcmp(const void *v1, const void *v2)
return 1; return 1;
if ( np1 -> ncall > np2 -> ncall ) if ( np1 -> ncall > np2 -> ncall )
return -1; return -1;
if ( np1 -> ncall < np2 -> ncall ) if ( np1 -> ncall < np2 -> ncall )
return 1; return 1;
return strcmp( np1 -> name , np2 -> name ); return strcmp( np1 -> name , np2 -> name );
} }

View File

@ -613,7 +613,7 @@ check_type:
if (ps.in_decl && !ps.block_init) if (ps.in_decl && !ps.block_init)
if (troff && !ps.dumped_decl_indent && !is_procname && ps.last_token == decl) { if (troff && !ps.dumped_decl_indent && !is_procname && ps.last_token == decl) {
ps.dumped_decl_indent = 1; ps.dumped_decl_indent = 1;
snprintf(e_code, (l_code - e_code) + 5, snprintf(e_code, (l_code - e_code) + 5,
"\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token);
e_code += strlen(e_code); e_code += strlen(e_code);
CHECK_SIZE_CODE; CHECK_SIZE_CODE;

View File

@ -316,18 +316,18 @@ compute_label_target(void)
/* /*
* Copyright (C) 1976 by the Board of Trustees of the University of Illinois * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
* *
* All rights reserved * All rights reserved
* *
* *
* NAME: fill_buffer * NAME: fill_buffer
* *
* FUNCTION: Reads one block of input into input_buffer * FUNCTION: Reads one block of input into input_buffer
* *
* HISTORY: initial coding November 1976 D A Willcox of CAC 1/7/77 A * HISTORY: initial coding November 1976 D A Willcox of CAC 1/7/77 A
* Willcox of CAC Added check for switch back to partly full input * Willcox of CAC Added check for switch back to partly full input
* buffer from temporary buffer * buffer from temporary buffer
* *
*/ */
void void
fill_buffer(void) fill_buffer(void)
@ -420,31 +420,31 @@ fill_buffer(void)
/* /*
* Copyright (C) 1976 by the Board of Trustees of the University of Illinois * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
* *
* All rights reserved * All rights reserved
* *
* *
* NAME: pad_output * NAME: pad_output
* *
* FUNCTION: Writes tabs and spaces to move the current column up to the desired * FUNCTION: Writes tabs and spaces to move the current column up to the desired
* position. * position.
* *
* ALGORITHM: Put tabs and/or blanks into pobuf, then write pobuf. * ALGORITHM: Put tabs and/or blanks into pobuf, then write pobuf.
* *
* PARAMETERS: current integer The current column target * PARAMETERS: current integer The current column target
* target integer The desired column * target integer The desired column
* *
* RETURNS: Integer value of the new column. (If current >= target, no action is * RETURNS: Integer value of the new column. (If current >= target, no action is
* taken, and current is returned. * taken, and current is returned.
* *
* GLOBALS: None * GLOBALS: None
* *
* CALLS: write (sys) * CALLS: write (sys)
* *
* CALLED BY: dump_line * CALLED BY: dump_line
* *
* HISTORY: initial coding November 1976 D A Willcox of CAC * HISTORY: initial coding November 1976 D A Willcox of CAC
* *
*/ */
int int
pad_output(int current, int target) pad_output(int current, int target)
@ -472,23 +472,23 @@ pad_output(int current, int target)
/* /*
* Copyright (C) 1976 by the Board of Trustees of the University of Illinois * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
* *
* All rights reserved * All rights reserved
* *
* *
* NAME: count_spaces * NAME: count_spaces
* *
* FUNCTION: Find out where printing of a given string will leave the current * FUNCTION: Find out where printing of a given string will leave the current
* character position on output. * character position on output.
* *
* ALGORITHM: Run thru input string and add appropriate values to current * ALGORITHM: Run thru input string and add appropriate values to current
* position. * position.
* *
* RETURNS: Integer value of position after printing "buffer" starting in column * RETURNS: Integer value of position after printing "buffer" starting in column
* "current". * "current".
* *
* HISTORY: initial coding November 1976 D A Willcox of CAC * HISTORY: initial coding November 1976 D A Willcox of CAC
* *
*/ */
int int
count_spaces(int current, char *buffer) count_spaces(int current, char *buffer)

View File

@ -202,7 +202,7 @@ lexi(void)
} }
break; break;
} }
if (!(seensfx & 1) && if (!(seensfx & 1) &&
(*buf_ptr == 'F' || *buf_ptr == 'f')) { (*buf_ptr == 'F' || *buf_ptr == 'f')) {
CHECK_SIZE_TOKEN; CHECK_SIZE_TOKEN;
*e_token++ = *buf_ptr++; *e_token++ = *buf_ptr++;

View File

@ -1523,7 +1523,7 @@ main(int argc, char *argv[])
argv[optind], tfile[termcount]); argv[optind], tfile[termcount]);
status = _nc_read_file_entry(tfile[termcount], status = _nc_read_file_entry(tfile[termcount],
&entries[termcount].tterm); &entries[termcount].tterm);
#else #else
(void) fprintf(stderr, "%s: terminfo files not supported\n", (void) fprintf(stderr, "%s: terminfo files not supported\n",
_nc_progname); _nc_progname);

View File

@ -516,7 +516,7 @@ ktrcmsghdr(char *data, socklen_t len)
printf("SCM_RIGHTS, data="); printf("SCM_RIGHTS, data=");
fds = (int *)CMSG_DATA(cmsg); fds = (int *)CMSG_DATA(cmsg);
for (i = 0; for (i = 0;
cmsg->cmsg_len > CMSG_LEN(sizeof(int) * i) cmsg->cmsg_len > CMSG_LEN(sizeof(int) * i)
&& (char *)fds + (i + 1) * sizeof(int) <= && (char *)fds + (i + 1) * sizeof(int) <=
data + len; data + len;
i++) { i++) {
@ -595,7 +595,7 @@ ktrstruct(char *buf, size_t buflen)
sizeof(ss.ss_len)) sizeof(ss.ss_len))
goto invalid; goto invalid;
memcpy(&ss, data, datalen); memcpy(&ss, data, datalen);
if ((ss.ss_family != AF_UNIX && if ((ss.ss_family != AF_UNIX &&
datalen < sizeof(struct sockaddr)) || datalen != ss.ss_len) datalen < sizeof(struct sockaddr)) || datalen != ss.ss_len)
goto invalid; goto invalid;
ktrsockaddr((struct sockaddr *)&ss); ktrsockaddr((struct sockaddr *)&ss);

View File

@ -456,7 +456,7 @@ dosocktypename (int arg, int show_type)
{ {
int type = arg & 0xff; /* XXX */ int type = arg & 0xff; /* XXX */
int or = 0; int or = 0;
printf("%#x<", arg); printf("%#x<", arg);
if (show_type || type) { if (show_type || type) {
or = 1; or = 1;

View File

@ -151,7 +151,7 @@ main(int argc, char *argv[])
argv += optind; argv += optind;
argc -= optind; argc -= optind;
if ((pidset && *argv) || (!pidset && !*argv && clear != CLEAR)) if ((pidset && *argv) || (!pidset && !*argv && clear != CLEAR))
usage(); usage();
@ -192,7 +192,7 @@ main(int argc, char *argv[])
(void)umask(omask); (void)umask(omask);
(void)close(fd); (void)close(fd);
if (*argv) { if (*argv) {
if (is_ltrace) { if (is_ltrace) {
if (setenv("LD_TRACE_PLT", inherit ? "i" : "", 1) < 0) if (setenv("LD_TRACE_PLT", inherit ? "i" : "", 1) < 0)
err(1, "setenv(LD_TRACE_PLT)"); err(1, "setenv(LD_TRACE_PLT)");

View File

@ -420,7 +420,7 @@ want(struct utmp *bp, int check)
if (check) { if (check) {
/* /*
* some entries, such as ftp and uucp, will * some entries, such as ftp and uucp, will
* include process name plus id; exclude entries * include process name plus id; exclude entries
* that start with 'console' and 'tty' from * that start with 'console' and 'tty' from
* having the process id stripped. * having the process id stripped.

View File

@ -265,9 +265,9 @@ aldap_search(struct aldap *ldap, char *basedn, enum scope scope, char *filter,
goto fail; goto fail;
} }
c = ber; c = ber;
ber = ober_printf_elements(ber, "sEEddb", basedn, (long long)scope, ber = ober_printf_elements(ber, "sEEddb", basedn, (long long)scope,
(long long)LDAP_DEREF_NEVER, sizelimit, (long long)LDAP_DEREF_NEVER, sizelimit,
timelimit, typesonly); timelimit, typesonly);
if (ber == NULL) { if (ber == NULL) {
ldap->err = ALDAP_ERR_OPERATION_FAILED; ldap->err = ALDAP_ERR_OPERATION_FAILED;
@ -339,7 +339,7 @@ aldap_create_page_control(struct ber_element *elm, int size,
fail: fail:
if (ber != NULL) if (ber != NULL)
ober_free_elements(ber); ober_free_elements(ber);
ober_free(&c); ober_free(&c);
return (-1); return (-1);
} }
@ -451,7 +451,7 @@ parsefail:
} }
struct aldap_page_control * struct aldap_page_control *
aldap_parse_page_control(struct ber_element *control, size_t len) aldap_parse_page_control(struct ber_element *control, size_t len)
{ {
char *oid, *s; char *oid, *s;
char *encoded; char *encoded;

View File

@ -75,7 +75,7 @@ struct aldap_message {
} search; } search;
} body; } body;
struct ber_element *references; struct ber_element *references;
struct aldap_page_control *page; struct aldap_page_control *page;
}; };
enum aldap_protocol { enum aldap_protocol {

View File

@ -107,7 +107,7 @@ main(int argc, char *argv[])
usage(); usage();
(void)time(&now); (void)time(&now);
t = localtime(&now); t = localtime(&now);
while (t->tm_hour > hours || while (t->tm_hour > hours ||
(t->tm_hour == hours && t->tm_min >= minutes)) { (t->tm_hour == hours && t->tm_min >= minutes)) {
if (twentyfour) if (twentyfour)
hours += 24; hours += 24;

View File

@ -54,7 +54,7 @@ ccl_contains(const int cclp, const int ch)
/* ccladd - add a single character to a ccl */ /* ccladd - add a single character to a ccl */
void void
ccladd(cclp, ch) ccladd(cclp, ch)
int cclp; int cclp;
int ch; int ch;
@ -92,7 +92,7 @@ ccladd(cclp, ch)
/* dump_cclp - same thing as list_character_set, but for cclps. */ /* dump_cclp - same thing as list_character_set, but for cclps. */
static void static void
dump_cclp(FILE * file, int cclp) dump_cclp(FILE * file, int cclp)
{ {
int i; int i;
@ -189,7 +189,7 @@ ccl_set_union(int a, int b)
/* cclinit - return an empty ccl */ /* cclinit - return an empty ccl */
int int
cclinit() cclinit()
{ {
if (++lastccl >= current_maxccls) { if (++lastccl >= current_maxccls) {
@ -230,7 +230,7 @@ cclinit()
/* cclnegate - negate the given ccl */ /* cclnegate - negate the given ccl */
void void
cclnegate(cclp) cclnegate(cclp)
int cclp; int cclp;
{ {
@ -246,7 +246,7 @@ cclnegate(cclp)
* has a non-zero value in the cset array. * has a non-zero value in the cset array.
*/ */
void void
list_character_set(file, cset) list_character_set(file, cset)
FILE *file; FILE *file;
int cset[]; int cset[];
@ -288,7 +288,7 @@ list_character_set(file, cset)
* @param c2 the upper end of the range * @param c2 the upper end of the range
* @return true if [c1-c2] is not ambiguous for a caseless scanner. * @return true if [c1-c2] is not ambiguous for a caseless scanner.
*/ */
bool bool
range_covers_case(int c1, int c2) range_covers_case(int c1, int c2)
{ {
int i, o; int i, o;
@ -306,14 +306,14 @@ range_covers_case(int c1, int c2)
/** Reverse the case of a character, if possible. /** Reverse the case of a character, if possible.
* @return c if case-reversal does not apply. * @return c if case-reversal does not apply.
*/ */
int int
reverse_case(int c) reverse_case(int c)
{ {
return isupper(c) ? tolower(c) : (islower(c) ? toupper(c) : c); return isupper(c) ? tolower(c) : (islower(c) ? toupper(c) : c);
} }
/** Return true if c is uppercase or lowercase. */ /** Return true if c is uppercase or lowercase. */
bool bool
has_case(int c) has_case(int c)
{ {
return (isupper(c) || islower(c)) ? true : false; return (isupper(c) || islower(c)) ? true : false;

View File

@ -38,7 +38,7 @@
/* ccl2ecl - convert character classes to set of equivalence classes */ /* ccl2ecl - convert character classes to set of equivalence classes */
void void
ccl2ecl(void) ccl2ecl(void)
{ {
int i, ich, newlen, cclp, ccls, cclmec; int i, ich, newlen, cclp, ccls, cclmec;
@ -78,7 +78,7 @@ ccl2ecl(void)
* Returned is the number of classes. * Returned is the number of classes.
*/ */
int int
cre8ecs(int *fwd, int *bck, int num) cre8ecs(int *fwd, int *bck, int num)
{ {
int i, j, numcl; int i, j, numcl;
@ -115,7 +115,7 @@ cre8ecs(int *fwd, int *bck, int num)
* NUL_mapping is the value which NUL (0) should be mapped to. * NUL_mapping is the value which NUL (0) should be mapped to.
*/ */
void void
mkeccl(u_char *ccls, int lenccl, int *fwd, int *bck, int llsiz, int NUL_mapping) mkeccl(u_char *ccls, int lenccl, int *fwd, int *bck, int llsiz, int NUL_mapping)
{ {
int cclp, oldec, newec; int cclp, oldec, newec;
@ -206,7 +206,7 @@ mkeccl(u_char *ccls, int lenccl, int *fwd, int *bck, int llsiz, int NUL_mapping)
/* mkechar - create equivalence class for single character */ /* mkechar - create equivalence class for single character */
void void
mkechar(int tch, int *fwd, int *bck) mkechar(int tch, int *fwd, int *bck)
{ {
/* /*

View File

@ -125,7 +125,7 @@ filter_create_int(struct filter * chain,
* @param chain The head of the chain. * @param chain The head of the chain.
* @return true on success. * @return true on success.
*/ */
bool bool
filter_apply_chain(struct filter * chain) filter_apply_chain(struct filter * chain)
{ {
int pid, pipes[2]; int pid, pipes[2];
@ -201,7 +201,7 @@ filter_apply_chain(struct filter * chain)
* @param max_len the maximum length of the chain. * @param max_len the maximum length of the chain.
* @return the resulting length of the chain. * @return the resulting length of the chain.
*/ */
int int
filter_truncate(struct filter * chain, int max_len) filter_truncate(struct filter * chain, int max_len)
{ {
int len = 1; int len = 1;
@ -223,7 +223,7 @@ filter_truncate(struct filter * chain, int max_len)
* The header file name is in extra. * The header file name is in extra.
* @return 0 (zero) on success, and -1 on failure. * @return 0 (zero) on success, and -1 on failure.
*/ */
int int
filter_tee_header(struct filter * chain) filter_tee_header(struct filter * chain)
{ {
/* /*
@ -337,7 +337,7 @@ filter_tee_header(struct filter * chain)
* not user code. This also happens to be a good place to squeeze multiple * not user code. This also happens to be a good place to squeeze multiple
* blank lines into a single blank line. * blank lines into a single blank line.
*/ */
int int
filter_fix_linedirs(struct filter * chain) filter_fix_linedirs(struct filter * chain)
{ {
char *buf; char *buf;

View File

@ -15,10 +15,10 @@
%# through m4. Macros beginning with `m4_' will be processed. %# through m4. Macros beginning with `m4_' will be processed.
%# The quoting is "[[" and "]]" so we don't interfere with %# The quoting is "[[" and "]]" so we don't interfere with
%# user code. %# user code.
%# %#
%# All generate macros for the m4 stage contain the text "m4" or "M4" %# All generate macros for the m4 stage contain the text "m4" or "M4"
%# in them. This is to distinguish them from CPP macros. %# in them. This is to distinguish them from CPP macros.
%# The exception to this rule is YY_G, which is an m4 macro, %# The exception to this rule is YY_G, which is an m4 macro,
%# but it needs to be remain short because it is used everywhere. %# but it needs to be remain short because it is used everywhere.
%# %#
/* A lexical scanner generated by flex */ /* A lexical scanner generated by flex */
@ -31,7 +31,7 @@ m4_changecom
m4_changequote m4_changequote
m4_changequote([[, ]]) m4_changequote([[, ]])
%# %#
%# Lines in this skeleton starting with a "%" character are "control lines" %# Lines in this skeleton starting with a "%" character are "control lines"
%# and affect the generation of the scanner. The possible control codes are %# and affect the generation of the scanner. The possible control codes are
%# listed and processed in misc.c. %# listed and processed in misc.c.
@ -217,7 +217,7 @@ m4preproc_include(`flexint.h')
%if-c++-only %if-c++-only
/* begin standard C++ headers. */ /* begin standard C++ headers. */
#include <iostream> #include <iostream>
#include <errno.h> #include <errno.h>
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
@ -250,13 +250,13 @@ m4preproc_include(`flexint.h')
%# e.g., %# e.g.,
%# The function prototype %# The function prototype
%# int foo(int x, char* y); %# int foo(int x, char* y);
%# %#
%# ...should be written as %# ...should be written as
%# int foo M4_YY_PARAMS(int x, char* y); %# int foo M4_YY_PARAMS(int x, char* y);
%# %#
%# ...which could possibly generate %# ...which could possibly generate
%# int foo (); %# int foo ();
%# %#
m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]], m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
[[ [[
m4_define( [[M4_YY_PARAMS]], [[()]]) m4_define( [[M4_YY_PARAMS]], [[()]])
@ -331,7 +331,7 @@ m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
#define yy_flex_debug YY_G(yy_flex_debug_r) #define yy_flex_debug YY_G(yy_flex_debug_r)
m4_define( [[M4_YY_INCR_LINENO]], m4_define( [[M4_YY_INCR_LINENO]],
[[ [[
do{ yylineno++; do{ yylineno++;
yycolumn=0; yycolumn=0;
}while(0) }while(0)
@ -344,7 +344,7 @@ m4_define( [[M4_YY_INCR_LINENO]],
%if-not-reentrant %if-not-reentrant
m4_define( [[M4_YY_INCR_LINENO]], m4_define( [[M4_YY_INCR_LINENO]],
[[ [[
yylineno++; yylineno++;
]]) ]])
@ -493,7 +493,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
[[ [[
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
* access to the local variable yy_act. Since yyless() is a macro, it would break * access to the local variable yy_act. Since yyless() is a macro, it would break
* existing scanners that call yyless() from OUTSIDE yylex. * existing scanners that call yyless() from OUTSIDE yylex.
* One obvious solution it to make yy_act a global. I tried that, and saw * One obvious solution it to make yy_act a global. I tried that, and saw
* a 5% performance hit in a non-yylineno scanner, because yy_act is * a 5% performance hit in a non-yylineno scanner, because yy_act is
* normally declared as a register variable-- so it is not worth it. * normally declared as a register variable-- so it is not worth it.
@ -588,7 +588,7 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */ int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */ int yy_bs_column; /**< The column count. */
/* Whether to try to fill the input buffer when we reach the /* Whether to try to fill the input buffer when we reach the
* end of it. * end of it.
@ -1175,7 +1175,7 @@ int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
/** Describes a mapping from a serialized table id to its deserialized state in /** Describes a mapping from a serialized table id to its deserialized state in
* this scanner. This is the bridge between our "generic" deserialization code * this scanner. This is the bridge between our "generic" deserialization code
* and the specifics of this scanner. * and the specifics of this scanner.
*/ */
struct yytbl_dmap { struct yytbl_dmap {
enum yytbl_id dm_id;/**< table identifier */ enum yytbl_id dm_id;/**< table identifier */
@ -2272,10 +2272,10 @@ void yyFlexLexer::yyensure_buffer_stack(void)
M4_YY_CALL_LAST_ARG); M4_YY_CALL_LAST_ARG);
if ( ! YY_G(yy_buffer_stack) ) if ( ! YY_G(yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
YY_G(yy_buffer_stack_max) = num_to_alloc; YY_G(yy_buffer_stack_max) = num_to_alloc;
YY_G(yy_buffer_stack_top) = 0; YY_G(yy_buffer_stack_top) = 0;
return; return;
@ -2311,7 +2311,7 @@ m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
* @param base the character buffer * @param base the character buffer
* @param size the size in bytes of the character buffer * @param size the size in bytes of the character buffer
* M4_YY_DOC_PARAM * M4_YY_DOC_PARAM
* @return the newly allocated buffer state object. * @return the newly allocated buffer state object.
*/ */
YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size) YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
{ {
@ -2543,7 +2543,7 @@ m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
int yyget_lineno YYFARGS0(void) int yyget_lineno YYFARGS0(void)
{ {
M4_YY_DECL_GUTS_VAR(); M4_YY_DECL_GUTS_VAR();
m4_ifdef( [[M4_YY_REENTRANT]], m4_ifdef( [[M4_YY_REENTRANT]],
[[ [[
if (! YY_CURRENT_BUFFER) if (! YY_CURRENT_BUFFER)
@ -2563,7 +2563,7 @@ m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
int yyget_column YYFARGS0(void) int yyget_column YYFARGS0(void)
{ {
M4_YY_DECL_GUTS_VAR(); M4_YY_DECL_GUTS_VAR();
m4_ifdef( [[M4_YY_REENTRANT]], m4_ifdef( [[M4_YY_REENTRANT]],
[[ [[
if (! YY_CURRENT_BUFFER) if (! YY_CURRENT_BUFFER)
@ -2830,20 +2830,20 @@ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
errno = EINVAL; errno = EINVAL;
return 1; return 1;
} }
*ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
if (*ptr_yy_globals == NULL){ if (*ptr_yy_globals == NULL){
errno = ENOMEM; errno = ENOMEM;
return 1; return 1;
} }
/* By setting to 0xAA, we expose bugs in /* By setting to 0xAA, we expose bugs in
yy_init_globals. Leave at 0x00 for releases. */ yy_init_globals. Leave at 0x00 for releases. */
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
yyset_extra (yy_user_defined, *ptr_yy_globals); yyset_extra (yy_user_defined, *ptr_yy_globals);
return yy_init_globals ( *ptr_yy_globals ); return yy_init_globals ( *ptr_yy_globals );
} }
@ -3118,7 +3118,7 @@ static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
return NULL; return NULL;
} }
/** Read a table while mapping its contents to the local array. /** Read a table while mapping its contents to the local array.
* @param dmap used to performing mapping * @param dmap used to performing mapping
* @return 0 on success * @return 0 on success
*/ */
@ -3163,7 +3163,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read
if(M4_YY_TABLES_VERIFY) if(M4_YY_TABLES_VERIFY)
/* We point to the array itself */ /* We point to the array itself */
p = dmap->dm_arr; p = dmap->dm_arr;
else else
/* We point to the address of a pointer. */ /* We point to the address of a pointer. */
*dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG); *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
@ -3210,7 +3210,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read
rv = yytbl_read8 (&t8, rd); rv = yytbl_read8 (&t8, rd);
t32 = t8; t32 = t8;
break; break;
default: default:
YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */ YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */
return -1; return -1;
} }
@ -3267,7 +3267,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read
YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */ YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */
return -1; return -1;
} }
if( M4_YY_TABLES_VERIFY) if( M4_YY_TABLES_VERIFY)
v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]); v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
else else
@ -3278,7 +3278,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read
YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" ); YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" );
}else }else
((struct yy_trans_info **) p)[0] = v; ((struct yy_trans_info **) p)[0] = v;
/* increment p */ /* increment p */
p = (struct yy_trans_info **) p + 1; p = (struct yy_trans_info **) p + 1;
} }
@ -3394,7 +3394,7 @@ int yytables_fload YYFARGS1(FILE *, fp)
/** Destroy the loaded tables, freeing memory, etc.. */ /** Destroy the loaded tables, freeing memory, etc.. */
int yytables_destroy YYFARGS0(void) int yytables_destroy YYFARGS0(void)
{ {
struct yytbl_dmap *dmap=0; struct yytbl_dmap *dmap=0;
if(!M4_YY_TABLES_VERIFY){ if(!M4_YY_TABLES_VERIFY){

View File

@ -10,7 +10,7 @@
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types. * if you want the limit (max/min) macros for int types.
*/ */
#ifndef __STDC_LIMIT_MACROS #ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1 #define __STDC_LIMIT_MACROS 1
@ -27,7 +27,7 @@ typedef uint32_t flex_uint32_t;
typedef signed char flex_int8_t; typedef signed char flex_int8_t;
typedef short int flex_int16_t; typedef short int flex_int16_t;
typedef int flex_int32_t; typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t; typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t; typedef unsigned int flex_uint32_t;

View File

@ -84,7 +84,7 @@ get_state_decl(void)
/* Indent to the current level. */ /* Indent to the current level. */
void void
do_indent() do_indent()
{ {
int i = indent_level * 8; int i = indent_level * 8;
@ -128,7 +128,7 @@ mkeoltbl(void)
} }
/* Generate the table for possible eol matches. */ /* Generate the table for possible eol matches. */
static void static void
geneoltbl() geneoltbl()
{ {
int i; int i;
@ -153,7 +153,7 @@ geneoltbl()
/* Generate the code to keep backing-up information. */ /* Generate the code to keep backing-up information. */
void void
gen_backing_up() gen_backing_up()
{ {
if (reject || num_backing_up == 0) if (reject || num_backing_up == 0)
@ -175,7 +175,7 @@ gen_backing_up()
/* Generate the code to perform the backing up. */ /* Generate the code to perform the backing up. */
void void
gen_bu_action() gen_bu_action()
{ {
if (reject || num_backing_up == 0) if (reject || num_backing_up == 0)
@ -238,7 +238,7 @@ mkctbl(void)
* The offset is base[nxt[i]] - (base of current state)]. That's * The offset is base[nxt[i]] - (base of current state)]. That's
* just the difference between the starting points of the two * just the difference between the starting points of the two
* involved states (to - from). * involved states (to - from).
* *
* First, though, we need to find some way to put in our end-of-buffer * First, though, we need to find some way to put in our end-of-buffer
* flags and states. We do this by making a state with absolutely no * flags and states. We do this by making a state with absolutely no
* transitions. We put it at the end of the table. * transitions. We put it at the end of the table.
@ -341,7 +341,7 @@ mkssltbl(void)
/* genctbl - generates full speed compressed transition table */ /* genctbl - generates full speed compressed transition table */
void void
genctbl() genctbl()
{ {
int i; int i;
@ -359,7 +359,7 @@ genctbl()
* The offset is base[nxt[i]] - (base of current state)]. That's * The offset is base[nxt[i]] - (base of current state)]. That's
* just the difference between the starting points of the two * just the difference between the starting points of the two
* involved states (to - from). * involved states (to - from).
* *
* First, though, we need to find some way to put in our end-of-buffer * First, though, we need to find some way to put in our end-of-buffer
* flags and states. We do this by making a state with absolutely no * flags and states. We do this by making a state with absolutely no
* transitions. We put it at the end of the table. * transitions. We put it at the end of the table.
@ -475,7 +475,7 @@ mkecstbl(void)
/* Generate equivalence-class tables. */ /* Generate equivalence-class tables. */
void void
genecs() genecs()
{ {
int i, j; int i, j;
@ -511,7 +511,7 @@ genecs()
/* Generate the code to find the action number. */ /* Generate the code to find the action number. */
void void
gen_find_action() gen_find_action()
{ {
if (fullspd) if (fullspd)
@ -689,7 +689,7 @@ mkftbl(void)
/* genftbl - generate full transition table */ /* genftbl - generate full transition table */
void void
genftbl() genftbl()
{ {
int i; int i;
@ -724,7 +724,7 @@ genftbl()
/* Generate the code to find the next compressed-table state. */ /* Generate the code to find the next compressed-table state. */
void void
gen_next_compressed_state(char_map) gen_next_compressed_state(char_map)
char *char_map; char *char_map;
{ {
@ -770,7 +770,7 @@ gen_next_compressed_state(char_map)
/* Generate the code to find the next match. */ /* Generate the code to find the next match. */
void void
gen_next_match() gen_next_match()
{ {
/* /*
@ -872,7 +872,7 @@ gen_next_match()
/* Generate the code to find the next state. */ /* Generate the code to find the next state. */
void void
gen_next_state(worry_about_NULs) gen_next_state(worry_about_NULs)
int worry_about_NULs; int worry_about_NULs;
{ /* NOTE - changes in here should be reflected { /* NOTE - changes in here should be reflected
@ -939,7 +939,7 @@ gen_next_state(worry_about_NULs)
/* Generate the code to make a NUL transition. */ /* Generate the code to make a NUL transition. */
void void
gen_NUL_trans() gen_NUL_trans()
{ /* NOTE - changes in here should be reflected { /* NOTE - changes in here should be reflected
* in gen_next_match() */ * in gen_next_match() */
@ -1024,7 +1024,7 @@ gen_NUL_trans()
/* Generate the code to find the start state. */ /* Generate the code to find the start state. */
void void
gen_start_state() gen_start_state()
{ {
if (fullspd) { if (fullspd) {
@ -1055,7 +1055,7 @@ gen_start_state()
/* gentabs - generate data statements for the transition tables */ /* gentabs - generate data statements for the transition tables */
void void
gentabs() gentabs()
{ {
int i, j, k, *accset, nacc, *acc_array, total_states; int i, j, k, *accset, nacc, *acc_array, total_states;
@ -1080,7 +1080,7 @@ gentabs()
if (reject) { if (reject) {
/* /*
* Write out accepting list and pointer list. * Write out accepting list and pointer list.
* *
* First we generate the "yy_acclist" array. In the process, we * First we generate the "yy_acclist" array. In the process, we
* compute the indices that will go into the "yy_accept" * compute the indices that will go into the "yy_accept"
* array, and save the indices in the dfaacc array. * array, and save the indices in the dfaacc array.
@ -1474,7 +1474,7 @@ gentabs()
* current indentation level, adding a final newline. * current indentation level, adding a final newline.
*/ */
void void
indent_put2s(fmt, arg) indent_put2s(fmt, arg)
const char *fmt, *arg; const char *fmt, *arg;
{ {
@ -1488,7 +1488,7 @@ indent_put2s(fmt, arg)
* newline. * newline.
*/ */
void void
indent_puts(str) indent_puts(str)
const char *str; const char *str;
{ {
@ -1500,7 +1500,7 @@ indent_puts(str)
/* make_tables - generate transition tables and finishes generating output file /* make_tables - generate transition tables and finishes generating output file
*/ */
void void
make_tables() make_tables()
{ {
int i; int i;

View File

@ -25,7 +25,7 @@
extern int yylex(); extern int yylex();
int int
main(argc, argv) main(argc, argv)
int argc; int argc;
char *argv[]; char *argv[];

View File

@ -23,7 +23,7 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */ /* PURPOSE. */
int int
yywrap(void) yywrap(void)
{ {
return 1; return 1;

View File

@ -58,7 +58,7 @@ struct sko_state {
}; };
static struct sko_state *sko_stack = 0; static struct sko_state *sko_stack = 0;
static int sko_len = 0, sko_sz = 0; static int sko_len = 0, sko_sz = 0;
static void static void
sko_push(bool dc) sko_push(bool dc)
{ {
if (!sko_stack) { if (!sko_stack) {
@ -76,7 +76,7 @@ sko_push(bool dc)
sko_stack[sko_len].dc = dc; sko_stack[sko_len].dc = dc;
sko_len++; sko_len++;
} }
static void static void
sko_peek(bool * dc) sko_peek(bool * dc)
{ {
if (sko_len <= 0) if (sko_len <= 0)
@ -84,7 +84,7 @@ sko_peek(bool * dc)
if (dc) if (dc)
*dc = sko_stack[sko_len - 1].dc; *dc = sko_stack[sko_len - 1].dc;
} }
static void static void
sko_pop(bool * dc) sko_pop(bool * dc)
{ {
sko_peek(dc); sko_peek(dc);
@ -94,7 +94,7 @@ sko_pop(bool * dc)
} }
/* Append "#define defname value\n" to the running buffer. */ /* Append "#define defname value\n" to the running buffer. */
void void
action_define(defname, value) action_define(defname, value)
const char *defname; const char *defname;
int value; int value;
@ -121,7 +121,7 @@ action_define(defname, value)
* @param defname The macro name. * @param defname The macro name.
* @param value The macro value, can be NULL, which is the same as the empty string. * @param value The macro value, can be NULL, which is the same as the empty string.
*/ */
void void
action_m4_define(const char *defname, const char *value) action_m4_define(const char *defname, const char *value)
{ {
char buf[MAXLINE]; char buf[MAXLINE];
@ -139,7 +139,7 @@ action_m4_define(const char *defname, const char *value)
} }
/* Append "new_text" to the running buffer. */ /* Append "new_text" to the running buffer. */
void void
add_action(new_text) add_action(new_text)
const char *new_text; const char *new_text;
{ {
@ -190,7 +190,7 @@ allocate_array(size, element_size)
/* all_lower - true if a string is all lower-case */ /* all_lower - true if a string is all lower-case */
int int
all_lower(str) all_lower(str)
char *str; char *str;
{ {
@ -206,7 +206,7 @@ all_lower(str)
/* all_upper - true if a string is all upper-case */ /* all_upper - true if a string is all upper-case */
int int
all_upper(str) all_upper(str)
char *str; char *str;
{ {
@ -222,7 +222,7 @@ all_upper(str)
/* intcmp - compares two integers for use by qsort. */ /* intcmp - compares two integers for use by qsort. */
int int
intcmp(const void *a, const void *b) intcmp(const void *a, const void *b)
{ {
return *(const int *) a - *(const int *) b; return *(const int *) a - *(const int *) b;
@ -234,7 +234,7 @@ intcmp(const void *a, const void *b)
* and exits. * and exits.
*/ */
void void
check_char(c) check_char(c)
int c; int c;
{ {
@ -252,7 +252,7 @@ check_char(c)
/* clower - replace upper-case letter to lower-case */ /* clower - replace upper-case letter to lower-case */
u_char u_char
clower(c) clower(c)
int c; int c;
{ {
@ -311,7 +311,7 @@ copy_unsigned_string(str)
/* cclcmp - compares two characters for use by qsort with '\0' sorting last. */ /* cclcmp - compares two characters for use by qsort with '\0' sorting last. */
int int
cclcmp(const void *a, const void *b) cclcmp(const void *a, const void *b)
{ {
if (!*(const u_char *) a) if (!*(const u_char *) a)
@ -325,7 +325,7 @@ cclcmp(const void *a, const void *b)
/* dataend - finish up a block of data declarations */ /* dataend - finish up a block of data declarations */
void void
dataend() dataend()
{ {
/* short circuit any output */ /* short circuit any output */
@ -344,7 +344,7 @@ dataend()
/* dataflush - flush generated data statements */ /* dataflush - flush generated data statements */
void void
dataflush() dataflush()
{ {
/* short circuit any output */ /* short circuit any output */
@ -368,7 +368,7 @@ dataflush()
/* flexerror - report an error message and terminate */ /* flexerror - report an error message and terminate */
void void
flexerror(msg) flexerror(msg)
const char *msg; const char *msg;
{ {
@ -379,7 +379,7 @@ flexerror(msg)
/* flexfatal - report a fatal error message and terminate */ /* flexfatal - report a fatal error message and terminate */
void void
flexfatal(msg) flexfatal(msg)
const char *msg; const char *msg;
{ {
@ -391,7 +391,7 @@ flexfatal(msg)
/* htoi - convert a hexadecimal digit string to an integer value */ /* htoi - convert a hexadecimal digit string to an integer value */
int int
htoi(str) htoi(str)
u_char str[]; u_char str[];
{ {
@ -405,7 +405,7 @@ htoi(str)
/* lerrif - report an error message formatted with one integer argument */ /* lerrif - report an error message formatted with one integer argument */
void void
lerrif(msg, arg) lerrif(msg, arg)
const char *msg; const char *msg;
int arg; int arg;
@ -419,7 +419,7 @@ lerrif(msg, arg)
/* lerrsf - report an error message formatted with one string argument */ /* lerrsf - report an error message formatted with one string argument */
void void
lerrsf(msg, arg) lerrsf(msg, arg)
const char *msg, arg[]; const char *msg, arg[];
{ {
@ -433,7 +433,7 @@ lerrsf(msg, arg)
/* lerrsf_fatal - as lerrsf, but call flexfatal */ /* lerrsf_fatal - as lerrsf, but call flexfatal */
void void
lerrsf_fatal(msg, arg) lerrsf_fatal(msg, arg)
const char *msg, arg[]; const char *msg, arg[];
{ {
@ -447,7 +447,7 @@ lerrsf_fatal(msg, arg)
/* line_directive_out - spit out a "#line" statement */ /* line_directive_out - spit out a "#line" statement */
void void
line_directive_out(output_file, do_infile) line_directive_out(output_file, do_infile)
FILE *output_file; FILE *output_file;
int do_infile; int do_infile;
@ -498,7 +498,7 @@ line_directive_out(output_file, do_infile)
* representing where the user's section 1 definitions end * representing where the user's section 1 definitions end
* and the prolog begins * and the prolog begins
*/ */
void void
mark_defs1() mark_defs1()
{ {
defs1_offset = 0; defs1_offset = 0;
@ -511,7 +511,7 @@ mark_defs1()
/* mark_prolog - mark the current position in the action array as /* mark_prolog - mark the current position in the action array as
* representing the end of the action prolog * representing the end of the action prolog
*/ */
void void
mark_prolog() mark_prolog()
{ {
action_array[action_index++] = '\0'; action_array[action_index++] = '\0';
@ -524,7 +524,7 @@ mark_prolog()
* *
* Generates a data statement initializing the current 2-D array to "value". * Generates a data statement initializing the current 2-D array to "value".
*/ */
void void
mk2data(value) mk2data(value)
int value; int value;
{ {
@ -554,7 +554,7 @@ mk2data(value)
* Generates a data statement initializing the current array element to * Generates a data statement initializing the current array element to
* "value". * "value".
*/ */
void void
mkdata(value) mkdata(value)
int value; int value;
{ {
@ -580,7 +580,7 @@ mkdata(value)
/* myctoi - return the integer represented by a string of digits */ /* myctoi - return the integer represented by a string of digits */
int int
myctoi(array) myctoi(array)
const char *array; const char *array;
{ {
@ -594,7 +594,7 @@ myctoi(array)
/* myesc - return character corresponding to escape sequence */ /* myesc - return character corresponding to escape sequence */
u_char u_char
myesc(array) myesc(array)
u_char array[]; u_char array[];
{ {
@ -685,7 +685,7 @@ myesc(array)
/* otoi - convert an octal digit string to an integer value */ /* otoi - convert an octal digit string to an integer value */
int int
otoi(str) otoi(str)
u_char str[]; u_char str[];
{ {
@ -700,14 +700,14 @@ otoi(str)
* generated scanner, keeping track of the line count. * generated scanner, keeping track of the line count.
*/ */
void void
out(str) out(str)
const char *str; const char *str;
{ {
fputs(str, stdout); fputs(str, stdout);
} }
void void
out_dec(fmt, n) out_dec(fmt, n)
const char *fmt; const char *fmt;
int n; int n;
@ -715,7 +715,7 @@ out_dec(fmt, n)
fprintf(stdout, fmt, n); fprintf(stdout, fmt, n);
} }
void void
out_dec2(fmt, n1, n2) out_dec2(fmt, n1, n2)
const char *fmt; const char *fmt;
int n1, n2; int n1, n2;
@ -723,7 +723,7 @@ out_dec2(fmt, n1, n2)
fprintf(stdout, fmt, n1, n2); fprintf(stdout, fmt, n1, n2);
} }
void void
out_hex(fmt, x) out_hex(fmt, x)
const char *fmt; const char *fmt;
unsigned int x; unsigned int x;
@ -731,21 +731,21 @@ out_hex(fmt, x)
fprintf(stdout, fmt, x); fprintf(stdout, fmt, x);
} }
void void
out_str(fmt, str) out_str(fmt, str)
const char *fmt, str[]; const char *fmt, str[];
{ {
fprintf(stdout, fmt, str); fprintf(stdout, fmt, str);
} }
void void
out_str3(fmt, s1, s2, s3) out_str3(fmt, s1, s2, s3)
const char *fmt, s1[], s2[], s3[]; const char *fmt, s1[], s2[], s3[];
{ {
fprintf(stdout, fmt, s1, s2, s3); fprintf(stdout, fmt, s1, s2, s3);
} }
void void
out_str_dec(fmt, str, n) out_str_dec(fmt, str, n)
const char *fmt, str[]; const char *fmt, str[];
int n; int n;
@ -753,14 +753,14 @@ out_str_dec(fmt, str, n)
fprintf(stdout, fmt, str, n); fprintf(stdout, fmt, str, n);
} }
void void
outc(c) outc(c)
int c; int c;
{ {
fputc(c, stdout); fputc(c, stdout);
} }
void void
outn(str) outn(str)
const char *str; const char *str;
{ {
@ -773,7 +773,7 @@ outn(str)
* @param val The definition; may be NULL. * @param val The definition; may be NULL.
* @return buf * @return buf
*/ */
void void
out_m4_define(const char *def, const char *val) out_m4_define(const char *def, const char *val)
{ {
const char *fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n"; const char *fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n";
@ -853,7 +853,7 @@ reallocate_array(array, size, element_size)
* Copies skelfile or skel array to stdout until a line beginning with * Copies skelfile or skel array to stdout until a line beginning with
* "%%" or EOF is found. * "%%" or EOF is found.
*/ */
void void
skelout() skelout()
{ {
char buf_storage[MAXLINE]; char buf_storage[MAXLINE];
@ -968,7 +968,7 @@ skelout()
* element_n. Formats the output with spaces and carriage returns. * element_n. Formats the output with spaces and carriage returns.
*/ */
void void
transition_struct_out(element_v, element_n) transition_struct_out(element_v, element_n)
int element_v, element_n; int element_v, element_n;
{ {

View File

@ -47,7 +47,7 @@ void mkxtion PROTO((int, int));
* accepting_number becomes mach's accepting number. * accepting_number becomes mach's accepting number.
*/ */
void void
add_accept(mach, accepting_number) add_accept(mach, accepting_number)
int mach, accepting_number; int mach, accepting_number;
{ {
@ -81,7 +81,7 @@ add_accept(mach, accepting_number)
* num - the number of copies of singl to be present in newsng * num - the number of copies of singl to be present in newsng
*/ */
int int
copysingl(singl, num) copysingl(singl, num)
int singl, num; int singl, num;
{ {
@ -98,7 +98,7 @@ copysingl(singl, num)
/* dumpnfa - debugging routine to write out an nfa */ /* dumpnfa - debugging routine to write out an nfa */
void void
dumpnfa(state1) dumpnfa(state1)
int state1; int state1;
@ -155,7 +155,7 @@ dumpnfa(state1)
* states accessible by the arrays firstst and lastst * states accessible by the arrays firstst and lastst
*/ */
int int
dupmachine(mach) dupmachine(mach)
int mach; int mach;
{ {
@ -203,7 +203,7 @@ dupmachine(mach)
* context has variable length. * context has variable length.
*/ */
void void
finish_rule(mach, variable_trail_rule, headcnt, trailcnt, finish_rule(mach, variable_trail_rule, headcnt, trailcnt,
pcont_act) pcont_act)
int mach, variable_trail_rule, headcnt, trailcnt, pcont_act; int mach, variable_trail_rule, headcnt, trailcnt, pcont_act;
@ -318,7 +318,7 @@ finish_rule(mach, variable_trail_rule, headcnt, trailcnt,
* FIRST is set to new by the operation. last is unmolested. * FIRST is set to new by the operation. last is unmolested.
*/ */
int int
link_machines(first, last) link_machines(first, last)
int first, last; int first, last;
{ {
@ -346,7 +346,7 @@ link_machines(first, last)
* The "beginning" states are the epsilon closure of the first state * The "beginning" states are the epsilon closure of the first state
*/ */
void void
mark_beginning_as_normal(mach) mark_beginning_as_normal(mach)
int mach; int mach;
{ {
@ -389,7 +389,7 @@ mark_beginning_as_normal(mach)
* more mkbranch's. Compare with mkor() * more mkbranch's. Compare with mkor()
*/ */
int int
mkbranch(first, second) mkbranch(first, second)
int first, second; int first, second;
{ {
@ -418,7 +418,7 @@ mkbranch(first, second)
* new - a new state which matches the closure of "state" * new - a new state which matches the closure of "state"
*/ */
int int
mkclos(state) mkclos(state)
int state; int state;
{ {
@ -440,7 +440,7 @@ mkclos(state)
* 2. mach is destroyed by the call * 2. mach is destroyed by the call
*/ */
int int
mkopt(mach) mkopt(mach)
int mach; int mach;
{ {
@ -478,7 +478,7 @@ mkopt(mach)
* the number of epsilon states needed * the number of epsilon states needed
*/ */
int int
mkor(first, second) mkor(first, second)
int first, second; int first, second;
{ {
@ -533,7 +533,7 @@ mkor(first, second)
* new - a machine matching the positive closure of "state" * new - a machine matching the positive closure of "state"
*/ */
int int
mkposcl(state) mkposcl(state)
int state; int state;
{ {
@ -562,7 +562,7 @@ mkposcl(state)
* if "ub" is INFINITE_REPEAT then "new" matches "lb" or more occurrences of "mach" * if "ub" is INFINITE_REPEAT then "new" matches "lb" or more occurrences of "mach"
*/ */
int int
mkrep(mach, lb, ub) mkrep(mach, lb, ub)
int mach, lb, ub; int mach, lb, ub;
{ {
@ -608,7 +608,7 @@ mkrep(mach, lb, ub)
* that it admittedly is) * that it admittedly is)
*/ */
int int
mkstate(sym) mkstate(sym)
int sym; int sym;
{ {
@ -685,7 +685,7 @@ mkstate(sym)
* stateto - the state to which the transition is to be made * stateto - the state to which the transition is to be made
*/ */
void void
mkxtion(statefrom, stateto) mkxtion(statefrom, stateto)
int statefrom, stateto; int statefrom, stateto;
{ {
@ -704,7 +704,7 @@ mkxtion(statefrom, stateto)
/* new_rule - initialize for a new rule */ /* new_rule - initialize for a new rule */
void void
new_rule() new_rule()
{ {
if (++num_rules >= current_max_rules) { if (++num_rules >= current_max_rules) {

View File

@ -76,7 +76,7 @@ optspec_t flexopts[] = {
, ,
{"--case-insensitive", OPT_CASE_INSENSITIVE, 0} {"--case-insensitive", OPT_CASE_INSENSITIVE, 0}
, /* Generate case-insensitive scanner. */ , /* Generate case-insensitive scanner. */
{"-C[aefFmr]", OPT_COMPRESSION, {"-C[aefFmr]", OPT_COMPRESSION,
"Specify degree of table compression (default is -Cem)"}, "Specify degree of table compression (default is -Cem)"},
{"-+", OPT_CPLUSPLUS, 0} {"-+", OPT_CPLUSPLUS, 0}

View File

@ -32,7 +32,7 @@
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */ /* PURPOSE. */
#ifndef OPTIONS_H #ifndef OPTIONS_H
#define OPTIONS_H #define OPTIONS_H
#include "scanopt.h" #include "scanopt.h"

View File

@ -291,7 +291,7 @@ flexrule : '^' rule
{ {
if ( scon_stk_ptr > 0 ) if ( scon_stk_ptr > 0 )
build_eof_action(); build_eof_action();
else else
{ {
/* This EOF applies to all start conditions /* This EOF applies to all start conditions
@ -422,7 +422,7 @@ rule : re2 re
num_rules | YY_TRAILING_HEAD_MASK ); num_rules | YY_TRAILING_HEAD_MASK );
variable_trail_rule = true; variable_trail_rule = true;
} }
else else
trailcnt = rulelen; trailcnt = rulelen;
@ -774,7 +774,7 @@ fullccl:
| braceccl | braceccl
; ;
braceccl: braceccl:
'[' ccl ']' { $$ = $2; } '[' ccl ']' { $$ = $2; }
@ -832,7 +832,7 @@ ccl : ccl CHAR '-' CHAR
if (sf_case_ins() && has_case($2) && has_case($4)){ if (sf_case_ins() && has_case($2) && has_case($4)){
$2 = reverse_case ($2); $2 = reverse_case ($2);
$4 = reverse_case ($4); $4 = reverse_case ($4);
for ( i = $2; i <= $4; ++i ) for ( i = $2; i <= $4; ++i )
ccladd( $1, i ); ccladd( $1, i );
@ -878,14 +878,14 @@ ccl : ccl CHAR '-' CHAR
} }
; ;
ccl_expr: ccl_expr:
CCE_ALNUM { CCL_EXPR(isalnum); } CCE_ALNUM { CCL_EXPR(isalnum); }
| CCE_ALPHA { CCL_EXPR(isalpha); } | CCE_ALPHA { CCL_EXPR(isalpha); }
| CCE_BLANK { CCL_EXPR(isblank); } | CCE_BLANK { CCL_EXPR(isblank); }
| CCE_CNTRL { CCL_EXPR(iscntrl); } | CCE_CNTRL { CCL_EXPR(iscntrl); }
| CCE_DIGIT { CCL_EXPR(isdigit); } | CCE_DIGIT { CCL_EXPR(isdigit); }
| CCE_GRAPH { CCL_EXPR(isgraph); } | CCE_GRAPH { CCL_EXPR(isgraph); }
| CCE_LOWER { | CCE_LOWER {
CCL_EXPR(islower); CCL_EXPR(islower);
if (sf_case_ins()) if (sf_case_ins())
CCL_EXPR(isupper); CCL_EXPR(isupper);
@ -910,7 +910,7 @@ ccl_expr:
| CCE_NEG_PUNCT { CCL_NEG_EXPR(ispunct); } | CCE_NEG_PUNCT { CCL_NEG_EXPR(ispunct); }
| CCE_NEG_SPACE { CCL_NEG_EXPR(isspace); } | CCE_NEG_SPACE { CCL_NEG_EXPR(isspace); }
| CCE_NEG_XDIGIT { CCL_NEG_EXPR(isxdigit); } | CCE_NEG_XDIGIT { CCL_NEG_EXPR(isxdigit); }
| CCE_NEG_LOWER { | CCE_NEG_LOWER {
if ( sf_case_ins() ) if ( sf_case_ins() )
warn(_("[:^lower:] is ambiguous in case insensitive scanner")); warn(_("[:^lower:] is ambiguous in case insensitive scanner"));
else else
@ -923,7 +923,7 @@ ccl_expr:
CCL_NEG_EXPR(isupper); CCL_NEG_EXPR(isupper);
} }
; ;
string : string CHAR string : string CHAR
{ {
if ( $2 == nlch ) if ( $2 == nlch )

View File

@ -225,7 +225,7 @@ M4QEND "]]"
<EXTENDED_COMMENT>{ <EXTENDED_COMMENT>{
")" yy_pop_state(); ")" yy_pop_state();
[^\n\)]+ ; [^\n\)]+ ;
{NL} ++linenum; {NL} ++linenum;
} }
<LINEDIR>{ <LINEDIR>{
@ -725,7 +725,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
if (lex_compat || posix_compat){ if (lex_compat || posix_compat){
/* Push back the "?#" and treat it like a normal parens. */ /* Push back the "?#" and treat it like a normal parens. */
yyless(1); yyless(1);
sf_push(); sf_push();
return '('; return '(';
} }
else else

View File

@ -586,7 +586,7 @@ static int scanopt_err (s, opt_offset, is_short, err)
} }
return err; return err;
} }
/* Internal. Match str against the regex ^--([^=]+)(=(.*))? /* Internal. Match str against the regex ^--([^=]+)(=(.*))?
* return 1 if *looks* like a long option. * return 1 if *looks* like a long option.
@ -634,7 +634,7 @@ static int matchlongopt (str, optname, optlen, arg, arglen)
return 1; return 1;
} }
/* Internal. Look up long or short option by name. /* Internal. Look up long or short option by name.
* Long options must match a non-ambiguous prefix, or exact match. * Long options must match a non-ambiguous prefix, or exact match.
@ -704,7 +704,7 @@ static int find_opt (s, lookup_long, optstart, len, err_code, opt_offset)
return *err_code ? 0 : 1; return *err_code ? 0 : 1;
} }
int scanopt (svoid, arg, optindex) int scanopt (svoid, arg, optindex)
scanopt_t *svoid; scanopt_t *svoid;

View File

@ -32,7 +32,7 @@
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */ /* PURPOSE. */
#ifndef SCANOPT_H #ifndef SCANOPT_H
#define SCANOPT_H #define SCANOPT_H
@ -77,7 +77,7 @@ extern "C" {
/* Used internally by scanopt() to maintain state. */ /* Used internally by scanopt() to maintain state. */
/* Never modify these value directly. */ /* Never modify these value directly. */
typedef void *scanopt_t; typedef void *scanopt_t;
/* Initializes scanner and checks option list for errors. /* Initializes scanner and checks option list for errors.
* Parameters: * Parameters:

View File

@ -33,14 +33,14 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. * PURPOSE.
*/ */
#include "flexdef.h" #include "flexdef.h"
#include "tables.h" #include "tables.h"
/** Convert size_t to t_flag. /** Convert size_t to t_flag.
* @param n in {1,2,4} * @param n in {1,2,4}
* @return YYTD_DATA*. * @return YYTD_DATA*.
*/ */
#define BYTES2TFLAG(n)\ #define BYTES2TFLAG(n)\
(((n) == sizeof(flex_int8_t))\ (((n) == sizeof(flex_int8_t))\
@ -329,7 +329,7 @@ int yytbl_write8 (struct yytbl_writer *wr, flex_uint8_t v)
/** Extract data element [i] from array data tables treated as a single flat array of integers. /** Extract data element [i] from array data tables treated as a single flat array of integers.
* Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array * Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array
* of structs. * of structs.
* @param tbl data table * @param tbl data table
* @param i index into array. * @param i index into array.
* @return data[i] * @return data[i]
@ -353,7 +353,7 @@ static flex_int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i)
/** Set data element [i] in array data tables treated as a single flat array of integers. /** Set data element [i] in array data tables treated as a single flat array of integers.
* Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array * Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array
* of structs. * of structs.
* @param tbl data table * @param tbl data table
* @param i index into array. * @param i index into array.
* @param newval new value for data[i] * @param newval new value for data[i]

View File

@ -33,7 +33,7 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. * PURPOSE.
*/ */
#ifndef TABLES_H #ifndef TABLES_H
#define TABLES_H #define TABLES_H

View File

@ -3,42 +3,42 @@
#ifdef FLEX_SCANNER #ifdef FLEX_SCANNER
/* /*
dnl tables_shared.c - tables serialization code dnl tables_shared.c - tables serialization code
dnl dnl
dnl Copyright (c) 1990 The Regents of the University of California. dnl Copyright (c) 1990 The Regents of the University of California.
dnl All rights reserved. dnl All rights reserved.
dnl dnl
dnl This code is derived from software contributed to Berkeley by dnl This code is derived from software contributed to Berkeley by
dnl Vern Paxson. dnl Vern Paxson.
dnl dnl
dnl The United States Government has rights in this work pursuant dnl The United States Government has rights in this work pursuant
dnl to contract no. DE-AC03-76SF00098 between the United States dnl to contract no. DE-AC03-76SF00098 between the United States
dnl Department of Energy and the University of California. dnl Department of Energy and the University of California.
dnl dnl
dnl This file is part of flex. dnl This file is part of flex.
dnl dnl
dnl Redistribution and use in source and binary forms, with or without dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions dnl modification, are permitted provided that the following conditions
dnl are met: dnl are met:
dnl dnl
dnl 1. Redistributions of source code must retain the above copyright dnl 1. Redistributions of source code must retain the above copyright
dnl notice, this list of conditions and the following disclaimer. dnl notice, this list of conditions and the following disclaimer.
dnl 2. Redistributions in binary form must reproduce the above copyright dnl 2. Redistributions in binary form must reproduce the above copyright
dnl notice, this list of conditions and the following disclaimer in the dnl notice, this list of conditions and the following disclaimer in the
dnl documentation and/or other materials provided with the distribution. dnl documentation and/or other materials provided with the distribution.
dnl dnl
dnl Neither the name of the University nor the names of its contributors dnl Neither the name of the University nor the names of its contributors
dnl may be used to endorse or promote products derived from this software dnl may be used to endorse or promote products derived from this software
dnl without specific prior written permission. dnl without specific prior written permission.
dnl dnl
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
dnl PURPOSE. dnl PURPOSE.
dnl dnl
*/ */
/* This file is meant to be included in both the skeleton and the actual /* This file is meant to be included in both the skeleton and the actual
* flex code (hence the name "_shared"). * flex code (hence the name "_shared").
*/ */
#ifndef yyskel_static #ifndef yyskel_static
#define yyskel_static static #define yyskel_static static
@ -54,7 +54,7 @@ dnl
/** Get the number of integers in this table. This is NOT the /** Get the number of integers in this table. This is NOT the
* same thing as the number of elements. * same thing as the number of elements.
* @param td the table * @param td the table
* @return the number of integers in the table * @return the number of integers in the table
*/ */
yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl) yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)

View File

@ -34,7 +34,7 @@ dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
dnl PURPOSE. dnl PURPOSE.
dnl dnl
dnl This file is meant to be included in both the skeleton and the actual dnl This file is meant to be included in both the skeleton and the actual
dnl flex code (hence the name "_shared"). dnl flex code (hence the name "_shared").

View File

@ -80,7 +80,7 @@ int tbldiff PROTO((int[], int, int[]));
* cost only one difference. * cost only one difference.
*/ */
void void
bldtbl(state, statenum, totaltrans, comstate, comfreq) bldtbl(state, statenum, totaltrans, comstate, comfreq)
int state[], statenum, totaltrans, comstate, comfreq; int state[], statenum, totaltrans, comstate, comfreq;
{ {
@ -230,7 +230,7 @@ bldtbl(state, statenum, totaltrans, comstate, comfreq)
* classes. * classes.
*/ */
void void
cmptmps() cmptmps()
{ {
int tmpstorage[CSIZE + 1]; int tmpstorage[CSIZE + 1];
@ -298,7 +298,7 @@ cmptmps()
/* expand_nxt_chk - expand the next check arrays */ /* expand_nxt_chk - expand the next check arrays */
void void
expand_nxt_chk() expand_nxt_chk()
{ {
int old_max = current_max_xpairs; int old_max = current_max_xpairs;
@ -333,7 +333,7 @@ expand_nxt_chk()
* and an action number will be added in [-1]. * and an action number will be added in [-1].
*/ */
int int
find_table_space(state, numtrans) find_table_space(state, numtrans)
int *state, numtrans; int *state, numtrans;
{ {
@ -434,7 +434,7 @@ find_table_space(state, numtrans)
* Initializes "firstfree" to be one beyond the end of the table. Initializes * Initializes "firstfree" to be one beyond the end of the table. Initializes
* all "chk" entries to be zero. * all "chk" entries to be zero.
*/ */
void void
inittbl() inittbl()
{ {
int i; int i;
@ -466,7 +466,7 @@ inittbl()
/* mkdeftbl - make the default, "jam" table entries */ /* mkdeftbl - make the default, "jam" table entries */
void void
mkdeftbl() mkdeftbl()
{ {
int i; int i;
@ -517,7 +517,7 @@ mkdeftbl()
* state array. * state array.
*/ */
void void
mkentry(state, numchars, statenum, deflink, totaltrans) mkentry(state, numchars, statenum, deflink, totaltrans)
int *state; int *state;
int numchars, statenum, deflink, totaltrans; int numchars, statenum, deflink, totaltrans;
@ -635,7 +635,7 @@ mkentry(state, numchars, statenum, deflink, totaltrans)
* has only one out-transition * has only one out-transition
*/ */
void void
mk1tbl(state, sym, onenxt, onedef) mk1tbl(state, sym, onenxt, onedef)
int state, sym, onenxt, onedef; int state, sym, onenxt, onedef;
{ {
@ -662,7 +662,7 @@ mk1tbl(state, sym, onenxt, onedef)
/* mkprot - create new proto entry */ /* mkprot - create new proto entry */
void void
mkprot(state, statenum, comstate) mkprot(state, statenum, comstate)
int state[], statenum, comstate; int state[], statenum, comstate;
{ {
@ -700,7 +700,7 @@ mkprot(state, statenum, comstate)
* to it * to it
*/ */
void void
mktemplate(state, statenum, comstate) mktemplate(state, statenum, comstate)
int state[], statenum, comstate; int state[], statenum, comstate;
{ {
@ -754,7 +754,7 @@ mktemplate(state, statenum, comstate)
/* mv2front - move proto queue element to front of queue */ /* mv2front - move proto queue element to front of queue */
void void
mv2front(qelm) mv2front(qelm)
int qelm; int qelm;
{ {
@ -782,7 +782,7 @@ mv2front(qelm)
* Transnum is the number of out-transitions for the state. * Transnum is the number of out-transitions for the state.
*/ */
void void
place_state(state, statenum, transnum) place_state(state, statenum, transnum)
int *state, statenum, transnum; int *state, statenum, transnum;
{ {
@ -827,7 +827,7 @@ place_state(state, statenum, transnum)
* no room, we process the sucker right now. * no room, we process the sucker right now.
*/ */
void void
stack1(statenum, sym, nextstate, deflink) stack1(statenum, sym, nextstate, deflink)
int statenum, sym, nextstate, deflink; int statenum, sym, nextstate, deflink;
{ {
@ -858,7 +858,7 @@ stack1(statenum, sym, nextstate, deflink)
* number is "numecs" minus the number of "SAME_TRANS" entries in "ext". * number is "numecs" minus the number of "SAME_TRANS" entries in "ext".
*/ */
int int
tbldiff(state, pr, ext) tbldiff(state, pr, ext)
int state[], pr, ext[]; int state[], pr, ext[];
{ {

View File

@ -52,7 +52,7 @@ sub get_symbollist($self, $filepath, $regex, $objlist)
tsay {"generating symbol list in file: $filepath"}; tsay {"generating symbol list in file: $filepath"};
tsay {"object list is @$objlist" }; tsay {"object list is @$objlist" };
my $symbols = LT::UList->new; my $symbols = LT::UList->new;
open(my $sh, '-|', 'nm', '--', @$objlist) or open(my $sh, '-|', 'nm', '--', @$objlist) or
die "Error running nm on object list @$objlist\n"; die "Error running nm on object list @$objlist\n";
my $c = 0; my $c = 0;
while (my $line = <$sh>) { while (my $line = <$sh>) {

View File

@ -59,7 +59,7 @@ sub chdir($self, $dir)
sub compile($self, @l) sub compile($self, @l)
{ {
$self->command("compile", @l); $self->command("compile", @l);
} }
sub execute($self, @l) sub execute($self, @l)
@ -125,7 +125,7 @@ sub command($self, $mode, @l)
if ($mode eq "compile"){ if ($mode eq "compile"){
say "@l" if $verbose || $dry; say "@l" if $verbose || $dry;
} else { } else {
say "libtool: $mode: @l" if $verbose || $dry; say "libtool: $mode: @l" if $verbose || $dry;
} }
if (!$dry) { if (!$dry) {
$self->command_run(@l); $self->command_run(@l);

View File

@ -154,7 +154,7 @@ sub new($class, $string, $code)
my @alternates = split(/\|/, $string); my @alternates = split(/\|/, $string);
bless { bless {
alt => [map { Option->factory($_); } @alternates], alt => [map { Option->factory($_); } @alternates],
code => $code code => $code
}, $class; }, $class;
} }
@ -190,7 +190,7 @@ sub add_option_accessor($self, $option, $isarray)
my $access = $option; my $access = $option;
$access =~ s/^\-//; $access =~ s/^\-//;
$access =~ s/-/_/g; $access =~ s/-/_/g;
my $actual = $isarray ? my $actual = $isarray ?
sub($self) { sub($self) {
$self->{opt}{$option} //= []; $self->{opt}{$option} //= [];
if (wantarray) { if (wantarray) {
@ -232,7 +232,7 @@ sub create_options($self, @l)
}; };
} }
} }
push(@options, push(@options,
Options->new($opt, $code)->setup($self, $isarray)); Options->new($opt, $code)->setup($self, $isarray));
} }
return @options; return @options;

View File

@ -55,11 +55,11 @@ sub run($class, $ltprog, $gp, $ltconfig)
my @pie_flags = (); my @pie_flags = ();
$gp->handle_permuted_options('o:!@', $gp->handle_permuted_options('o:!@',
qr{\-Wc\,(.*)}, qr{\-Wc\,(.*)},
sub { sub {
$gp->keep_for_later(split(/\,/, shift)); $gp->keep_for_later(split(/\,/, shift));
}, },
'Xcompiler:', 'Xcompiler:',
sub { sub {
$gp->keep_for_later($_[2]); $gp->keep_for_later($_[2]);
}, },
@ -70,12 +70,12 @@ sub run($class, $ltprog, $gp, $ltconfig)
'no-suppress', # we just ignore that one 'no-suppress', # we just ignore that one
'prefer-pic', sub { $pic_mode = 1; }, 'prefer-pic', sub { $pic_mode = 1; },
'prefer-non-pic', sub { $pic_mode = 0; }, 'prefer-non-pic', sub { $pic_mode = 0; },
'static', 'static',
sub { sub {
$pic = 0; $pic = 0;
$nonpic = 1; $nonpic = 1;
}, },
'shared', 'shared',
sub { sub {
if (!$pic) { if (!$pic) {
shortdie "bad configuration: can't build shared library"; shortdie "bad configuration: can't build shared library";

View File

@ -535,7 +535,7 @@ sub find_first_lib($self, $lib, $dirs, $gp)
# -Lfoo, -lfoo, foo.a, foo.la # -Lfoo, -lfoo, foo.a, foo.la
# recursively find .la files corresponding to -l flags; if there is no .la # recursively find .la files corresponding to -l flags; if there is no .la
# file, just inspect the library file itself for any dependencies. # file, just inspect the library file itself for any dependencies.
sub internal_parse_linkargs1($self, $deplibs, $gp, $dirs, $libs, $args, sub internal_parse_linkargs1($self, $deplibs, $gp, $dirs, $libs, $args,
$level = 0) $level = 0)
{ {
tsay {"parse_linkargs1, level: $level"}; tsay {"parse_linkargs1, level: $level"};
@ -791,7 +791,7 @@ sub common1($self, $parser, $gp, $deplibs, $libdirs, $dirs, $libs)
$parser->resolve_la($deplibs, $libdirs); $parser->resolve_la($deplibs, $libdirs);
my $orderedlibs = LT::UList->new; my $orderedlibs = LT::UList->new;
my $staticlibs = []; my $staticlibs = [];
my $args = $parser->parse_linkargs2($gp, $orderedlibs, $staticlibs, my $args = $parser->parse_linkargs2($gp, $orderedlibs, $staticlibs,
$dirs, $libs); $dirs, $libs);
my $tiedlibs = tied(@$orderedlibs); my $tiedlibs = tied(@$orderedlibs);

View File

@ -35,7 +35,7 @@ use File::Basename;
sub link sub link
{ {
my ($linker, $self, $ltprog, $ltconfig, $la, $fname, $odir, $shared, my ($linker, $self, $ltprog, $ltconfig, $la, $fname, $odir, $shared,
$objs, $dirs, $libs, $deplibs, $libdirs, $parser, $gp) = @_; $objs, $dirs, $libs, $deplibs, $libdirs, $parser, $gp) = @_;
tsay {"creating link command for library (linked ", tsay {"creating link command for library (linked ",
@ -176,7 +176,7 @@ sub link
if @$staticlibs; if @$staticlibs;
push @cmd, "-L$symlinkdir", @libflags if @libflags; push @cmd, "-L$symlinkdir", @libflags if @libflags;
my @e = $linker->export_symbols($ltconfig, my @e = $linker->export_symbols($ltconfig,
"$odir/$ltdir/$la", $gp, @$objs, @$staticlibs); "$odir/$ltdir/$la", $gp, @$objs, @$staticlibs);
push(@cmd, join(',', "-Wl", @e)) if @e; push(@cmd, join(',', "-Wl", @e)) if @e;
push @cmd, join(',', "-Wl", @linkeropts) if @linkeropts; push @cmd, join(',', "-Wl", @linkeropts) if @linkeropts;

View File

@ -37,7 +37,7 @@ use File::Basename;
sub link sub link
{ {
my ($linker, $self, $ltprog, $ltconfig, $dirs, $libs, $deplibs, my ($linker, $self, $ltprog, $ltconfig, $dirs, $libs, $deplibs,
$libdirs, $parser, $gp) = @_; $libdirs, $parser, $gp) = @_;
tsay {"linking program (", ($gp->static ? "not " : ""), tsay {"linking program (", ($gp->static ? "not " : ""),
@ -81,7 +81,7 @@ sub link
tprint {"key = $k - "}; tprint {"key = $k - "};
my $r = ref($libs->{$k}); my $r = ref($libs->{$k});
tsay {"ref = $r"}; tsay {"ref = $r"};
$libs->create($k)->resolve_library($dirs, 1, $gp->static, $libs->create($k)->resolve_library($dirs, 1, $gp->static,
ref($self)); ref($self));
} }
@ -110,7 +110,7 @@ sub link
} }
} }
push(@linkeropts, $linker->export_symbols($ltconfig, push(@linkeropts, $linker->export_symbols($ltconfig,
"$odir/$ltdir/$fname", $gp, @{$self->{objlist}}, @$staticlibs)); "$odir/$ltdir/$fname", $gp, @{$self->{objlist}}, @$staticlibs));
@cmd = @$ltprog; @cmd = @$ltprog;

View File

@ -63,27 +63,27 @@ sub TIEARRAY($class, @p)
# presence of particular item, call the method below on the reference # presence of particular item, call the method below on the reference
# returned by tie() or tied() instead. # returned by tie() or tied() instead.
sub exists($self, $key) sub exists($self, $key)
{ {
return exists $self->[0]{$key}; return exists $self->[0]{$key};
} }
sub indexof($self, $key) sub indexof($self, $key)
{ {
return exists($self->[0]{$key}) ? ($self->[0]{$key} - 1) : undef; return exists($self->[0]{$key}) ? ($self->[0]{$key} - 1) : undef;
} }
sub FETCHSIZE($self) sub FETCHSIZE($self)
{ {
return scalar(@$self) - 1; return scalar(@$self) - 1;
} }
sub STORE($, $, $) sub STORE($, $, $)
{ {
die "overwriting elements is unimplemented"; die "overwriting elements is unimplemented";
} }
sub DELETE($, $) sub DELETE($, $)
{ {
die "delete is unimplemented"; die "delete is unimplemented";
} }

View File

@ -3,7 +3,7 @@
.include <bsd.own.mk> .include <bsd.own.mk>
MAN=libtool.1 MAN=libtool.1
NOPROG= NOPROG=
PACKAGES= \ PACKAGES= \
LT/Archive.pm \ LT/Archive.pm \
@ -25,7 +25,7 @@ PACKAGES= \
LIBBASE=/usr/libdata/perl5 LIBBASE=/usr/libdata/perl5
realinstall: realinstall:
.for d in LT LT/Mode LT/Mode/Link .for d in LT LT/Mode LT/Mode/Link
${INSTALL} -d -o ${LIBOWN} -g ${LIBGRP} -m ${DIRMODE} \ ${INSTALL} -d -o ${LIBOWN} -g ${LIBGRP} -m ${DIRMODE} \
${DESTDIR}${LIBBASE}/$d ${DESTDIR}${LIBBASE}/$d

View File

@ -124,7 +124,7 @@ sub load_subclass
} }
} }
my $mode_maker = { compile => 'LT::Mode::Compile', my $mode_maker = { compile => 'LT::Mode::Compile',
clean => 'LT::Mode::Clean', clean => 'LT::Mode::Clean',
execute => 'LT::Mode::Execute', execute => 'LT::Mode::Execute',
finish => 'LT::Mode::Finish', finish => 'LT::Mode::Finish',
@ -239,9 +239,9 @@ sub add_tag
{ {
my ($self, $value) = @_; my ($self, $value) = @_;
if ($value =~ m/[^\-\w,\/]/) { if ($value =~ m/[^\-\w,\/]/) {
shortdie "invalid tag name: $value"; shortdie "invalid tag name: $value";
exit 1; exit 1;
} }
if (grep {$value eq $_} @known_tags) { if (grep {$value eq $_} @known_tags) {
$self->{tags}{$value} = 1; $self->{tags}{$value} = 1;
} else { } else {
@ -321,8 +321,8 @@ unless ($ARGV[0] eq 'install' && $ARGV[1] =~ m/^-[bcCdpSsBfgmo]/) {
my $gp = LT::Options->new; my $gp = LT::Options->new;
$gp->handle_options( $gp->handle_options(
'-config' => \&config, '-config' => \&config,
'-debug|x' => sub { '-debug|x' => sub {
LT::Trace->set(1); LT::Trace->set(1);
LT::Exec->verbose_run; LT::Exec->verbose_run;
}, },
'-dry-run|-dryrun|n' => sub { LT::Exec->dry_run; }, '-dry-run|-dryrun|n' => sub { LT::Exec->dry_run; },
@ -341,7 +341,7 @@ $gp->handle_options(
'-quiet|-silent|-no-verbose' => sub { $verbose = 0; }, '-quiet|-silent|-no-verbose' => sub { $verbose = 0; },
'-verbose|-no-silent|-no-quiet|v' => sub {$verbose = 1;}, '-verbose|-no-silent|-no-quiet|v' => sub {$verbose = 1;},
'-tag=' => sub { $gp->add_tag($_[2]); }, '-tag=' => sub { $gp->add_tag($_[2]); },
'-version' => sub { '-version' => sub {
say "libtool (not (GNU libtool)) ", $ltconfig->version; say "libtool (not (GNU libtool)) ", $ltconfig->version;
exit 0; exit 0;
}, },

View File

@ -53,7 +53,7 @@ sortopt="-u -T $TMPDIR"
sortcmd="$sort" sortcmd="$sort"
# Input already sorted # Input already sorted
case X"$1" in case X"$1" in
X-nosort|X-presort) sortcmd=cat; sortopt=;shift;; X-nosort|X-presort) sortcmd=cat; sortopt=;shift;;
esac esac

View File

@ -100,14 +100,14 @@ and
.UC GCOS . .UC GCOS .
Its primary use has been as a Its primary use has been as a
front end for Ratfor for those front end for Ratfor for those
cases where parameterless macros cases where parameterless macros
are not adequately powerful. are not adequately powerful.
It has also been used for languages as disparate as C and Cobol. It has also been used for languages as disparate as C and Cobol.
M4 is particularly suited for functional languages like Fortran, PL/I and C M4 is particularly suited for functional languages like Fortran, PL/I and C
since macros are specified in a functional notation. since macros are specified in a functional notation.
.PP .PP
M4 provides features seldom found even in much larger M4 provides features seldom found even in much larger
macro processors, macro processors,
including including
.IP " \(bu" .IP " \(bu"
arguments arguments
@ -259,7 +259,7 @@ define(N, 100)
... ...
if (NNN > 100) if (NNN > 100)
.P2 .P2
the variable the variable
.UL NNN .UL NNN
is absolutely unrelated to the defined macro is absolutely unrelated to the defined macro
.UL N , .UL N ,
@ -278,7 +278,7 @@ What happens if
.UL N .UL N
is redefined? is redefined?
Or, to say it another way, is Or, to say it another way, is
.UL M .UL M
defined as defined as
.UL N .UL N
or as 100? or as 100?
@ -286,7 +286,7 @@ In M4,
the latter is true _ the latter is true _
.UL M .UL M
is 100, so even if is 100, so even if
.UL N .UL N
subsequently changes, subsequently changes,
.UL M .UL M
does not. does not.
@ -315,10 +315,10 @@ Now
.UL M .UL M
is defined to be the string is defined to be the string
.UL N , .UL N ,
so when you ask for so when you ask for
.UL M .UL M
later, you'll always get the value of later, you'll always get the value of
.UL N .UL N
at that time at that time
(because the (because the
.UL M .UL M
@ -330,7 +330,7 @@ Quoting
.PP .PP
The more general solution is to delay the expansion of The more general solution is to delay the expansion of
the arguments of the arguments of
.UL define .UL define
by by
.ul .ul
quoting quoting
@ -345,7 +345,7 @@ define(M, `N')
the quotes around the the quotes around the
.UL N .UL N
are stripped off as the argument is being collected, are stripped off as the argument is being collected,
but they have served their purpose, and but they have served their purpose, and
.UL M .UL M
is defined as is defined as
the string the string
@ -385,7 +385,7 @@ define(100, 200)
.P2 .P2
This statement is ignored by M4, since you can only define things that look This statement is ignored by M4, since you can only define things that look
like names, but it obviously doesn't have the effect you wanted. like names, but it obviously doesn't have the effect you wanted.
To really redefine To really redefine
.UL N , .UL N ,
you must delay the evaluation by quoting: you must delay the evaluation by quoting:
.P1 .P1
@ -418,7 +418,7 @@ undefine(`N')
removes the definition of removes the definition of
.UL N . .UL N .
(Why are the quotes absolutely necessary?) (Why are the quotes absolutely necessary?)
Built-ins can be removed with Built-ins can be removed with
.UL undefine , .UL undefine ,
as in as in
.P1 .P1
@ -426,7 +426,7 @@ undefine(`define')
.P2 .P2
but once you remove one, you can never get it back. but once you remove one, you can never get it back.
.PP .PP
The built-in The built-in
.UL ifdef .UL ifdef
provides a way to determine if a macro is currently defined. provides a way to determine if a macro is currently defined.
In particular, M4 has pre-defined the names In particular, M4 has pre-defined the names
@ -462,7 +462,7 @@ Within the replacement text for a macro
.UL define ) .UL define )
any occurrence of any occurrence of
.UL $n .UL $n
will be replaced by the will be replaced by the
.UL n th .UL n th
argument when the macro argument when the macro
is actually used. is actually used.
@ -586,13 +586,13 @@ is
and 36 bits on and 36 bits on
.UC GCOS . .UC GCOS .
.PP .PP
As a simple example, suppose we want As a simple example, suppose we want
.UL M .UL M
to be to be
.UL 2**N+1 . .UL 2**N+1 .
Then Then
.P1 .P1
define(N, 3) define(N, 3)
define(M, `eval(2**N+1)') define(M, `eval(2**N+1)')
.P2 .P2
As a matter of principle, it is advisable As a matter of principle, it is advisable
@ -629,7 +629,7 @@ cannot be accessed.
To get some control over this situation, the alternate form To get some control over this situation, the alternate form
.UL sinclude .UL sinclude
can be used; can be used;
.UL sinclude .UL sinclude
(``silent include'') (``silent include'')
says nothing and continues if it can't access the file. says nothing and continues if it can't access the file.
.PP .PP
@ -643,8 +643,8 @@ divert(n)
all subsequent output is put onto the end of a temporary file all subsequent output is put onto the end of a temporary file
referred to as referred to as
.UL n . .UL n .
Diverting to this file is stopped by another Diverting to this file is stopped by another
.UL divert .UL divert
command; command;
in particular, in particular,
.UL divert .UL divert
@ -666,7 +666,7 @@ brings back all diversions in numeric order, and
with arguments brings back the selected diversions with arguments brings back the selected diversions
in the order given. in the order given.
The act of undiverting discards the diverted stuff, The act of undiverting discards the diverted stuff,
as does diverting into a diversion as does diverting into a diversion
whose number is not between 0 and 9 inclusive. whose number is not between 0 and 9 inclusive.
.PP .PP
The value of The value of
@ -727,7 +727,7 @@ compares the two strings
.UL a .UL a
and and
.UL b . .UL b .
If these are identical, If these are identical,
.UL ifelse .UL ifelse
returns returns
the string the string
@ -776,7 +776,7 @@ ifelse(a, b, c)
.P2 .P2
is is
.UL c .UL c
if if
.UL a .UL a
matches matches
.UL b , .UL b ,
@ -808,7 +808,7 @@ position
and is and is
.UL n .UL n
characters long. characters long.
If If
.UL n .UL n
is omitted, the rest of the string is returned, is omitted, the rest of the string is returned,
so so
@ -819,7 +819,7 @@ is
.P1 .P1
ow is the time ow is the time
.P2 .P2
If If
.UL i .UL i
or or
.UL n .UL n
@ -863,22 +863,22 @@ are deleted; as a limiting case,
if if
.UL t .UL t
is not present at all, is not present at all,
characters from characters from
.UL f .UL f
are deleted from are deleted from
.UL s . .UL s .
So So
.P1 .P1
translit(s, aeiou) translit(s, aeiou)
.P2 .P2
deletes vowels from deletes vowels from
.UL s . .UL s .
.PP .PP
There is also a built-in called There is also a built-in called
.UL dnl .UL dnl
which deletes all characters that follow it up to which deletes all characters that follow it up to
and including the next newline; and including the next newline;
it is useful mainly for throwing away it is useful mainly for throwing away
empty lines that otherwise tend to clutter up M4 output. empty lines that otherwise tend to clutter up M4 output.
For example, if you say For example, if you say
.P1 .P1

View File

@ -34,7 +34,7 @@
# @(#)sqroot.m4 8.1 (Berkeley) 6/6/93 # @(#)sqroot.m4 8.1 (Berkeley) 6/6/93
# #
define(square_root, define(square_root,
`ifelse(eval($1<0),1,negative-square-root, `ifelse(eval($1<0),1,negative-square-root,
`square_root_aux($1, 1, eval(($1+1)/2))')') `square_root_aux($1, 1, eval(($1+1)/2))')')
define(square_root_aux, define(square_root_aux,

View File

@ -81,7 +81,7 @@ divert(0)
define(abc,xxx) define(abc,xxx)
ifdef(`abc',defined,undefined) ifdef(`abc',defined,undefined)
# #
# v7 m4 does this wrong. The right output is # v7 m4 does this wrong. The right output is
# this is A vEry lon sEntEnCE # this is A vEry lon sEntEnCE
# see m4 documentation for translit. # see m4 documentation for translit.
# #
@ -118,7 +118,7 @@ square_root(21372)
# #
[taken from the 'Clemson University Computer Newsletter', [taken from the 'Clemson University Computer Newsletter',
September 1981, pp. 6-7] September 1981, pp. 6-7]
I am a wizard in the magical Kingdom of Transformation and I I am a wizard in the magical Kingdom of Transformation and I
slay dragons for a living. Actually, I am a systems programmer. slay dragons for a living. Actually, I am a systems programmer.
One of the problems with systems programming is explaining to One of the problems with systems programming is explaining to
@ -127,7 +127,7 @@ describe my job are totally meaningless to them. Usually my response
to questions about my work is to say as little as possible. For to questions about my work is to say as little as possible. For
instance, if someone asks what happened at work this week, I say instance, if someone asks what happened at work this week, I say
"Nothing much" and then I change the subject. "Nothing much" and then I change the subject.
With the assistance of my brother, a mechanical engineer, I have devised With the assistance of my brother, a mechanical engineer, I have devised
an analogy that everyone can understand. The analogy describes the an analogy that everyone can understand. The analogy describes the
"Kingdom of Transformation" where travelers wander and are magically "Kingdom of Transformation" where travelers wander and are magically
@ -136,7 +136,7 @@ The purpose of the computer is to change information to a more meaningful
forma. The law of conservation applies here: The computer never creates forma. The law of conservation applies here: The computer never creates
and never intentionally destroys data. With no further ado, let us travel and never intentionally destroys data. With no further ado, let us travel
to the Kingdom of Transformation: to the Kingdom of Transformation:
In a land far, far away, there is a magical kingdom called the Kingdom of In a land far, far away, there is a magical kingdom called the Kingdom of
Transformation. A king rules over this land and employs a Council of Transformation. A king rules over this land and employs a Council of
Wizardry. The main purpose of this kingdom is to provide a way for Wizardry. The main purpose of this kingdom is to provide a way for
@ -145,39 +145,39 @@ is done by allowing the citizens to enter the kingdom at one of its ports
and to travel any of the many routes in the kingdom. They are magically and to travel any of the many routes in the kingdom. They are magically
transformed along the way. The income of the Kingdom of Transformation transformed along the way. The income of the Kingdom of Transformation
comes from the many toll roads within its boundaries. comes from the many toll roads within its boundaries.
The Kingdom of Transformation was created when several kingdoms got The Kingdom of Transformation was created when several kingdoms got
together and discovered a mutual need for new talents and abilities for together and discovered a mutual need for new talents and abilities for
citizens. They employed CTK, Inc. (Creators of Transformation, Inc.) to citizens. They employed CTK, Inc. (Creators of Transformation, Inc.) to
create this kingdom. CTK designed the country, its transportation routes, create this kingdom. CTK designed the country, its transportation routes,
and its laws of transformation, and created the major highway system. and its laws of transformation, and created the major highway system.
Hazards Hazards
======= =======
Because magic is not truly controllable, CTK invariably, but unknowingly, Because magic is not truly controllable, CTK invariably, but unknowingly,
creates dragons. Dragons are huge fire-breathing beasts which sometimes creates dragons. Dragons are huge fire-breathing beasts which sometimes
injure or kill travelers. Fortunately, they do not travel, but always injure or kill travelers. Fortunately, they do not travel, but always
remain near their den. remain near their den.
Other hazards also exist which are potentially harmful. As the roads Other hazards also exist which are potentially harmful. As the roads
become older and more weatherbeaten, pot-holes will develop, trees will become older and more weatherbeaten, pot-holes will develop, trees will
fall on travelers, etc. CTK maintenance men are called to fix these fall on travelers, etc. CTK maintenance men are called to fix these
problems. problems.
Wizards Wizards
======= =======
The wizards play a major role in creating and maintaining the kingdom but The wizards play a major role in creating and maintaining the kingdom but
get little credit for their work because it is performed secretly. The get little credit for their work because it is performed secretly. The
wizards do not wan the workers or travelers to learn their incantations wizards do not wan the workers or travelers to learn their incantations
because many laws would be broken and chaos would result. because many laws would be broken and chaos would result.
CTK's grand design is always general enough to be applicable in many CTK's grand design is always general enough to be applicable in many
different situations. As a result, it is often difficult to use. The different situations. As a result, it is often difficult to use. The
first duty of the wizards is to tailor the transformation laws so as to be first duty of the wizards is to tailor the transformation laws so as to be
more beneficial and easier to use in their particular environment. more beneficial and easier to use in their particular environment.
After creation of the kingdom, a major duty of the wizards is to search for After creation of the kingdom, a major duty of the wizards is to search for
and kill dragons. If travelers do not return on time or if they return and kill dragons. If travelers do not return on time or if they return
injured, the ruler of the country contacts the wizards. If the wizards injured, the ruler of the country contacts the wizards. If the wizards
@ -187,7 +187,7 @@ If not, they must determine if the cause was a road hazard or a dragon. If
the suspect a road hazard, they call in a CTK maintenance man to locate the the suspect a road hazard, they call in a CTK maintenance man to locate the
hazard and to eliminate it, as in repairing the pothole in the road. If hazard and to eliminate it, as in repairing the pothole in the road. If
they think that cause was a dragon, then they must find and slay it. they think that cause was a dragon, then they must find and slay it.
The most difficult part of eliminating a dragon is finding it. Sometimes The most difficult part of eliminating a dragon is finding it. Sometimes
the wizard magically knows where the dragon's lair it, but often the wizard the wizard magically knows where the dragon's lair it, but often the wizard
must send another traveler along the same route and watch to see where he must send another traveler along the same route and watch to see where he
@ -195,26 +195,26 @@ disappears. This sounds like a failsafe method for finding dragons (and a
suicide mission for thr traveler) but the second traveler does not always suicide mission for thr traveler) but the second traveler does not always
disappear. Some dragons eat any traveler who comes too close; others are disappear. Some dragons eat any traveler who comes too close; others are
very picky. very picky.
The wizards may call in CTK who designed the highway system and The wizards may call in CTK who designed the highway system and
transformation laws to help devise a way to locate the dragon. CTK also transformation laws to help devise a way to locate the dragon. CTK also
helps provide the right spell or incantation to slay the dragon. (There is helps provide the right spell or incantation to slay the dragon. (There is
no general spell to slay dragons; each dragon must be eliminated with a no general spell to slay dragons; each dragon must be eliminated with a
different spell.) different spell.)
Because neither CTK nor wizards are perfect, spells to not always work Because neither CTK nor wizards are perfect, spells to not always work
correctly. At best, nothing happens when the wrong spell is uttered. At correctly. At best, nothing happens when the wrong spell is uttered. At
worst, the dragon becomes a much larger dragon or multiplies into several worst, the dragon becomes a much larger dragon or multiplies into several
smaller ones. In either case, new spells must be found. smaller ones. In either case, new spells must be found.
If all existing dragons are quiet (i.e. have eaten sufficiently), wizards If all existing dragons are quiet (i.e. have eaten sufficiently), wizards
have time to do other things. They hide in castles and practice spells and have time to do other things. They hide in castles and practice spells and
incantations. They also devise shortcuts for travelers and new laws of incantations. They also devise shortcuts for travelers and new laws of
transformation. transformation.
Changes in the Kingdom Changes in the Kingdom
====================== ======================
As new transformation kingdoms are created and old ones are maintained, As new transformation kingdoms are created and old ones are maintained,
CTK, Inc. is constantly learning new things. It learns ways to avoid CTK, Inc. is constantly learning new things. It learns ways to avoid
creating some of the dragons that they have previously created. It also creating some of the dragons that they have previously created. It also
@ -224,7 +224,7 @@ The wizards determine when is a good time to implement this new design.
This is when the tourist season is slow or when no important travelers This is when the tourist season is slow or when no important travelers
(VIPs) are to arrive. The kingdom must be closed for the actual (VIPs) are to arrive. The kingdom must be closed for the actual
implementation and is leter reopened as a new and better place to go. implementation and is leter reopened as a new and better place to go.
A final question you might ask is what happens when the number of tourists A final question you might ask is what happens when the number of tourists
becomes too great for the kingdom to handle in a reasonable period of time becomes too great for the kingdom to handle in a reasonable period of time
(i.e., the tourist lines at the ports are too long). The Kingdom of (i.e., the tourist lines at the ports are too long). The Kingdom of
@ -232,7 +232,7 @@ Transformation has three options: (1) shorten the paths that a tourist must
travel, or (2) convince CTK to develop a faster breed of horses so that the travel, or (2) convince CTK to develop a faster breed of horses so that the
travelers can finish sooner, or (3) annex more territories so that the travelers can finish sooner, or (3) annex more territories so that the
kingdom can handle more travelers. kingdom can handle more travelers.
Thus ends the story of the Kingdom of Transformation. I hope this has Thus ends the story of the Kingdom of Transformation. I hope this has
explained my job to you: I slay dragons for a living. explained my job to you: I slay dragons for a living.

View File

@ -180,14 +180,14 @@ expand_builtin(const char *argv[], int argc, int td)
if (argc > 3) { if (argc > 3) {
base = strtonum(argv[3], 2, 36, &errstr); base = strtonum(argv[3], 2, 36, &errstr);
if (errstr) { if (errstr) {
m4errx(1, "expr: base is %s: %s.", m4errx(1, "expr: base is %s: %s.",
errstr, argv[3]); errstr, argv[3]);
} }
} }
if (argc > 4) { if (argc > 4) {
maxdigits = strtonum(argv[4], 0, INT_MAX, &errstr); maxdigits = strtonum(argv[4], 0, INT_MAX, &errstr);
if (errstr) { if (errstr) {
m4errx(1, "expr: maxdigits is %s: %s.", m4errx(1, "expr: maxdigits is %s: %s.",
errstr, argv[4]); errstr, argv[4]);
} }
} }
@ -299,7 +299,7 @@ expand_builtin(const char *argv[], int argc, int td)
case PASTTYPE: case PASTTYPE:
if (argc > 2) if (argc > 2)
if (!dopaste(argv[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]); CURRENT_NAME, CURRENT_LINE, argv[2]);
break; break;
@ -351,7 +351,7 @@ expand_builtin(const char *argv[], int argc, int td)
if (argc > 2) { if (argc > 2) {
n = strtonum(argv[2], INT_MIN, INT_MAX, &errstr); n = strtonum(argv[2], INT_MIN, INT_MAX, &errstr);
if (errstr) if (errstr)
m4errx(1, "divert: argument is %s: %s.", m4errx(1, "divert: argument is %s: %s.",
errstr, argv[2]); errstr, argv[2]);
if (n != 0) { if (n != 0) {
dodiv(n); dodiv(n);
@ -908,11 +908,11 @@ dosub(const char *argv[], int argc)
* map every character of s1 that is specified in from * map every character of s1 that is specified in from
* into s3 and replace in s. (source s1 remains untouched) * into s3 and replace in s. (source s1 remains untouched)
* *
* This is derived from the a standard implementation of map(s,from,to) * This is derived from the a standard implementation of map(s,from,to)
* function of ICON language. Within mapvec, we replace every character * function of ICON language. Within mapvec, we replace every character
* of "from" with the corresponding character in "to". * of "from" with the corresponding character in "to".
* If "to" is shorter than "from", than the corresponding entries are null, * If "to" is shorter than "from", than the corresponding entries are null,
* which means that those characters disappear altogether. * which means that those characters disappear altogether.
*/ */
static void static void
map(char *dest, const char *src, const char *from, const char *to) map(char *dest, const char *src, const char *from, const char *to)
@ -1002,7 +1002,7 @@ handledash(char *buffer, char *end, const char *src)
if (src[1] == '-' && src[2]) { if (src[1] == '-' && src[2]) {
unsigned char i; unsigned char i;
if ((unsigned char)src[0] <= (unsigned char)src[2]) { if ((unsigned char)src[0] <= (unsigned char)src[2]) {
for (i = (unsigned char)src[0]; for (i = (unsigned char)src[0];
i <= (unsigned char)src[2]; i++) { i <= (unsigned char)src[2]; i++) {
*p++ = i; *p++ = i;
if (p == end) { if (p == end) {
@ -1011,7 +1011,7 @@ handledash(char *buffer, char *end, const char *src)
} }
} }
} else { } else {
for (i = (unsigned char)src[0]; for (i = (unsigned char)src[0];
i >= (unsigned char)src[2]; i--) { i >= (unsigned char)src[2]; i--) {
*p++ = i; *p++ = i;
if (p == end) { if (p == end) {

View File

@ -184,10 +184,10 @@ static void addchar(int);
static char *twiddle(const char *); static char *twiddle(const char *);
static char *getstring(void); static char *getstring(void);
static void exit_regerror(int, regex_t *, const char *); static void exit_regerror(int, regex_t *, const char *);
static void do_subst(const char *, regex_t *, const char *, const char *, static void do_subst(const char *, regex_t *, const char *, const char *,
regmatch_t *); regmatch_t *);
static void do_regexpindex(const char *, regex_t *, const char *, regmatch_t *); static void do_regexpindex(const char *, regex_t *, const char *, regmatch_t *);
static void do_regexp(const char *, regex_t *, const char *, const char *, static void do_regexp(const char *, regex_t *, const char *, const char *,
regmatch_t *); regmatch_t *);
static void add_sub(int, const char *, regex_t *, regmatch_t *); static void add_sub(int, const char *, regex_t *, regmatch_t *);
static void add_replace(const char *, regex_t *, const char *, regmatch_t *); static void add_replace(const char *, regex_t *, const char *, regmatch_t *);
@ -316,7 +316,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 *source, do_subst(const char *string, regex_t *re, const char *source,
const char *replace, regmatch_t *pm) const char *replace, regmatch_t *pm)
{ {
int error; int error;
@ -357,7 +357,7 @@ do_subst(const char *string, regex_t *re, const char *source,
} }
static void static void
do_regexp(const char *string, regex_t *re, const char *source, do_regexp(const char *string, regex_t *re, const char *source,
const char *replace, regmatch_t *pm) const char *replace, regmatch_t *pm)
{ {
int error; int error;
@ -375,7 +375,7 @@ do_regexp(const char *string, regex_t *re, const char *source,
} }
static void static void
do_regexpindex(const char *string, regex_t *re, const char *source, do_regexpindex(const char *string, regex_t *re, const char *source,
regmatch_t *pm) regmatch_t *pm)
{ {
int error; int error;
@ -485,7 +485,7 @@ dopatsubst(const char *argv[], int argc)
if (error != 0) if (error != 0)
exit_regerror(error, &re, source); exit_regerror(error, &re, source);
pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t), pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t),
NULL); NULL);
do_subst(argv[2], &re, source, do_subst(argv[2], &re, source,
argc > 4 && argv[4] != NULL ? argv[4] : "", pmatch); argc > 4 && argv[4] != NULL ? argv[4] : "", pmatch);

View File

@ -292,7 +292,7 @@ keep(char *ptr)
kept_capacity *= 2; kept_capacity *= 2;
else else
kept_capacity = 50; kept_capacity = 50;
kept = xreallocarray(kept, kept_capacity, kept = xreallocarray(kept, kept_capacity,
sizeof(char *), "Out of memory while saving %d strings\n", sizeof(char *), "Out of memory while saving %d strings\n",
kept_capacity); kept_capacity);
} }
@ -300,7 +300,7 @@ keep(char *ptr)
} }
static int static int
string_in_use(const char *ptr) string_in_use(const char *ptr)
{ {
int i; int i;
for (i = 0; i <= sp; i++) { for (i = 0; i <= sp; i++) {
@ -321,7 +321,7 @@ free_definition(char *ptr)
if (!string_in_use(kept[i])) { if (!string_in_use(kept[i])) {
kept_size--; kept_size--;
free(kept[i]); free(kept[i]);
if (i != kept_size) if (i != kept_size)
kept[i] = kept[kept_size]; kept[i] = kept[kept_size];
i--; i--;
} }

View File

@ -204,7 +204,7 @@ struct input_file {
mstack[sp].sstr = macro_getdef(p)->defn;\ mstack[sp].sstr = macro_getdef(p)->defn;\
sstack[sp] = STORAGE_MACRO; \ sstack[sp] = STORAGE_MACRO; \
} while (0) } while (0)
/* /*
* . . * . .

View File

@ -52,7 +52,7 @@ expr : expr '+' expr { $$ = $1 + $3; }
} }
$$ = $1 / $3; $$ = $1 / $3;
} }
| expr '%' expr { | expr '%' expr {
if ($3 == 0) { if ($3 == 0) {
yyerror("modulo zero"); yyerror("modulo zero");
exit(1); exit(1);

View File

@ -698,7 +698,7 @@ matchsubj(char *str, int mesg)
else else
strlcpy(lastscan, str, sizeof(lastscan)); strlcpy(lastscan, str, sizeof(lastscan));
mp = &message[mesg-1]; mp = &message[mesg-1];
/* /*
* Now look, ignoring case, for the word in the string. * Now look, ignoring case, for the word in the string.
*/ */

View File

@ -536,7 +536,7 @@ elide(struct name *names)
np = np->n_flink; np = np->n_flink;
continue; continue;
} }
/* /*
* Now t points to the last entry with the same name * Now t points to the last entry with the same name
* as np. Make np point beyond t. * as np. Make np point beyond t.

View File

@ -369,7 +369,7 @@ mail1(struct header *hp, int printheaders)
} }
if ((cp = value("record")) != NULL) if ((cp = value("record")) != NULL)
(void)savemail(expand(cp), mtf); (void)savemail(expand(cp), mtf);
/* Setup sendmail arguments. */ /* Setup sendmail arguments. */
*ap++ = "sendmail"; *ap++ = "sendmail";
*ap++ = "-i"; *ap++ = "-i";

View File

@ -112,7 +112,7 @@ argcount(char **argv)
char **ap; char **ap;
for (ap = argv; *ap++ != NULL;) for (ap = argv; *ap++ != NULL;)
; ;
return(ap - argv - 1); return(ap - argv - 1);
} }

View File

@ -184,7 +184,7 @@ mod:
isz++; isz++;
if (strchr(" \t.", p[*pos + isz]) == NULL) if (strchr(" \t.", p[*pos + isz]) == NULL)
isz++; isz++;
fontesc = mandoc_font(p + *pos, isz); fontesc = mandoc_font(p + *pos, isz);
switch (fontesc) { switch (fontesc) {

View File

@ -398,7 +398,7 @@ locale_endline(struct termp *p)
p->line++; p->line++;
if ((int)p->tcol->offset > p->ti) if ((int)p->tcol->offset > p->ti)
p->tcol->offset -= p->ti; p->tcol->offset -= p->ti;
else else
p->tcol->offset = 0; p->tcol->offset = 0;
p->ti = 0; p->ti = 0;
putwchar(L'\n'); putwchar(L'\n');

View File

@ -1250,7 +1250,7 @@ ps_endline(struct termp *p)
if ((int)p->tcol->offset > p->ti) if ((int)p->tcol->offset > p->ti)
p->tcol->offset -= p->ti; p->tcol->offset -= p->ti;
else else
p->tcol->offset = 0; p->tcol->offset = 0;
p->ti = 0; p->ti = 0;
} }

View File

@ -27,7 +27,7 @@
*/ */
/* /*
* Due to incompatible behaviour between "standard" emacs and * Due to incompatible behaviour between "standard" emacs and
* ctags word traversing, '_' character's value is changed on * ctags word traversing, '_' character's value is changed on
* the fly in ctags mode, hence non-const. * the fly in ctags mode, hence non-const.
*/ */
char cinfo[256] = { char cinfo[256] = {

View File

@ -263,7 +263,7 @@ getindent(const struct line *lp, int *curi)
if (!firstnwsp && !isspace(c)) { if (!firstnwsp && !isspace(c)) {
if (c == '#') if (c == '#')
cppp = TRUE; cppp = TRUE;
firstnwsp = TRUE; firstnwsp = TRUE;
} }
if (c == '\\') if (c == '\\')
escp = !escp; escp = !escp;

View File

@ -786,7 +786,7 @@ refreshbuffer(struct buffer *bp)
/* remark any previously deleted files with a 'D' */ /* remark any previously deleted files with a 'D' */
if (ddel) if (ddel)
redelete(bp); redelete(bp);
/* find dot line */ /* find dot line */
bp->b_dotp = bfirstlp(bp); bp->b_dotp = bfirstlp(bp);
@ -989,7 +989,7 @@ redelete(struct buffer *bp)
/* reset the deleted file buffer flag until a deleted file is found */ /* reset the deleted file buffer flag until a deleted file is found */
bp->b_flag &= ~BFDIREDDEL; bp->b_flag &= ~BFDIREDDEL;
for (lp = bfirstlp(bp); lp != bp->b_headp; lp = nlp) { for (lp = bfirstlp(bp); lp != bp->b_headp; lp = nlp) {
bp->b_dotp = lp; bp->b_dotp = lp;
if ((p = findfname(lp, p)) == NULL) { if ((p = findfname(lp, p)) == NULL) {
nlp = lforw(lp); nlp = lforw(lp);
@ -998,7 +998,7 @@ redelete(struct buffer *bp)
plen = strlen(p); plen = strlen(p);
SLIST_FOREACH_SAFE(d1, &delhead, entry, dt) { SLIST_FOREACH_SAFE(d1, &delhead, entry, dt) {
fnlen = strlen(d1->fn); fnlen = strlen(d1->fn);
if ((plen == fnlen) && if ((plen == fnlen) &&
(strncmp(p, d1->fn, plen) == 0)) { (strncmp(p, d1->fn, plen) == 0)) {
lputc(bp->b_dotp, 0, DDELCHAR); lputc(bp->b_dotp, 0, DDELCHAR);
bp->b_flag |= BFDIREDDEL; bp->b_flag |= BFDIREDDEL;
@ -1006,7 +1006,7 @@ redelete(struct buffer *bp)
if (SLIST_EMPTY(&delhead)) { if (SLIST_EMPTY(&delhead)) {
finished = 1; finished = 1;
break; break;
} }
} }
} }
if (finished) if (finished)
@ -1035,7 +1035,7 @@ createlist(struct buffer *bp)
int ret = FALSE; int ret = FALSE;
for (lp = bfirstlp(bp); lp != bp->b_headp; lp = nlp) { for (lp = bfirstlp(bp); lp != bp->b_headp; lp = nlp) {
/* /*
* Check if the line has 'D' on the first char and if a valid * Check if the line has 'D' on the first char and if a valid
* filename can be extracted from it. * filename can be extracted from it.
*/ */
@ -1070,7 +1070,7 @@ createlist(struct buffer *bp)
SLIST_INSERT_HEAD(&delhead, d2, entry); SLIST_INSERT_HEAD(&delhead, d2, entry);
else else
SLIST_INSERT_AFTER(d1, d2, entry); SLIST_INSERT_AFTER(d1, d2, entry);
d1 = d2; d1 = d2;
} }
ret = TRUE; ret = TRUE;
nlp = lforw(lp); nlp = lforw(lp);

View File

@ -842,7 +842,7 @@ ewprintf(const char *fmt, ...)
* Printf style formatting. This is called by "ewprintf" to provide * Printf style formatting. This is called by "ewprintf" to provide
* formatting services to its clients. The move to the start of the * formatting services to its clients. The move to the start of the
* echo line, and the erase to the end of the echo line, is done by * echo line, and the erase to the end of the echo line, is done by
* the caller. * the caller.
* %c prints the "name" of the supplied character. * %c prints the "name" of the supplied character.
* %k prints the name of the current key (and takes no arguments). * %k prints the name of the current key (and takes no arguments).
* %d prints a decimal integer * %d prints a decimal integer

View File

@ -605,7 +605,7 @@ buffsave(struct buffer *bp)
"Save anyway")) != TRUE) "Save anyway")) != TRUE)
return (s); return (s);
} }
if (makebackup && (bp->b_flag & BFBAK)) { if (makebackup && (bp->b_flag & BFBAK)) {
s = fbackupfile(bp->b_fname); s = fbackupfile(bp->b_fname);
/* hard error */ /* hard error */

View File

@ -736,7 +736,7 @@ expandtilde(const char *fn)
plen = strlcpy(path, pw->pw_dir, sizeof(path)); plen = strlcpy(path, pw->pw_dir, sizeof(path));
if (plen == 0 || path[plen - 1] != '/') { if (plen == 0 || path[plen - 1] != '/') {
if (strlcat(path, "/", sizeof(path)) >= sizeof(path)) { if (strlcat(path, "/", sizeof(path)) >= sizeof(path)) {
dobeep(); dobeep();
ewprintf("Path too long"); ewprintf("Path too long");
return (NULL); return (NULL);
} }

View File

@ -18,7 +18,7 @@
* *
* If you do want to do some testing, you can add some lines to your .mg file * If you do want to do some testing, you can add some lines to your .mg file
* like: * like:
* *
* 1. Give multiple arguments to a function that usually would accept only one: * 1. Give multiple arguments to a function that usually would accept only one:
* (find-file "a.txt" "b.txt" "c.txt") * (find-file "a.txt" "b.txt" "c.txt")
* *
@ -42,7 +42,7 @@
* 7. oh so many things.... * 7. oh so many things....
* [...] * [...]
* n. implement user definable functions. * n. implement user definable functions.
* *
* Notes: * Notes:
* - Currently calls to excline() from this file have the line length and * - Currently calls to excline() from this file have the line length and
* line number set to zero. * line number set to zero.
@ -98,13 +98,13 @@ struct expentry {
}; };
/* /*
* Structure for scheme keywords. * Structure for scheme keywords.
*/ */
#define NUMSCHKEYS 4 #define NUMSCHKEYS 4
#define MAXLENSCHKEYS 17 /* 17 = longest keyword (16) + 1 */ #define MAXLENSCHKEYS 17 /* 17 = longest keyword (16) + 1 */
char scharkey[NUMSCHKEYS][MAXLENSCHKEYS] = char scharkey[NUMSCHKEYS][MAXLENSCHKEYS] =
{ {
"define", "define",
"list", "list",
"if", "if",
@ -304,7 +304,7 @@ parse(char *begp, const char *par1, const char *par2, int blkid, int expctr,
if (doregex(regs, begp)) if (doregex(regs, begp))
return(exitinterpreter(NULL, NULL, FALSE)); return(exitinterpreter(NULL, NULL, FALSE));
/* mg function name regex */ /* mg function name regex */
regs = "^[A-Za-z-]+$"; regs = "^[A-Za-z-]+$";
if (doregex(regs, begp)) if (doregex(regs, begp))
return(excline(begp, 0, 0)); return(excline(begp, 0, 0));
@ -467,7 +467,7 @@ multiarg(char *cmdp, char *argbuf, int numparams)
if (*p != ' ') { if (*p != ' ') {
if (*p == '"') { if (*p == '"') {
if (inquote == 1) if (inquote == 1)
inquote = 0; inquote = 0;
else else
inquote = 1; inquote = 1;
} }
@ -614,7 +614,7 @@ founddef(char *defstr, int blkid, int expctr, int hasval, int elen)
expandvals(NULL, valp, defnam); expandvals(NULL, valp, defnam);
defnam = NULL; defnam = NULL;
} }
*vendp = ' '; *vendp = ' ';
return (TRUE); return (TRUE);
} }
@ -645,7 +645,7 @@ expandvals(char *cmdp, char *valp, char *bp)
if (*p != ' ') { if (*p != ' ') {
if (*p == '"') { if (*p == '"') {
if (inquote == 1) if (inquote == 1)
inquote = 0; inquote = 0;
else else
inquote = 1; inquote = 1;
} }
@ -658,12 +658,12 @@ expandvals(char *cmdp, char *valp, char *bp)
continue; continue;
/* terminate arg string */ /* terminate arg string */
if (*p == ' ') { if (*p == ' ') {
*p = '\0'; *p = '\0';
} }
endp = p + 1; endp = p + 1;
excbuf[0] = '\0'; excbuf[0] = '\0';
varbuf[0] = '\0'; varbuf[0] = '\0';
contbuf[0] = '\0'; contbuf[0] = '\0';
sizof = sizeof(varbuf); sizof = sizeof(varbuf);
v = varbuf; v = varbuf;
regs = "[\"]+.*[\"]+"; regs = "[\"]+.*[\"]+";
@ -680,7 +680,7 @@ expandvals(char *cmdp, char *valp, char *bp)
(void)(strlcat(varbuf, contbuf, (void)(strlcat(varbuf, contbuf,
sizof) >= sizof); sizof) >= sizof);
argbuf[0] = ' '; argbuf[0] = ' ';
argbuf[1] = '\0'; argbuf[1] = '\0';
(void)(strlcat(argbuf, varbuf, (void)(strlcat(argbuf, varbuf,
@ -709,7 +709,7 @@ expandvals(char *cmdp, char *valp, char *bp)
return (dobeep_msg("strlcat error")); return (dobeep_msg("strlcat error"));
} }
/* v1->v_count++;*/ /* v1->v_count++;*/
if (fin) if (fin)
break; break;
@ -894,7 +894,7 @@ getenvironmentvariable(char *ptr, char *dobuf, int dosiz)
return (dobeep_msg("strlcat error")); return (dobeep_msg("strlcat error"));
if (strlcat(dobuf, q, dosiz) >= dosiz) if (strlcat(dobuf, q, dosiz) >= dosiz)
return (dobeep_msg("strlcat error")); return (dobeep_msg("strlcat error"));
return (TRUE); return (TRUE);
} }
@ -932,14 +932,14 @@ stringappend(char *ptr, char *dobuf, int dosiz)
v = v + 1; v = v + 1;
} }
if (strlcat(f, v, sizof) >= sizof) if (strlcat(f, v, sizof) >= sizof)
return (dobeep_msg("strlcat error")); return (dobeep_msg("strlcat error"));
} else { } else {
if (p[0] == '"' && p[strlen(p) - 1] == '"' ) { if (p[0] == '"' && p[strlen(p) - 1] == '"' ) {
p[strlen(p) - 1] = '\0'; p[strlen(p) - 1] = '\0';
p = p + 1; p = p + 1;
} }
if (strlcat(f, p, sizof) >= sizof) if (strlcat(f, p, sizof) >= sizof)
return (dobeep_msg("strlcat error")); return (dobeep_msg("strlcat error"));
} }
if (fin) if (fin)
break; break;

View File

@ -169,7 +169,7 @@ linsert(int n, int c)
if ((s = checkdirty(curbp)) != TRUE) if ((s = checkdirty(curbp)) != TRUE)
return (s); return (s);
if (curbp->b_flag & BFREADONLY) { if (curbp->b_flag & BFREADONLY) {
dobeep(); dobeep();
ewprintf("Buffer is read only"); ewprintf("Buffer is read only");
@ -281,7 +281,7 @@ lnewline_at(struct line *lp1, int doto)
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
if (wp->w_linep == lp1) if (wp->w_linep == lp1)
wp->w_linep = lp2; wp->w_linep = lp2;
if (wp->w_dotline >= tcurwpdotline && if (wp->w_dotline >= tcurwpdotline &&
wp->w_bufp == curwp->w_bufp) wp->w_bufp == curwp->w_bufp)
wp->w_dotline++; wp->w_dotline++;
} }

View File

@ -1,6 +1,6 @@
/* $OpenBSD: log.c,v 1.13 2022/12/26 19:16:02 jmc Exp $ */ /* $OpenBSD: log.c,v 1.13 2022/12/26 19:16:02 jmc Exp $ */
/* /*
* This file is in the public domain. * This file is in the public domain.
* *
* Author: Mark Lumsden <mark@showcomplex.com> * Author: Mark Lumsden <mark@showcomplex.com>
@ -9,27 +9,27 @@
/* /*
* Record a history of an mg session for temporal debugging. * Record a history of an mg session for temporal debugging.
* Sometimes pressing a key will set the scene for a bug only visible * Sometimes pressing a key will set the scene for a bug only visible
* dozens of keystrokes later. gdb has its limitations in this scenario. * dozens of keystrokes later. gdb has its limitations in this scenario.
* *
* Note this file is not compiled into mg by default, you will need to * Note this file is not compiled into mg by default, you will need to
* amend the 'Makefile' for that to happen. Because of this, the code * amend the 'Makefile' for that to happen. Because of this, the code
* is subject to bit-rot. However, I know myself and others have * is subject to bit-rot. However, I know myself and others have
* written similar functionally often enough, that recording the below * written similar functionally often enough, that recording the below
* in a code repository could aid the development efforts of mg, even * in a code repository could aid the development efforts of mg, even
* if it requires a bit of effort to get working. The current code is * if it requires a bit of effort to get working. The current code is
* written in the spirit of debugging (quickly and perhaps not ideal, * written in the spirit of debugging (quickly and perhaps not ideal,
* but it does what is required well enough). Should debugging become * but it does what is required well enough). Should debugging become
* more formalised within mg, then I would expect that to change. * more formalised within mg, then I would expect that to change.
* *
* If you open a file with long lines to run through this debugging * If you open a file with long lines to run through this debugging
* code, you may run into problems with the 1st fprintf statement in * code, you may run into problems with the 1st fprintf statement in
* in the mglog_lines() function. mg sometimes segvs at a strlen call * in the mglog_lines() function. mg sometimes segvs at a strlen call
* in fprintf - possibly something to do with the format string? * in fprintf - possibly something to do with the format string?
* "%s%p b^%p f.%p %d %d\t%c|%s\n" * "%s%p b^%p f.%p %d %d\t%c|%s\n"
* When I get time I will look into it. But since my debugging * When I get time I will look into it. But since my debugging
* generally revolves around a file like: * generally revolves around a file like:
* *
* abc * abc
* def * def
* ghk * ghk
@ -347,7 +347,7 @@ mgloginit(void)
mglogfile_interpreter = "interpreter.log"; mglogfile_interpreter = "interpreter.log";
mglogfile_misc = "misc.log"; mglogfile_misc = "misc.log";
/* /*
* Change mgloglevel for desired level of logging. * Change mgloglevel for desired level of logging.
* log.h has relevant level info. * log.h has relevant level info.
*/ */
@ -384,7 +384,7 @@ mgloginit(void)
return (FALSE); return (FALSE);
return (TRUE); return (TRUE);
} }
static char * static char *

View File

@ -26,7 +26,7 @@ static int do_gotoeop(int, int, int *);
/* /*
* Move to start of paragraph. * Move to start of paragraph.
* Move backwards by line, checking from the 1st character forwards for the * Move backwards by line, checking from the 1st character forwards for the
* existence a non-space. If a non-space character is found, move to the * existence a non-space. If a non-space character is found, move to the
* preceding line. Keep doing this until a line with only spaces is found or * preceding line. Keep doing this until a line with only spaces is found or
* the start of buffer. * the start of buffer.
*/ */
@ -320,7 +320,7 @@ markpara(int f, int n)
/* /*
* Transpose the current paragraph with the following paragraph. If invoked * Transpose the current paragraph with the following paragraph. If invoked
* multiple times, transpose to the n'th paragraph. If invoked between * multiple times, transpose to the n'th paragraph. If invoked between
* paragraphs, move to the previous paragraph, then continue. * paragraphs, move to the previous paragraph, then continue.
*/ */
int int
@ -341,14 +341,14 @@ transposepara(int f, int n)
(void)gotoeop(FFRAND, 1); (void)gotoeop(FFRAND, 1);
/* take a note of buffer flags - we may need them */ /* take a note of buffer flags - we may need them */
flg = curbp->b_flag; flg = curbp->b_flag;
/* clean out kill buffer then kill region */ /* clean out kill buffer then kill region */
kdelete(); kdelete();
if ((status = killregion(FFRAND, 1)) != TRUE) if ((status = killregion(FFRAND, 1)) != TRUE)
return (status); return (status);
/* /*
* Now step through n paragraphs. If we reach the end of buffer, * Now step through n paragraphs. If we reach the end of buffer,
* stop and paste the killed region back, then display a message. * stop and paste the killed region back, then display a message.
*/ */
@ -356,7 +356,7 @@ transposepara(int f, int n)
ewprintf("Cannot transpose paragraph, end of buffer reached."); ewprintf("Cannot transpose paragraph, end of buffer reached.");
(void)gotobop(FFRAND, i); (void)gotobop(FFRAND, i);
(void)yank(FFRAND, 1); (void)yank(FFRAND, 1);
curbp->b_flag = flg; curbp->b_flag = flg;
return (FALSE); return (FALSE);
} }
(void)yank(FFRAND, 1); (void)yank(FFRAND, 1);
@ -391,7 +391,7 @@ findpara(void)
if (lforw(curwp->w_dotp) == curbp->b_headp) if (lforw(curwp->w_dotp) == curbp->b_headp)
return (FALSE); return (FALSE);
curwp->w_dotp = lforw(curwp->w_dotp); curwp->w_dotp = lforw(curwp->w_dotp);
curwp->w_dotline++; curwp->w_dotline++;
} while (1); } while (1);

Some files were not shown because too many files have changed in this diff Show More