Assorted minor cleanup:

- use stdbool.h (partly)
  - move extern declarations of data to header files
  - use right types for calloc() wrapper
  - remove bogus casts on return values
  - remove excessive Pascal-style parentheses in conditionals
  - a couple const fixes
  - fix some typos in comments
This commit is contained in:
dholland 2009-08-13 05:53:58 +00:00
parent ab902ee68d
commit e63a3e7105
7 changed files with 308 additions and 310 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: error.h,v 1.13 2009/08/13 03:50:02 dholland Exp $ */
/* $NetBSD: error.h,v 1.14 2009/08/13 05:53:58 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@ -31,14 +31,10 @@
* @(#)error.h 8.1 (Berkeley) 6/6/93
*/
#include <stdbool.h>
typedef int boolean;
#define TRUE 1
#define FALSE 0
#define true 1
#define false 0
/*
* Descriptors for the various languages we know about.
* If you touch these, also touch lang_table
@ -113,6 +109,8 @@ extern FILE *queryfile; /* where the query responses from the user come from*/
extern char *processname;
extern char *scriptname;
extern char *suffixlist;
extern boolean query;
extern boolean terse;
int inquire(const char *, ...); /* inquire for yes/no */
@ -187,6 +185,10 @@ struct edesc {
extern int nerrors;
extern Eptr er_head;
extern int cur_wordc;
extern char **cur_wordv;
/*
* Resources for each of the files mentioned
*/
@ -205,7 +207,7 @@ extern char *currentfilename;
* Functional forwards
*/
void arrayify(int *, Eptr **, Eptr);
char *Calloc(int, int);
void *Calloc(size_t, size_t);
void clob_last(char *, char);
Errorclass discardit(Eptr);
void eaterrors(int *, Eptr **);
@ -217,13 +219,13 @@ void getignored(const char *);
char lastchar(const char *);
char next_lastchar(const char *);
void onintr(int);
boolean persperdexplode(char *, char **, char **);
bool persperdexplode(char *, char **, char **);
Errorclass pi(void);
int position(const char *, char);
void printerrors(boolean, int, Eptr []);
void printerrors(bool, int, Eptr []);
const char *plural(int);
char *substitute(char *, char, char);
boolean touchfiles(int, Eptr **, int *, char ***);
bool touchfiles(int, Eptr **, int *, char ***);
const char *verbform(int);
void wordvbuild(char *, int*, char ***);
int wordvcmp(char **, int, char **);

View File

@ -1,4 +1,4 @@
/* $NetBSD: filter.c,v 1.14 2009/08/13 04:09:53 dholland Exp $ */
/* $NetBSD: filter.c,v 1.15 2009/08/13 05:53:58 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)filter.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: filter.c,v 1.14 2009/08/13 04:09:53 dholland Exp $");
__RCSID("$NetBSD: filter.c,v 1.15 2009/08/13 05:53:58 dholland Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -75,14 +75,14 @@ getignored(const char *auxname)
nignored = 0;
if (auxname == 0) { /* use the default */
if ((username = (char *)getlogin()) == NULL) {
if ((username = getlogin()) == NULL) {
username = "Unknown";
uid = getuid();
if ((passwdentry = (struct passwd *)getpwuid(uid)) == NULL) {
if ((passwdentry = getpwuid(uid)) == NULL) {
return;
}
} else {
if ((passwdentry = (struct passwd *)getpwnam(username)) == NULL)
if ((passwdentry = getpwnam(username)) == NULL)
return;
}
strlcpy(filename, passwdentry->pw_dir, sizeof(filename));
@ -107,7 +107,7 @@ getignored(const char *auxname)
for (nignored = 0;
fgets(inbuffer, sizeof(inbuffer)-1, fyle) != NULL; nignored++)
continue;
names_ignored = (char **)Calloc(nignored+1, sizeof (char *));
names_ignored = Calloc(nignored+1, sizeof (char *));
fclose(fyle);
if (freopen(filename, "r", fyle) == NULL) {
#ifdef FULLDEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: input.c,v 1.14 2009/08/13 03:50:02 dholland Exp $ */
/* $NetBSD: input.c,v 1.15 2009/08/13 05:53:58 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: input.c,v 1.14 2009/08/13 03:50:02 dholland Exp $");
__RCSID("$NetBSD: input.c,v 1.15 2009/08/13 05:53:58 dholland Exp $");
#endif /* not lint */
#include <stdio.h>
@ -43,8 +43,8 @@ __RCSID("$NetBSD: input.c,v 1.14 2009/08/13 03:50:02 dholland Exp $");
#include <string.h>
#include "error.h"
int wordc; /* how long the current error message is */
char **wordv; /* the actual error message */
int cur_wordc; /* how long the current error message is */
char **cur_wordv; /* the actual error message */
static Errorclass catchall(void);
static Errorclass cpp(void);
@ -79,14 +79,14 @@ eaterrors(int *r_errorc, Eptr **r_errorv)
line = Calloc(inbuflen + 1, sizeof(char));
memcpy(line, inbuffer, inbuflen);
line[inbuflen] = '\0';
wordvbuild(line, &wordc, &wordv);
wordvbuild(line, &cur_wordc, &cur_wordv);
/*
* for convience, convert wordv to be 1 based, instead
* for convenience, convert cur_wordv to be 1 based, instead
* of 0 based.
*/
wordv -= 1;
if (wordc > 0 &&
cur_wordv -= 1;
if (cur_wordc > 0 &&
((( errorclass = onelong() ) != C_UNKNOWN)
|| (( errorclass = cpp() ) != C_UNKNOWN)
|| (( errorclass = pccccom() ) != C_UNKNOWN)
@ -104,8 +104,8 @@ eaterrors(int *r_errorc, Eptr **r_errorv)
) ;
else
errorclass = catchall();
if (wordc)
erroradd(wordc, wordv+1, errorclass, C_UNKNOWN);
if (cur_wordc)
erroradd(cur_wordc, cur_wordv+1, errorclass, C_UNKNOWN);
}
#ifdef FULLDEBUG
printf("%d errorentrys\n", nerrors);
@ -135,7 +135,7 @@ erroradd(int errorlength, char **errorv, Errorclass errorclass,
#endif
}
if (errorlength > 0) {
newerror = (Eptr)Calloc(1, sizeof(Edesc));
newerror = Calloc(1, sizeof(Edesc));
newerror->error_language = language; /* language is global */
newerror->error_text = errorv;
newerror->error_lgtext = errorlength;
@ -164,7 +164,7 @@ onelong(void)
{
char **nwordv;
if ((wordc == 1) && (language != INLD)) {
if (cur_wordc == 1 && language != INLD) {
/*
* We have either:
* a) file name from cc
@ -172,40 +172,40 @@ onelong(void)
* c) Noise from make ("Stop.")
* c) Random noise
*/
wordc = 0;
if (strcmp(wordv[1], "Stop.") == 0) {
cur_wordc = 0;
if (strcmp(cur_wordv[1], "Stop.") == 0) {
language = INMAKE;
return (C_SYNC);
}
if (strcmp(wordv[1], "Assembler:") == 0) {
if (strcmp(cur_wordv[1], "Assembler:") == 0) {
/* assembler always alerts us to what happened*/
language = INAS;
return (C_SYNC);
} else
if (strcmp(wordv[1], "Undefined:") == 0) {
if (strcmp(cur_wordv[1], "Undefined:") == 0) {
/* loader complains about unknown symbols*/
language = INLD;
return (C_SYNC);
}
if (lastchar(wordv[1]) == ':') {
if (lastchar(cur_wordv[1]) == ':') {
/* cc tells us what file we are in */
currentfilename = wordv[1];
currentfilename = cur_wordv[1];
(void)substitute(currentfilename, ':', '\0');
language = INCC;
return (C_SYNC);
}
} else
if ((wordc == 1) && (language == INLD)) {
nwordv = (char **)Calloc(4, sizeof(char *));
if (cur_wordc == 1 && language == INLD) {
nwordv = Calloc(4, sizeof(char *));
nwordv[0] = "ld:";
nwordv[1] = wordv[1];
nwordv[1] = cur_wordv[1];
nwordv[2] = "is";
nwordv[3] = "undefined.";
wordc = 4;
wordv = nwordv - 1;
cur_wordc = 4;
cur_wordv = nwordv - 1;
return (C_NONSPEC);
} else
if (wordc == 1) {
if (cur_wordc == 1) {
return (C_SYNC);
}
return (C_UNKNOWN);
@ -222,15 +222,15 @@ cpp(void)
* morsesend.c: 237: MAGNIBBL: argument mismatch
* test1.c: 6: undefined control
*/
if (wordc < 3)
if (cur_wordc < 3)
return (C_UNKNOWN);
if ((language != INLD) /* loader errors have almost same fmt */
&& (lastchar(wordv[1]) == ':')
&& (isdigit((unsigned char)firstchar(wordv[2])))
&& (lastchar(wordv[2]) == ':')) {
if (language != INLD /* loader errors have almost same fmt */
&& lastchar(cur_wordv[1]) == ':'
&& isdigit((unsigned char)firstchar(cur_wordv[2]))
&& lastchar(cur_wordv[2]) == ':') {
language = INCPP;
clob_last(wordv[1], '\0');
clob_last(wordv[2], '\0');
clob_last(cur_wordv[1], '\0');
clob_last(cur_wordv[2], '\0');
return (C_TRUE);
}
return (C_UNKNOWN);
@ -246,22 +246,22 @@ pccccom(void)
* "test.c", line 7: warning: old-fashioned initialization: use =
* "subdir.d/foo2.h", line 1: illegal initialization
*/
if (wordc < 4)
if (cur_wordc < 4)
return (C_UNKNOWN);
if ((firstchar(wordv[1]) == '"')
&& (lastchar(wordv[1]) == ',')
&& (next_lastchar(wordv[1]) == '"')
&& (strcmp(wordv[2],"line") == 0)
&& (isdigit((unsigned char)firstchar(wordv[3])))
&& (lastchar(wordv[3]) == ':')) {
clob_last(wordv[1], '\0'); /* drop last , */
clob_last(wordv[1], '\0'); /* drop last " */
wordv[1]++; /* drop first " */
clob_last(wordv[3], '\0'); /* drop : on line number */
wordv[2] = wordv[1]; /* overwrite "line" */
wordv++; /*compensate*/
wordc--;
currentfilename = wordv[1];
if (firstchar(cur_wordv[1]) == '"'
&& lastchar(cur_wordv[1]) == ','
&& next_lastchar(cur_wordv[1]) == '"'
&& strcmp(cur_wordv[2], "line") == 0
&& isdigit((unsigned char)firstchar(cur_wordv[3]))
&& lastchar(cur_wordv[3]) == ':') {
clob_last(cur_wordv[1], '\0'); /* drop last , */
clob_last(cur_wordv[1], '\0'); /* drop last " */
cur_wordv[1]++; /* drop first " */
clob_last(cur_wordv[3], '\0'); /* drop : on line number */
cur_wordv[2] = cur_wordv[1]; /* overwrite "line" */
cur_wordv++; /*compensate*/
cur_wordc--;
currentfilename = cur_wordv[1];
language = INCC;
return (C_TRUE);
}
@ -285,24 +285,24 @@ richieccom(void)
char **nwordv;
char *file;
if (wordc < 2)
if (cur_wordc < 2)
return (C_UNKNOWN);
if (lastchar(wordv[1]) == ':') {
cp = wordv[1] + strlen(wordv[1]) - 1;
if (lastchar(cur_wordv[1]) == ':') {
cp = cur_wordv[1] + strlen(cur_wordv[1]) - 1;
while (isdigit((unsigned char)*--cp))
continue;
if (*cp == ':') {
clob_last(wordv[1], '\0'); /* last : */
clob_last(cur_wordv[1], '\0'); /* last : */
*cp = '\0'; /* first : */
file = wordv[1];
nwordv = wordvsplice(1, wordc, wordv+1);
file = cur_wordv[1];
nwordv = wordvsplice(1, cur_wordc, cur_wordv+1);
nwordv[0] = file;
nwordv[1] = cp + 1;
wordc += 1;
wordv = nwordv - 1;
cur_wordc += 1;
cur_wordv = nwordv - 1;
language = INCC;
currentfilename = wordv[1];
currentfilename = cur_wordv[1];
return (C_TRUE);
}
}
@ -321,22 +321,22 @@ lint0(void)
*
* printf("%s(%d): %s\n", filename, linenumber, message);
*/
if (wordc < 2)
if (cur_wordc < 2)
return (C_UNKNOWN);
if ((lastchar(wordv[1]) == ':')
&& (next_lastchar(wordv[1]) == ')')) {
clob_last(wordv[1], '\0'); /* colon */
if (persperdexplode(wordv[1], &line, &file)) {
nwordv = wordvsplice(1, wordc, wordv+1);
if (lastchar(cur_wordv[1]) == ':'
&& next_lastchar(cur_wordv[1]) == ')') {
clob_last(cur_wordv[1], '\0'); /* colon */
if (persperdexplode(cur_wordv[1], &line, &file)) {
nwordv = wordvsplice(1, cur_wordc, cur_wordv+1);
nwordv[0] = file; /* file name */
nwordv[1] = line; /* line number */
wordc += 1;
wordv = nwordv - 1;
cur_wordc += 1;
cur_wordv = nwordv - 1;
language = INLINT;
return (C_TRUE);
}
wordv[1][strlen(wordv[1])] = ':';
cur_wordv[1][strlen(cur_wordv[1])] = ':';
}
return (C_UNKNOWN);
}
@ -354,7 +354,7 @@ lint1(void)
*
* Look first for type 1 lint errors
*/
if (wordc > 1 && strcmp(wordv[wordc-1], "::") == 0) {
if (cur_wordc > 1 && strcmp(cur_wordv[cur_wordc-1], "::") == 0) {
/*
* %.7s, arg. %d used inconsistently %s(%d) :: %s(%d)
* %.7s value used inconsistently %s(%d) :: %s(%d)
@ -363,16 +363,18 @@ lint1(void)
* %.7s function value type must be declared before use %s(%d) :: %s(%d)
*/
language = INLINT;
if (wordc > 2
&& (persperdexplode(wordv[wordc], &line2, &file2))
&& (persperdexplode(wordv[wordc-2], &line1, &file1))) {
nwordv1 = wordvsplice(2, wordc, wordv+1);
nwordv2 = wordvsplice(2, wordc, wordv+1);
nwordv1[0] = file1; nwordv1[1] = line1;
erroradd(wordc+2, nwordv1, C_TRUE, C_DUPL); /* takes 0 based*/
nwordv2[0] = file2; nwordv2[1] = line2;
wordc = wordc + 2;
wordv = nwordv2 - 1; /* 1 based */
if (cur_wordc > 2
&& persperdexplode(cur_wordv[cur_wordc], &line2, &file2)
&& persperdexplode(cur_wordv[cur_wordc-2], &line1, &file1)) {
nwordv1 = wordvsplice(2, cur_wordc, cur_wordv+1);
nwordv2 = wordvsplice(2, cur_wordc, cur_wordv+1);
nwordv1[0] = file1;
nwordv1[1] = line1;
erroradd(cur_wordc+2, nwordv1, C_TRUE, C_DUPL); /* takes 0 based*/
nwordv2[0] = file2;
nwordv2[1] = line2;
cur_wordc = cur_wordc + 2;
cur_wordv = nwordv2 - 1; /* 1 based */
return (C_TRUE);
}
}
@ -403,17 +405,18 @@ lint2(void)
*
* bufp defined( "./metric.h"(10) ), but never used
*/
if (wordc < 5)
if (cur_wordc < 5)
return (C_UNKNOWN);
if ((lastchar(wordv[2]) == '(' /* ')' */ )
&& (strcmp(wordv[4], "),") == 0)) {
if (lastchar(cur_wordv[2]) == '(' /* ')' */
&& strcmp(cur_wordv[4], "),") == 0) {
language = INLINT;
if (persperdexplode(wordv[3], &line, &file)) {
nwordv = wordvsplice(2, wordc, wordv+1);
nwordv[0] = file; nwordv[1] = line;
wordc = wordc + 2;
wordv = nwordv - 1; /* 1 based */
if (persperdexplode(cur_wordv[3], &line, &file)) {
nwordv = wordvsplice(2, cur_wordc, cur_wordv+1);
nwordv[0] = file;
nwordv[1] = line;
cur_wordc = cur_wordc + 2;
cur_wordv = nwordv - 1; /* 1 based */
return (C_TRUE);
}
}
@ -426,10 +429,10 @@ static char *Lint32[6] = {"value", "is", "used,", "but", "none", "returned"};
static Errorclass
lint3(void)
{
if (wordc < 3)
if (cur_wordc < 3)
return (C_UNKNOWN);
if ((wordvcmp(wordv+2, 4, Lint31) == 0)
|| (wordvcmp(wordv+2, 6, Lint32) == 0)) {
if (wordvcmp(cur_wordv+2, 4, Lint31) == 0
|| wordvcmp(cur_wordv+2, 6, Lint32) == 0) {
language = INLINT;
return (C_NONSPEC);
}
@ -459,25 +462,26 @@ f77(void)
* Warning on line %d of %s: %s
* Error. No assembly.
*/
if (wordc == 3 && wordvcmp(wordv+1, 3, F77_no_ass) == 0) {
wordc = 0;
if (cur_wordc == 3 && wordvcmp(cur_wordv+1, 3, F77_no_ass) == 0) {
cur_wordc = 0;
return (C_SYNC);
}
if (wordc < 6)
if (cur_wordc < 6)
return (C_UNKNOWN);
if ((lastchar(wordv[6]) == ':')
if (lastchar(cur_wordv[6]) == ':'
&& (
(wordvcmp(wordv+1, 3, F77_fatal) == 0)
|| (wordvcmp(wordv+1, 3, F77_error) == 0)
|| (wordvcmp(wordv+1, 3, F77_warning) == 0))
wordvcmp(cur_wordv+1, 3, F77_fatal) == 0
|| wordvcmp(cur_wordv+1, 3, F77_error) == 0
|| wordvcmp(cur_wordv+1, 3, F77_warning) == 0
)
) {
language = INF77;
nwordv = wordvsplice(2, wordc, wordv+1);
nwordv[0] = wordv[6];
nwordv = wordvsplice(2, cur_wordc, cur_wordv+1);
nwordv[0] = cur_wordv[6];
clob_last(nwordv[0],'\0');
nwordv[1] = wordv[4];
wordc += 2;
wordv = nwordv - 1; /* 1 based */
nwordv[1] = cur_wordv[4];
cur_wordc += 2;
cur_wordv = nwordv - 1; /* 1 based */
return (C_TRUE);
}
return (C_UNKNOWN);
@ -489,11 +493,11 @@ static char *Make_NotRemade[5] = {"not", "remade", "because", "of", "errors"};
static Errorclass
make(void)
{
if (wordvcmp(wordv+1, 3, Make_Croak) == 0) {
if (wordvcmp(cur_wordv+1, 3, Make_Croak) == 0) {
language = INMAKE;
return (C_SYNC);
}
if (wordvcmp(wordv+2, 5, Make_NotRemade) == 0) {
if (wordvcmp(cur_wordv+2, 5, Make_NotRemade) == 0) {
language = INMAKE;
return (C_SYNC);
}
@ -523,15 +527,15 @@ ri(void)
* synerrs++;
* }
*/
if (wordc < 3)
if (cur_wordc < 3)
return (C_UNKNOWN);
if ((firstchar(wordv[1]) == '"')
&&(lastchar(wordv[1]) == '"')
&&(lastchar(wordv[2]) == ':')
&&(isdigit((unsigned char)firstchar(wordv[2])))) {
clob_last(wordv[1], '\0'); /* drop the last " */
wordv[1]++; /* skip over the first " */
clob_last(wordv[2], '\0');
if (firstchar(cur_wordv[1]) == '"'
&& lastchar(cur_wordv[1]) == '"'
&& lastchar(cur_wordv[2]) == ':'
&& isdigit((unsigned char)firstchar(cur_wordv[2]))) {
clob_last(cur_wordv[1], '\0'); /* drop the last " */
cur_wordv[1]++; /* skip over the first " */
clob_last(cur_wordv[2], '\0');
language = INRI;
return (C_TRUE);
}
@ -555,22 +559,22 @@ troff(void)
* troff source error message, from eqn, bib, tbl...
* Just like pcc ccom, except uses `'
*/
if (wordc < 4)
if (cur_wordc < 4)
return (C_UNKNOWN);
if ((firstchar(wordv[1]) == '`')
&& (lastchar(wordv[1]) == ',')
&& (next_lastchar(wordv[1]) == '\'')
&& (strcmp(wordv[2],"line") == 0)
&& (isdigit((unsigned char)firstchar(wordv[3])))
&& (lastchar(wordv[3]) == ':')) {
clob_last(wordv[1], '\0'); /* drop last , */
clob_last(wordv[1], '\0'); /* drop last " */
wordv[1]++; /* drop first " */
clob_last(wordv[3], '\0'); /* drop : on line number */
wordv[2] = wordv[1]; /* overwrite "line" */
wordv++; /*compensate*/
currentfilename = wordv[1];
if (firstchar(cur_wordv[1]) == '`'
&& lastchar(cur_wordv[1]) == ','
&& next_lastchar(cur_wordv[1]) == '\''
&& strcmp(cur_wordv[2], "line") == 0
&& isdigit((unsigned char)firstchar(cur_wordv[3]))
&& lastchar(cur_wordv[3]) == ':') {
clob_last(cur_wordv[1], '\0'); /* drop last , */
clob_last(cur_wordv[1], '\0'); /* drop last " */
cur_wordv[1]++; /* drop first " */
clob_last(cur_wordv[3], '\0'); /* drop : on line number */
cur_wordv[2] = cur_wordv[1]; /* overwrite "line" */
cur_wordv++; /*compensate*/
currentfilename = cur_wordv[1];
language = INTROFF;
return (C_TRUE);
}
@ -583,21 +587,21 @@ mod2(void)
/*
* for decwrl modula2 compiler (powell)
*/
if (wordc < 5)
if (cur_wordc < 5)
return (C_UNKNOWN);
if (((strcmp(wordv[1], "!!!") == 0) /* early version */
|| (strcmp(wordv[1], "File") == 0)) /* later version */
&& (lastchar(wordv[2]) == ',') /* file name */
&& (strcmp(wordv[3], "line") == 0)
&& (isdigit((unsigned char)firstchar(wordv[4]))) /* line number */
&& (lastchar(wordv[4]) == ':') /* line number */
if ((strcmp(cur_wordv[1], "!!!") == 0 /* early version */
|| strcmp(cur_wordv[1], "File") == 0) /* later version */
&& lastchar(cur_wordv[2]) == ',' /* file name */
&& strcmp(cur_wordv[3], "line") == 0
&& isdigit((unsigned char)firstchar(cur_wordv[4])) /* line number */
&& lastchar(cur_wordv[4]) == ':' /* line number */
) {
clob_last(wordv[2], '\0'); /* drop last , on file name */
clob_last(wordv[4], '\0'); /* drop last : on line number */
wordv[3] = wordv[2]; /* file name on top of "line" */
wordv += 2;
wordc -= 2;
currentfilename = wordv[1];
clob_last(cur_wordv[2], '\0'); /* drop last , on file name */
clob_last(cur_wordv[4], '\0'); /* drop last : on line number */
cur_wordv[3] = cur_wordv[2]; /* file name on top of "line" */
cur_wordv += 2;
cur_wordc -= 2;
currentfilename = cur_wordv[1];
language = INMOD2;
return (C_TRUE);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.15 2009/08/13 03:50:02 dholland Exp $ */
/* $NetBSD: main.c,v 1.16 2009/08/13 05:53:58 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: main.c,v 1.15 2009/08/13 03:50:02 dholland Exp $");
__RCSID("$NetBSD: main.c,v 1.16 2009/08/13 05:53:58 dholland Exp $");
#endif /* not lint */
#include <signal.h>
@ -69,17 +69,17 @@ int language = INCC;
char *currentfilename = "????";
char *processname;
boolean query = FALSE; /* query the operator if touch files */
boolean terse = FALSE; /* Terse output */
boolean query = false; /* query the operator if touch files */
boolean terse = false; /* Terse output */
static char im_on[] = _PATH_TTY; /* my tty name */
static boolean notouch = FALSE; /* don't touch ANY files */
static boolean notouch = false; /* don't touch ANY files */
char *suffixlist = ".*"; /* initially, can touch any file */
static int errorsort(const void *, const void *);
static void forkvi(int, char **);
static void try(char *, int, char **);
static void try(const char *, int, char **);
/*
* error [-I ignorename] [-n] [-q] [-t suffixlist] [-s] [-v] [infile]
@ -131,16 +131,16 @@ main(int argc, char **argv)
char *ignorename = 0;
int ed_argc;
char **ed_argv; /* return from touchfiles */
boolean show_errors = FALSE;
boolean Show_Errors = FALSE;
boolean pr_summary = FALSE;
boolean edit_files = FALSE;
boolean show_errors = false;
boolean Show_Errors = false;
boolean pr_summary = false;
boolean edit_files = false;
processname = argv[0];
errorfile = stdin;
if (argc > 1)
for (; (argc > 1) && (argv[1][0] == '-'); argc--, argv++) {
for (; argc > 1 && argv[1][0] == '-'; argc--, argv++) {
for (cp = argv[1] + 1; *cp; cp++)
switch (*cp) {
default:
@ -148,12 +148,12 @@ main(int argc, char **argv)
processname, *cp);
break;
case 'n': notouch = TRUE; break;
case 'q': query = TRUE; break;
case 'S': Show_Errors = TRUE; break;
case 's': pr_summary = TRUE; break;
case 'v': edit_files = TRUE; break;
case 'T': terse = TRUE; break;
case 'n': notouch = true; break;
case 'q': query = true; break;
case 'S': Show_Errors = true; break;
case 's': pr_summary = true; break;
case 'v': edit_files = true; break;
case 'T': terse = true; break;
case 't':
*cp-- = 0; argv++; argc--;
if (argc > 1) {
@ -198,10 +198,10 @@ main(int argc, char **argv)
getignored(ignorename);
eaterrors(&nerrors, &errors);
if (Show_Errors)
printerrors(TRUE, nerrors, errors);
printerrors(true, nerrors, errors);
qsort(errors, nerrors, sizeof(Eptr), errorsort);
if (show_errors)
printerrors(FALSE, nerrors, errors);
printerrors(false, nerrors, errors);
findfiles(nerrors, errors, &nfiles, &files);
#define P(msg, arg) fprintf(stdout, msg, arg)
if (pr_summary) {
@ -247,7 +247,7 @@ forkvi(int argc, char **argv)
/*
* ed_agument's first argument is
* a vi/ex compatible search argument
* to find the first occurance of ###
* to find the first occurrence of ###
*/
try("vi", argc, argv);
try("ex", argc, argv);
@ -256,9 +256,9 @@ forkvi(int argc, char **argv)
}
static void
try(char *name, int argc, char **argv)
try(const char *name, int argc, char **argv)
{
argv[0] = name;
argv[0] = __UNCONST(name);
wordvprint(stdout, argc, argv);
fprintf(stdout, "\n");
fflush(stderr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pi.c,v 1.15 2009/08/13 03:50:02 dholland Exp $ */
/* $NetBSD: pi.c,v 1.16 2009/08/13 05:53:58 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pi.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: pi.c,v 1.15 2009/08/13 03:50:02 dholland Exp $");
__RCSID("$NetBSD: pi.c,v 1.16 2009/08/13 05:53:58 dholland Exp $");
#endif /* not lint */
#include <stdio.h>
@ -175,9 +175,9 @@ instringset(const char *member, char **set)
{
for (; *set; set++) {
if (strcmp(*set, member) == 0)
return (TRUE);
return true;
}
return (FALSE);
return false;
}
static boolean
@ -195,31 +195,28 @@ static boolean
piptr(const char *string)
{
if (*string != '-')
return (FALSE);
return false;
while (*string && *string == '-')
string++;
if (*string != '^')
return (FALSE);
return false;
string++;
while (*string && *string == '-')
string++;
return (*string == '\0');
}
extern int wordc;
extern char **wordv;
Errorclass
pi(void)
{
char **nwordv;
nwordv = NULL;
if (wordc < 2)
if (cur_wordc < 2)
return (C_UNKNOWN);
if ( ( strlen(wordv[1]) == 1)
&& ( (wordv[1][0] == 'e') || (wordv[1][0] == 'E') )
&& ( piptr(wordv[2]) )
if (strlen(cur_wordv[1]) == 1
&& ( cur_wordv[1][0] == 'e' || cur_wordv[1][0] == 'E')
&& piptr(cur_wordv[2])
) {
boolean longpiptr = 0;
@ -246,48 +243,48 @@ pi(void)
* the pointer points into a tab preceded input line.
*/
language = INPI;
(void)substitute(wordv[2], '^', '|');
longpiptr = position(wordv[2],'|') > (6+8);
nwordv = wordvsplice(longpiptr ? 2 : 4, wordc, wordv+1);
(void)substitute(cur_wordv[2], '^', '|');
longpiptr = position(cur_wordv[2],'|') > (6+8);
nwordv = wordvsplice(longpiptr ? 2 : 4, cur_wordc, cur_wordv+1);
nwordv[0] = strdup(currentfilename);
nwordv[1] = strdup(c_linenumber);
if (!longpiptr) {
nwordv[2] = "pascal errortype";
nwordv[3] = wordv[1];
nwordv[3] = cur_wordv[1];
nwordv[4] = strdup("%%%\n");
if (strlen(nwordv[5]) > (8-2)) /* this is the pointer */
nwordv[5] += (8-2); /* bump over 6 characters */
}
wordv = nwordv - 1; /* convert to 1 based */
wordc += longpiptr ? 2 : 4;
cur_wordv = nwordv - 1; /* convert to 1 based */
cur_wordc += longpiptr ? 2 : 4;
return (C_TRUE);
}
if ((wordc >= 4)
&& (strlen(wordv[1]) == 1)
&& ((*wordv[1] == 'E') || (*wordv[1] == 'w') || (*wordv[1] == 'e'))
&& (alldigits(wordv[2]))
&& (strlen(wordv[3]) == 1)
&& (wordv[3][0] == '-')
if (cur_wordc >= 4
&& strlen(cur_wordv[1]) == 1
&& (*cur_wordv[1] == 'E' || *cur_wordv[1] == 'w' || *cur_wordv[1] == 'e')
&& alldigits(cur_wordv[2])
&& strlen(cur_wordv[3]) == 1
&& cur_wordv[3][0] == '-'
) {
/*
* Message of the form: letter linenumber - message
* Turn into form: filename linenumber letter - message
*/
language = INPI;
nwordv = wordvsplice(1, wordc, wordv + 1);
nwordv = wordvsplice(1, cur_wordc, cur_wordv + 1);
nwordv[0] = strdup(currentfilename);
nwordv[1] = wordv[2];
nwordv[2] = wordv[1];
c_linenumber = wordv[2];
wordc += 1;
wordv = nwordv - 1;
nwordv[1] = cur_wordv[2];
nwordv[2] = cur_wordv[1];
c_linenumber = cur_wordv[2];
cur_wordc += 1;
cur_wordv = nwordv - 1;
return (C_TRUE);
}
if ((wordc >= 3)
&& (strlen(wordv[1]) == 1)
&& ((*(wordv[1]) == 'E') || (*(wordv[1]) == 'w') || (*(wordv[1]) == 'e'))
&& (strlen(wordv[2]) == 1)
&& (wordv[2][0] == '-')
if (cur_wordc >= 3
&& strlen(cur_wordv[1]) == 1
&& (*cur_wordv[1] == 'E' || *cur_wordv[1] == 'w' || *cur_wordv[1] == 'e')
&& strlen(cur_wordv[2]) == 1
&& cur_wordv[2][0] == '-'
) {
/*
* Message of the form: letter - message
@ -312,80 +309,81 @@ pi(void)
int wordindex;
language = INPI;
if ((undefined = (wordvcmp(wordv+2, 3, pi_und1) == 0))
|| (undefined = (wordvcmp(wordv+2, 3, pi_und2) == 0))
|| (wordvcmp(wordv+2, 4, pi_imp1) == 0)
|| (wordvcmp(wordv+2, 4, pi_imp2) == 0)
if ((undefined = (wordvcmp(cur_wordv+2, 3, pi_und1) == 0))
|| (undefined = (wordvcmp(cur_wordv+2, 3, pi_und2) == 0))
|| wordvcmp(cur_wordv+2, 4, pi_imp1) == 0
|| wordvcmp(cur_wordv+2, 4, pi_imp2) == 0
) {
for (wordindex = undefined ? 5 : 6; wordindex <= wordc;
wordindex++) {
for (wordindex = undefined ? 5 : 6;
wordindex <= cur_wordc;
wordindex++) {
if (nwordv) {
free(nwordv[0]);
free(nwordv);
}
nwordv = wordvsplice(2, undefined ? 2 : 3, wordv+1);
nwordv = wordvsplice(2, undefined ? 2 : 3, cur_wordv+1);
nwordv[0] = strdup(currentfilename);
nwordv[1] = wordv[wordindex];
if (wordindex != wordc)
nwordv[1] = cur_wordv[wordindex];
if (wordindex != cur_wordc)
erroradd(undefined ? 4 : 5, nwordv,
C_TRUE, C_UNKNOWN);
}
wordc = undefined ? 4 : 5;
wordv = nwordv - 1;
cur_wordc = undefined ? 4 : 5;
cur_wordv = nwordv - 1;
return (C_TRUE);
}
nwordv = wordvsplice(1+3, wordc, wordv+1);
nwordv = wordvsplice(1+3, cur_wordc, cur_wordv+1);
nwordv[0] = strdup(currentfilename);
nwordv[1] = strdup(c_header[0]);
nwordv[2] = strdup(c_header[1]);
nwordv[3] = strdup(c_header[2]);
wordv = nwordv - 1;
wordc += 1 + 3;
cur_wordv = nwordv - 1;
cur_wordc += 1 + 3;
return (C_THISFILE);
}
if (strcmp(wordv[1], "...") == 0) {
if (strcmp(cur_wordv[1], "...") == 0) {
/*
* have a continuation error message
* of the form: ... message
* Turn into form : filename linenumber message
*/
language = INPI;
nwordv = wordvsplice(1, wordc, wordv+1);
nwordv = wordvsplice(1, cur_wordc, cur_wordv+1);
nwordv[0] = strdup(currentfilename);
nwordv[1] = strdup(c_linenumber);
wordv = nwordv - 1;
wordc += 1;
cur_wordv = nwordv - 1;
cur_wordc += 1;
return (C_TRUE);
}
if ((wordc == 6)
&& (lastchar(wordv[6]) == ':')
&& (isdateformat(5, wordv + 1))
if (cur_wordc == 6
&& lastchar(cur_wordv[6]) == ':'
&& isdateformat(5, cur_wordv + 1)
) {
/*
* Have message that tells us we have changed files
*/
language = INPI;
currentfilename = strdup(wordv[6]);
currentfilename = strdup(cur_wordv[6]);
clob_last(currentfilename, '\0');
return (C_SYNC);
}
if ((wordc == 3)
&& (strcmp(wordv[1], "In") == 0)
&& (lastchar(wordv[3]) == ':')
&& (instringset(wordv[2], Piroutines))
if (cur_wordc == 3
&& strcmp(cur_wordv[1], "In") == 0
&& lastchar(cur_wordv[3]) == ':'
&& instringset(cur_wordv[2], Piroutines)
) {
language = INPI;
c_header = wordvsplice(0, wordc, wordv+1);
c_header = wordvsplice(0, cur_wordc, cur_wordv+1);
return (C_SYNC);
}
/*
* now, check for just the line number followed by the text
*/
if (alldigits(wordv[1])) {
if (alldigits(cur_wordv[1])) {
language = INPI;
c_linenumber = wordv[1];
c_linenumber = cur_wordv[1];
return (C_IGNORE);
}
@ -399,22 +397,22 @@ pi(void)
*/
multiple = structured = 0;
if (
((wordc == 6) && (wordvcmp(wordv+1, 2, pi_Endmatched) == 0))
|| ((wordc == 8) && (wordvcmp(wordv+1, 4, pi_Inserted) == 0))
|| (multiple = ((wordc == 9) && (wordvcmp(wordv+1,6, pi_multiple) == 0)))
|| (structured = ((wordc == 10) && (wordvcmp(wordv+6,5, pi_structured) == 0 )))
(cur_wordc == 6 && wordvcmp(cur_wordv+1, 2, pi_Endmatched) == 0)
|| (cur_wordc == 8 && wordvcmp(cur_wordv+1, 4, pi_Inserted) == 0)
|| (multiple = (cur_wordc == 9 && wordvcmp(cur_wordv+1,6, pi_multiple) == 0))
|| (structured = (cur_wordc == 10 && wordvcmp(cur_wordv+6,5, pi_structured) == 0))
) {
language = INPI;
nwordv = wordvsplice(2, wordc, wordv+1);
nwordv = wordvsplice(2, cur_wordc, cur_wordv+1);
nwordv[0] = strdup(currentfilename);
nwordv[1] = structured ? wordv [5] : wordv[wordc];
wordc += 2;
wordv = nwordv - 1;
nwordv[1] = structured ? cur_wordv [5] : cur_wordv[cur_wordc];
cur_wordc += 2;
cur_wordv = nwordv - 1;
if (!multiple)
return (C_TRUE);
erroradd(wordc, nwordv, C_TRUE, C_UNKNOWN);
nwordv = wordvsplice(0, wordc, nwordv);
nwordv[1] = wordv[wordc - 2];
erroradd(cur_wordc, nwordv, C_TRUE, C_UNKNOWN);
nwordv = wordvsplice(0, cur_wordc, nwordv);
nwordv[1] = cur_wordv[cur_wordc - 2];
return (C_TRUE);
}
return (C_UNKNOWN);

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr.c,v 1.17 2009/08/13 03:50:02 dholland Exp $ */
/* $NetBSD: subr.c,v 1.18 2009/08/13 05:53:58 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: subr.c,v 1.17 2009/08/13 03:50:02 dholland Exp $");
__RCSID("$NetBSD: subr.c,v 1.18 2009/08/13 05:53:58 dholland Exp $");
#endif /* not lint */
#include <ctype.h>
@ -58,7 +58,7 @@ arrayify(int *e_length, Eptr **e_array, Eptr header)
for (errorp = header, listlength = 0;
errorp; errorp = errorp->error_next, listlength++)
continue;
array = (Eptr*)Calloc(listlength+1, sizeof (Eptr));
array = Calloc(listlength+1, sizeof (Eptr));
for (listindex = 0, errorp = header;
listindex < listlength;
listindex++, errorp = errorp->error_next) {
@ -70,12 +70,13 @@ arrayify(int *e_length, Eptr **e_array, Eptr header)
*e_array = array;
}
char *
Calloc(int nelements, int size)
void *
Calloc(size_t nelements, size_t size)
{
char *back;
void *back;
if ( (back = (char *)calloc(nelements, size)) == NULL)
back = calloc(nelements, size);
if (back == NULL)
errx(1, "Ran out of memory.");
return (back);
}
@ -168,7 +169,7 @@ clob_last(char *string, char newstuff)
* parse a string that is the result of a format %s(%d)
* return TRUE if this is of the proper format
*/
boolean
bool
persperdexplode(char *string, char **r_perd, char **r_pers)
{
char *cp;
@ -176,10 +177,9 @@ persperdexplode(char *string, char **r_perd, char **r_pers)
if (string)
length = strlen(string);
if ((length >= 4)
&& (string[length - 1] == ')')) {
if (length >= 4 && string[length - 1] == ')') {
for (cp = &string[length - 2];
(isdigit((unsigned char)*cp)) && (*cp != '(');
isdigit((unsigned char)*cp) && *cp != '(';
--cp)
continue;
if (*cp == '(') {
@ -189,10 +189,10 @@ persperdexplode(char *string, char **r_perd, char **r_pers)
*cp = '\0'; /* clobber the ( */
*r_pers = strdup(string);
*cp = '(';
return (TRUE);
return true;
}
}
return (FALSE);
return false;
}
#if 0 /* unused */
@ -208,10 +208,9 @@ qpersperdexplode(char *string, char **r_perd, char **r_pers)
if (string)
length = strlen(string);
if ((length >= 4)
&& (string[length - 1] == ')')) {
if (length >= 4 && string[length - 1] == ')') {
for (cp = &string[length - 2];
(isdigit((unsigned char)*cp)) && (*cp != '(');
isdigit((unsigned char)*cp) && *cp != '(';
--cp)
continue;
if (*cp == '(' && *(cp - 1) == '"') {
@ -221,10 +220,10 @@ qpersperdexplode(char *string, char **r_perd, char **r_pers)
*(cp - 1) = '\0'; /* clobber the " */
*r_pers = strdup(string + 1);
*(cp - 1) = '"';
return (TRUE);
return true;
}
}
return (FALSE);
return false;
}
#endif /* 0 - unused */
@ -268,7 +267,7 @@ struct lang_desc lang_table[] = {
};
void
printerrors(boolean look_at_subclass, int errorc, Eptr errorv[])
printerrors(bool look_at_subclass, int errorc, Eptr errorv[])
{
int i;
Eptr errorp;
@ -320,7 +319,7 @@ wordvbuild(char *string, int *r_wordc, char ***r_wordv)
while (*cp && !isspace((unsigned char)*cp))
cp++;
}
wordv = (char **)Calloc(wordcount + 1, sizeof (char *));
wordv = Calloc(wordcount + 1, sizeof (char *));
for (cp=string, wordindex=0; wordcount; wordindex++, --wordcount) {
while (*cp && isspace((unsigned char)*cp))
cp++;
@ -372,7 +371,7 @@ wordvsplice(int emptyhead, int wordc, char **wordv)
int nwordc = emptyhead + wordc;
int i;
nwordv = (char **)Calloc(nwordc, sizeof (char *));
nwordv = Calloc(nwordc, sizeof (char *));
for (i = 0; i < emptyhead; i++)
nwordv[i] = NULL;
for (i = emptyhead; i < nwordc; i++) {
@ -382,7 +381,7 @@ wordvsplice(int emptyhead, int wordc, char **wordv)
}
/*
* plural'ize and verb forms
* plural and verb forms
*/
static const char *S = "s";
static const char *N = "";

View File

@ -1,4 +1,4 @@
/* $NetBSD: touch.c,v 1.20 2009/08/13 04:09:53 dholland Exp $ */
/* $NetBSD: touch.c,v 1.21 2009/08/13 05:53:58 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: touch.c,v 1.20 2009/08/13 04:09:53 dholland Exp $");
__RCSID("$NetBSD: touch.c,v 1.21 2009/08/13 05:53:58 dholland Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -62,8 +62,6 @@ __RCSID("$NetBSD: touch.c,v 1.20 2009/08/13 04:09:53 dholland Exp $");
static int touchstatus = Q_YES;
extern char *suffixlist;
/*
* codes for probethisfile to return
*/
@ -102,8 +100,8 @@ findfiles(int my_nerrors, Eptr *my_errors, int *r_nfiles, Eptr ***r_files)
my_nfiles = countfiles(my_errors);
my_files = (Eptr**)Calloc(my_nfiles + 3, sizeof (Eptr*));
touchedfiles = (boolean *)Calloc(my_nfiles+3, sizeof(boolean));
my_files = Calloc(my_nfiles + 3, sizeof (Eptr*));
touchedfiles = Calloc(my_nfiles+3, sizeof(boolean));
/*
* Now, partition off the error messages
* into those that are synchronization, discarded or
@ -120,15 +118,15 @@ findfiles(int my_nerrors, Eptr *my_errors, int *r_nfiles, Eptr ***r_files)
* for a given file.
*/
my_files[1] = &my_errors[ei];
touchedfiles[0] = touchedfiles[1] = FALSE;
touchedfiles[0] = touchedfiles[1] = false;
name = "\1";
fi = 1;
ECITERATE(ei, errorp, ei, my_errors, my_nerrors) {
if ((errorp->error_e_class == C_NULLED)
|| (errorp->error_e_class == C_TRUE)) {
if (errorp->error_e_class == C_NULLED
|| errorp->error_e_class == C_TRUE) {
if (strcmp(errorp->error_text[0], name) != 0) {
name = errorp->error_text[0];
touchedfiles[fi] = FALSE;
touchedfiles[fi] = false;
my_files[fi] = &my_errors[ei];
fi++;
}
@ -235,7 +233,7 @@ nopertain(Eptr **my_files)
EITERATE(erpp, my_files, 0) {
errorp = *erpp;
if (errorp->error_e_class == type) {
errorprint(stdout, errorp, TRUE);
errorprint(stdout, errorp, true);
}
}
}
@ -243,9 +241,7 @@ nopertain(Eptr **my_files)
return (someerrors);
}
extern boolean notouch;
boolean
bool
touchfiles(int my_nfiles, Eptr **my_files, int *r_edargc, char ***r_edargv)
{
const char *name;
@ -282,7 +278,7 @@ touchfiles(int my_nfiles, Eptr **my_files, int *r_edargc, char ***r_edargv)
hackfile(name, my_files, fi, ntrueerrors);
}
scribbled = FALSE;
scribbled = false;
n_pissed_on = 0;
FILEITERATE(fi, 1, my_nfiles) {
scribbled |= touchedfiles[fi];
@ -293,11 +289,11 @@ touchfiles(int my_nfiles, Eptr **my_files, int *r_edargc, char ***r_edargv)
* Construct an execv argument
*/
execvarg(n_pissed_on, r_edargc, r_edargv);
return (TRUE);
return true;
} else {
if (!terse)
fprintf(stdout, "You didn't touch any files.\n");
return (FALSE);
return false;
}
}
@ -308,7 +304,7 @@ hackfile(const char *name, Eptr **my_files, int ix, int my_nerrors)
int errordest; /* where errors go */
if (!oktotouch(name)) {
previewed = FALSE;
previewed = false;
errordest = TOSTDOUT;
} else {
previewed = preview(name, my_nerrors, my_files, ix);
@ -316,9 +312,9 @@ hackfile(const char *name, Eptr **my_files, int ix, int my_nerrors)
}
if (errordest != TOSTDOUT)
touchedfiles[ix] = TRUE;
touchedfiles[ix] = true;
if (previewed && (errordest == TOSTDOUT))
if (previewed && errordest == TOSTDOUT)
return;
diverterrors(name, errordest, my_files, ix, previewed, my_nerrors);
@ -338,17 +334,17 @@ preview(const char *name, int my_nerrors, Eptr **my_files, int ix)
Eptr *erpp;
if (my_nerrors <= 0)
return (FALSE);
back = FALSE;
return false;
back = false;
if (query) {
switch (inquire(terse
? "Preview? "
: "Do you want to preview the errors first? ")) {
case Q_YES:
case Q_yes:
back = TRUE;
back = true;
EITERATE(erpp, my_files, ix) {
errorprint(stdout, *erpp, TRUE);
errorprint(stdout, *erpp, true);
}
if (!terse)
fprintf(stdout, "\n");
@ -420,8 +416,7 @@ diverterrors(const char *name, int dest, Eptr **my_files, int ix,
my_nerrors = my_files[ix+1] - my_files[ix];
if ((my_nerrors != nterrors)
&& (!previewed)) {
if (my_nerrors != nterrors && !previewed) {
fprintf(stdout, terse
? "Uninserted errors\n"
: ">>Uninserted errors for file \"%s\" follow.\n",
@ -433,18 +428,18 @@ diverterrors(const char *name, int dest, Eptr **my_files, int ix,
if (errorp->error_e_class != C_TRUE) {
if (previewed || touchstatus == Q_NO)
continue;
errorprint(stdout, errorp, TRUE);
errorprint(stdout, errorp, true);
continue;
}
switch (dest) {
case TOSTDOUT:
if (previewed || touchstatus == Q_NO)
continue;
errorprint(stdout,errorp, TRUE);
errorprint(stdout,errorp, true);
break;
case TOTHEFILE:
insert(errorp->error_line);
text(errorp, FALSE);
text(errorp, false);
break;
}
}
@ -467,7 +462,7 @@ oktotouch(const char *filename)
--pat; /* point to the period */
for (src = &filename[strlen(filename)], --src;
(src > filename) && (*src != '.'); --src)
src > filename && *src != '.'; --src)
continue;
if (*src != '.')
return (0);
@ -510,7 +505,7 @@ execvarg(int n_pissed_on, int *r_argc, char ***r_argv)
int fi;
sep = NULL;
(*r_argv) = (char **)Calloc(n_pissed_on + 3, sizeof(char *));
(*r_argv) = Calloc(n_pissed_on + 3, sizeof(char *));
(*r_argc) = n_pissed_on + 2;
(*r_argv)[1] = "+1;/###/";
n_pissed_on = 2;
@ -539,7 +534,7 @@ static const char *o_name;
static char n_name[MAXPATHLEN];
static int o_lineno;
static int n_lineno;
static boolean tempfileopen = FALSE;
static boolean tempfileopen = false;
/*
* open the file; guaranteed to be both readable and writable
@ -555,7 +550,7 @@ edit(const char *name)
if ((o_touchedfile = fopen(name, "r")) == NULL) {
fprintf(stderr, "%s: Can't open file \"%s\" to touch (read).\n",
processname, name);
return (TRUE);
return true;
}
if ((tmpdir = getenv("TMPDIR")) == NULL)
tmpdir = _PATH_TMP;
@ -567,12 +562,12 @@ edit(const char *name)
close(fd);
fprintf(stderr,"%s: Can't open file \"%s\" to touch (write).\n",
processname, name);
return (TRUE);
return true;
}
tempfileopen = TRUE;
tempfileopen = true;
n_lineno = 0;
o_lineno = 0;
return (FALSE);
return false;
}
/*
@ -669,8 +664,8 @@ writetouched(int overwrite)
* Kiss the temp file good bye
*/
unlink(n_name);
tempfileopen = FALSE;
return (TRUE);
tempfileopen = false;
return true;
}
/*