Module Name: src
Committed By: rillig
Date: Sat Aug 26 12:43:28 UTC 2023
Modified Files:
src/usr.bin/error: filter.c input.c pi.c subr.c touch.c
Log Message:
error: remove redundant parentheses around return value
No binary change.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/error/filter.c \
src/usr.bin/error/input.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/error/pi.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/error/subr.c
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/error/touch.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/error/filter.c
diff -u src/usr.bin/error/filter.c:1.18 src/usr.bin/error/filter.c:1.19
--- src/usr.bin/error/filter.c:1.18 Mon May 30 16:35:35 2016
+++ src/usr.bin/error/filter.c Sat Aug 26 12:43:28 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: filter.c,v 1.18 2016/05/30 16:35:35 dholland Exp $ */
+/* $NetBSD: filter.c,v 1.19 2023/08/26 12:43:28 rillig 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.18 2016/05/30 16:35:35 dholland Exp $");
+__RCSID("$NetBSD: filter.c,v 1.19 2023/08/26 12:43:28 rillig Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -132,7 +132,7 @@ lexsort(const void *c1, const void *c2)
cpp1 = c1;
cpp2 = c2;
- return (strcmp(*cpp1, *cpp2));
+ return strcmp(*cpp1, *cpp2);
}
static int
@@ -143,17 +143,17 @@ search_ignore(const char *key)
int order;
if (nignored == 0)
- return (-1);
+ return -1;
for (lb = 0, ub = nignored - 1; ub >= lb; ) {
halfway = (ub + lb)/2;
if ( (order = strcmp(key, names_ignored[halfway])) == 0)
- return (halfway);
+ return halfway;
if (order < 0) /* key is less than probe, throw away above */
ub = halfway - 1;
else
lb = halfway + 1;
}
- return (-1);
+ return -1;
}
/*
@@ -172,17 +172,17 @@ discardit(Eptr errorp)
switch (errorclass) {
case C_SYNC:
case C_NONSPEC:
- case C_UNKNOWN: return (errorclass);
+ case C_UNKNOWN: return errorclass;
default: ;
}
if (errorp->error_lgtext < 2) {
- return (C_NONSPEC);
+ return C_NONSPEC;
}
if (errorp->error_language == INLINT) {
if (errorclass != C_NONSPEC) { /* no file */
for (i=0; lint_libs[i] != 0; i++) {
if (strcmp(errorp->error_text[0], lint_libs[i]) == 0) {
- return (C_DISCARD);
+ return C_DISCARD;
}
}
}
@@ -190,8 +190,8 @@ discardit(Eptr errorp)
if (ispunct((unsigned char)lastchar(errorp->error_text[2])))
clob_last(errorp->error_text[2], '\0');
if (search_ignore(errorp->error_text[errorclass == C_NONSPEC ? 0 : 2]) >= 0) {
- return (C_NULLED);
+ return C_NULLED;
}
}
- return (errorclass);
+ return errorclass;
}
Index: src/usr.bin/error/input.c
diff -u src/usr.bin/error/input.c:1.18 src/usr.bin/error/input.c:1.19
--- src/usr.bin/error/input.c:1.18 Fri Jan 10 18:35:29 2020
+++ src/usr.bin/error/input.c Sat Aug 26 12:43:28 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: input.c,v 1.18 2020/01/10 18:35:29 christos Exp $ */
+/* $NetBSD: input.c,v 1.19 2023/08/26 12:43:28 rillig 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.18 2020/01/10 18:35:29 christos Exp $");
+__RCSID("$NetBSD: input.c,v 1.19 2023/08/26 12:43:28 rillig Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -175,24 +175,24 @@ onelong(void)
cur_wordc = 0;
if (strcmp(cur_wordv[1], "Stop.") == 0) {
language = INMAKE;
- return (C_SYNC);
+ return C_SYNC;
}
if (strcmp(cur_wordv[1], "Assembler:") == 0) {
/* assembler always alerts us to what happened*/
language = INAS;
- return (C_SYNC);
+ return C_SYNC;
} else
if (strcmp(cur_wordv[1], "Undefined:") == 0) {
/* loader complains about unknown symbols*/
language = INLD;
- return (C_SYNC);
+ return C_SYNC;
}
if (lastchar(cur_wordv[1]) == ':') {
/* cc tells us what file we are in */
currentfilename = cur_wordv[1];
(void)substitute(currentfilename, ':', '\0');
language = INCC;
- return (C_SYNC);
+ return C_SYNC;
}
} else
if (cur_wordc == 1 && language == INLD) {
@@ -203,12 +203,12 @@ onelong(void)
nwordv[3] = Strdup("undefined.");/* XXX leaked */
cur_wordc = 4;
cur_wordv = nwordv - 1;
- return (C_NONSPEC);
+ return C_NONSPEC;
} else
if (cur_wordc == 1) {
- return (C_SYNC);
+ return C_SYNC;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
} /* end of one long */
static Errorclass
@@ -223,7 +223,7 @@ cpp(void)
* test1.c: 6: undefined control
*/
if (cur_wordc < 3)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (language != INLD /* loader errors have almost same fmt */
&& lastchar(cur_wordv[1]) == ':'
&& isdigit((unsigned char)firstchar(cur_wordv[2]))
@@ -231,9 +231,9 @@ cpp(void)
language = INCPP;
clob_last(cur_wordv[1], '\0');
clob_last(cur_wordv[2], '\0');
- return (C_TRUE);
+ return C_TRUE;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
} /*end of cpp*/
static Errorclass
@@ -247,7 +247,7 @@ pccccom(void)
* "subdir.d/foo2.h", line 1: illegal initialization
*/
if (cur_wordc < 4)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (firstchar(cur_wordv[1]) == '"'
&& lastchar(cur_wordv[1]) == ','
&& next_lastchar(cur_wordv[1]) == '"'
@@ -263,9 +263,9 @@ pccccom(void)
cur_wordc--;
currentfilename = cur_wordv[1];
language = INCC;
- return (C_TRUE);
+ return C_TRUE;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
} /* end of ccom */
/*
@@ -339,7 +339,7 @@ richieccom(void)
char *file;
if (cur_wordc < 2)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (lastchar(cur_wordv[1]) == ':') {
cp = cur_wordv[1] + strlen(cur_wordv[1]) - 1;
@@ -356,10 +356,10 @@ richieccom(void)
cur_wordv = nwordv - 1;
language = INCC;
currentfilename = cur_wordv[1];
- return (C_TRUE);
+ return C_TRUE;
}
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
}
static Errorclass
@@ -375,7 +375,7 @@ lint0(void)
* printf("%s(%d): %s\n", filename, linenumber, message);
*/
if (cur_wordc < 2)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (lastchar(cur_wordv[1]) == ':'
&& next_lastchar(cur_wordv[1]) == ')') {
@@ -387,11 +387,11 @@ lint0(void)
cur_wordc += 1;
cur_wordv = nwordv - 1;
language = INLINT;
- return (C_TRUE);
+ return C_TRUE;
}
cur_wordv[1][strlen(cur_wordv[1])] = ':';
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
}
static Errorclass
@@ -428,7 +428,7 @@ lint1(void)
nwordv2[1] = line2;
cur_wordc = cur_wordc + 2;
cur_wordv = nwordv2 - 1; /* 1 based */
- return (C_TRUE);
+ return C_TRUE;
}
}
if (file2)
@@ -439,7 +439,7 @@ lint1(void)
free(line2);
if (line1)
free(line1);
- return (C_UNKNOWN);
+ return C_UNKNOWN;
} /* end of lint 1*/
static Errorclass
@@ -459,7 +459,7 @@ lint2(void)
* bufp defined( "./metric.h"(10) ), but never used
*/
if (cur_wordc < 5)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (lastchar(cur_wordv[2]) == '(' /* ')' */
&& strcmp(cur_wordv[4], "),") == 0) {
@@ -470,10 +470,10 @@ lint2(void)
nwordv[1] = line;
cur_wordc = cur_wordc + 2;
cur_wordv = nwordv - 1; /* 1 based */
- return (C_TRUE);
+ return C_TRUE;
}
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
} /* end of lint 2*/
#if 0 /* not const-correct */
@@ -490,13 +490,13 @@ static Errorclass
lint3(void)
{
if (cur_wordc < 3)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (wordvcmp(cur_wordv+2, 4, Lint31) == 0
|| wordvcmp(cur_wordv+2, 6, Lint32) == 0) {
language = INLINT;
- return (C_NONSPEC);
+ return C_NONSPEC;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
}
/*
@@ -531,10 +531,10 @@ f77(void)
*/
if (cur_wordc == 3 && wordvcmp(cur_wordv+1, 3, F77_no_ass) == 0) {
cur_wordc = 0;
- return (C_SYNC);
+ return C_SYNC;
}
if (cur_wordc < 6)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (lastchar(cur_wordv[6]) == ':'
&& (
wordvcmp(cur_wordv+1, 3, F77_fatal) == 0
@@ -549,9 +549,9 @@ f77(void)
nwordv[1] = cur_wordv[4];
cur_wordc += 2;
cur_wordv = nwordv - 1; /* 1 based */
- return (C_TRUE);
+ return C_TRUE;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
} /* end of f77 */
#if 0 /* not const-correct */
@@ -568,13 +568,13 @@ make(void)
{
if (wordvcmp(cur_wordv+1, 3, Make_Croak) == 0) {
language = INMAKE;
- return (C_SYNC);
+ return C_SYNC;
}
if (wordvcmp(cur_wordv+2, 5, Make_NotRemade) == 0) {
language = INMAKE;
- return (C_SYNC);
+ return C_SYNC;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
}
static Errorclass
@@ -601,7 +601,7 @@ ri(void)
* }
*/
if (cur_wordc < 3)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (firstchar(cur_wordv[1]) == '"'
&& lastchar(cur_wordv[1]) == '"'
&& lastchar(cur_wordv[2]) == ':'
@@ -610,9 +610,9 @@ ri(void)
cur_wordv[1]++; /* skip over the first " */
clob_last(cur_wordv[2], '\0');
language = INRI;
- return (C_TRUE);
+ return C_TRUE;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
}
static Errorclass
@@ -622,7 +622,7 @@ catchall(void)
* Catches random things.
*/
language = INUNKNOWN;
- return (C_NONSPEC);
+ return C_NONSPEC;
} /* end of catch all*/
static Errorclass
@@ -633,7 +633,7 @@ troff(void)
* Just like pcc ccom, except uses `'
*/
if (cur_wordc < 4)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (firstchar(cur_wordv[1]) == '`'
&& lastchar(cur_wordv[1]) == ','
@@ -649,9 +649,9 @@ troff(void)
cur_wordv++; /*compensate*/
currentfilename = cur_wordv[1];
language = INTROFF;
- return (C_TRUE);
+ return C_TRUE;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
}
static Errorclass
@@ -661,7 +661,7 @@ mod2(void)
* for decwrl modula2 compiler (powell)
*/
if (cur_wordc < 5)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if ((strcmp(cur_wordv[1], "!!!") == 0 /* early version */
|| strcmp(cur_wordv[1], "File") == 0) /* later version */
&& lastchar(cur_wordv[2]) == ',' /* file name */
@@ -676,7 +676,7 @@ mod2(void)
cur_wordc -= 2;
currentfilename = cur_wordv[1];
language = INMOD2;
- return (C_TRUE);
+ return C_TRUE;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
}
Index: src/usr.bin/error/pi.c
diff -u src/usr.bin/error/pi.c:1.20 src/usr.bin/error/pi.c:1.21
--- src/usr.bin/error/pi.c:1.20 Mon Apr 4 19:33:46 2022
+++ src/usr.bin/error/pi.c Sat Aug 26 12:43:28 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pi.c,v 1.20 2022/04/04 19:33:46 andvar Exp $ */
+/* $NetBSD: pi.c,v 1.21 2023/08/26 12:43:28 rillig 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.20 2022/04/04 19:33:46 andvar Exp $");
+__RCSID("$NetBSD: pi.c,v 1.21 2023/08/26 12:43:28 rillig Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -189,7 +189,7 @@ alldigits(const char *string)
{
for (; *string && isdigit((unsigned char)*string); string++)
continue;
- return (*string == '\0');
+ return *string == '\0';
}
static boolean
@@ -205,12 +205,11 @@ instringset(const char *member, const ch
static boolean
isdateformat(int wordc, char **wordv)
{
- return (
- (wordc == 5)
- && (instringset(wordv[0], Days))
- && (instringset(wordv[1], Months))
- && (alldigits(wordv[2]))
- && (alldigits(wordv[4])));
+ return wordc == 5
+ && instringset(wordv[0], Days)
+ && instringset(wordv[1], Months)
+ && alldigits(wordv[2])
+ && alldigits(wordv[4]);
}
static boolean
@@ -225,7 +224,7 @@ piptr(const char *string)
string++;
while (*string == '-')
string++;
- return (*string == '\0');
+ return *string == '\0';
}
Errorclass
@@ -235,7 +234,7 @@ pi(void)
nwordv = NULL;
if (cur_wordc < 2)
- return (C_UNKNOWN);
+ return C_UNKNOWN;
if (strlen(cur_wordv[1]) == 1
&& ( cur_wordv[1][0] == 'e' || cur_wordv[1][0] == 'E')
&& piptr(cur_wordv[2])
@@ -279,7 +278,7 @@ pi(void)
}
cur_wordv = nwordv - 1; /* convert to 1 based */
cur_wordc += longpiptr ? 2 : 4;
- return (C_TRUE);
+ return C_TRUE;
}
if (cur_wordc >= 4
&& strlen(cur_wordv[1]) == 1
@@ -300,7 +299,7 @@ pi(void)
c_linenumber = cur_wordv[2];
cur_wordc += 1;
cur_wordv = nwordv - 1;
- return (C_TRUE);
+ return C_TRUE;
}
if (cur_wordc >= 3
&& strlen(cur_wordv[1]) == 1
@@ -352,7 +351,7 @@ pi(void)
}
cur_wordc = undefined ? 4 : 5;
cur_wordv = nwordv - 1;
- return (C_TRUE);
+ return C_TRUE;
}
nwordv = wordvsplice(1+3, cur_wordc, cur_wordv+1);
@@ -362,7 +361,7 @@ pi(void)
nwordv[3] = strdup(c_header[2]);
cur_wordv = nwordv - 1;
cur_wordc += 1 + 3;
- return (C_THISFILE);
+ return C_THISFILE;
}
if (strcmp(cur_wordv[1], "...") == 0 && c_linenumber &&
currentfilename != default_currentfilename) {
@@ -377,7 +376,7 @@ pi(void)
nwordv[1] = strdup(c_linenumber);
cur_wordv = nwordv - 1;
cur_wordc += 1;
- return (C_TRUE);
+ return C_TRUE;
}
if (cur_wordc == 6
&& lastchar(cur_wordv[6]) == ':'
@@ -389,7 +388,7 @@ pi(void)
language = INPI;
currentfilename = strdup(cur_wordv[6]);
clob_last(currentfilename, '\0');
- return (C_SYNC);
+ return C_SYNC;
}
if (cur_wordc == 3
&& strcmp(cur_wordv[1], "In") == 0
@@ -398,7 +397,7 @@ pi(void)
) {
language = INPI;
c_header = wordvsplice(0, cur_wordc, cur_wordv+1);
- return (C_SYNC);
+ return C_SYNC;
}
/*
@@ -407,7 +406,7 @@ pi(void)
if (alldigits(cur_wordv[1])) {
language = INPI;
c_linenumber = cur_wordv[1];
- return (C_IGNORE);
+ return C_IGNORE;
}
/*
@@ -432,11 +431,11 @@ pi(void)
cur_wordc += 2;
cur_wordv = nwordv - 1;
if (!multiple)
- return (C_TRUE);
+ return C_TRUE;
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_TRUE;
}
- return (C_UNKNOWN);
+ return C_UNKNOWN;
}
Index: src/usr.bin/error/subr.c
diff -u src/usr.bin/error/subr.c:1.21 src/usr.bin/error/subr.c:1.22
--- src/usr.bin/error/subr.c:1.21 Sat Aug 26 11:38:14 2023
+++ src/usr.bin/error/subr.c Sat Aug 26 12:43:28 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: subr.c,v 1.21 2023/08/26 11:38:14 rillig Exp $ */
+/* $NetBSD: subr.c,v 1.22 2023/08/26 12:43:28 rillig 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.21 2023/08/26 11:38:14 rillig Exp $");
+__RCSID("$NetBSD: subr.c,v 1.22 2023/08/26 12:43:28 rillig Exp $");
#endif /* not lint */
#include <ctype.h>
@@ -78,7 +78,7 @@ Calloc(size_t nelements, size_t size)
back = calloc(nelements, size);
if (back == NULL)
errx(1, "Ran out of memory.");
- return (back);
+ return back;
}
char *
@@ -105,9 +105,9 @@ position(const char *string, char ch)
if (string)
for (i=1; *string; string++, i++) {
if (*string == ch)
- return (i);
+ return i;
}
- return (-1);
+ return -1;
}
/*
@@ -126,7 +126,7 @@ substitute(char *string, char chold, cha
}
cp++;
}
- return (string);
+ return string;
}
char
@@ -135,21 +135,21 @@ lastchar(const char *string)
size_t length;
if (string == NULL)
- return ('\0');
+ return '\0';
length = strlen(string);
if (length >= 1)
- return (string[length-1]);
+ return string[length-1];
else
- return ('\0');
+ return '\0';
}
char
firstchar(const char *string)
{
if (string)
- return (string[0]);
+ return string[0];
else
- return ('\0');
+ return '\0';
}
char
@@ -158,12 +158,12 @@ next_lastchar(const char *string)
size_t length;
if (string == NULL)
- return ('\0');
+ return '\0';
length = strlen(string);
if (length >= 2)
- return (string[length - 2]);
+ return string[length - 2];
else
- return ('\0');
+ return '\0';
}
void
@@ -359,11 +359,11 @@ wordvcmp(char **wordv1, int wordc, char
for (i = 0; i < wordc; i++) {
if (wordv1[i] == NULL || wordv2[i] == NULL)
- return (-1);
+ return -1;
if ((back = strcmp(wordv1[i], wordv2[i])) != 0)
- return (back);
+ return back;
}
- return (0); /* they are equal */
+ return 0; /* they are equal */
}
/*
@@ -383,7 +383,7 @@ wordvsplice(int emptyhead, int wordc, ch
for (i = emptyhead; i < nwordc; i++) {
nwordv[i] = wordv[i-emptyhead];
}
- return (nwordv);
+ return nwordv;
}
/*
@@ -395,11 +395,11 @@ static const char *N = "";
const char *
plural(int n)
{
- return (n > 1 ? S : N);
+ return n > 1 ? S : N;
}
const char *
verbform(int n)
{
- return (n > 1 ? N : S);
+ return n > 1 ? N : S;
}
Index: src/usr.bin/error/touch.c
diff -u src/usr.bin/error/touch.c:1.29 src/usr.bin/error/touch.c:1.30
--- src/usr.bin/error/touch.c:1.29 Sat Aug 26 11:38:14 2023
+++ src/usr.bin/error/touch.c Sat Aug 26 12:43:28 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: touch.c,v 1.29 2023/08/26 11:38:14 rillig Exp $ */
+/* $NetBSD: touch.c,v 1.30 2023/08/26 12:43:28 rillig 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.29 2023/08/26 11:38:14 rillig Exp $");
+__RCSID("$NetBSD: touch.c,v 1.30 2023/08/26 12:43:28 rillig Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -177,7 +177,7 @@ countfiles(Eptr *errors)
}
}
}
- return (my_nfiles);
+ return my_nfiles;
}
const char *class_table[] = {
@@ -242,7 +242,7 @@ nopertain(Eptr **my_files)
Eptr errorp;
if (my_files[1] - my_files[0] <= 0)
- return (0);
+ return 0;
for (type = C_UNKNOWN; NOTSORTABLE(type); type++) {
if (class_count[type] <= 0)
continue;
@@ -262,7 +262,7 @@ nopertain(Eptr **my_files)
}
}
}
- return (someerrors);
+ return someerrors;
}
@@ -375,7 +375,7 @@ preview(int my_nerrors, Eptr **my_files,
fprintf(stdout, "\n");
}
}
- return (back);
+ return back;
}
static int
@@ -395,7 +395,7 @@ settotouch(const char *name)
case Q_no:
case Q_error:
touchstatus = Q_NO;
- return (dest);
+ return dest;
default:
touchstatus = Q_YES;
break;
@@ -428,7 +428,7 @@ settotouch(const char *name)
dest = edit(name) ? TOSTDOUT : TOTHEFILE;
break;
}
- return (dest);
+ return dest;
}
static void
@@ -480,9 +480,9 @@ oktotouch(const char *filename)
pat = suffixlist;
if (pat == 0)
- return (0);
+ return 0;
if (*pat == '*')
- return (1);
+ return 1;
while (*pat++ != '.')
continue;
--pat; /* point to the period */
@@ -491,7 +491,7 @@ oktotouch(const char *filename)
src > filename && *src != '.'; --src)
continue;
if (*src != '.')
- return (0);
+ return 0;
for (src++, pat++, osrc = src; *src && *pat; src = osrc, pat++) {
for (; *src /* not at end of the source */
@@ -502,15 +502,15 @@ oktotouch(const char *filename)
src++, pat++)
continue;
if (*src == 0 && (*pat == 0 || *pat == '.' || *pat == '*'))
- return (1);
+ return 1;
if (*src != 0 && *pat == '*')
- return (1);
+ return 1;
while (*pat && *pat != '.')
pat++;
if (!*pat)
- return (0);
+ return 0;
}
- return (0);
+ return 0;
}
/*
@@ -697,9 +697,9 @@ mustoverwrite(FILE *preciousfile, FILE *
while ((nread = fread(edbuf, 1, sizeof(edbuf), temp)) != 0) {
if (mustwrite(edbuf, nread, preciousfile) == 0)
- return (0);
+ return 0;
}
- return (1);
+ return 1;
}
/*
@@ -711,10 +711,10 @@ mustwrite(const char *base, size_t n, FI
size_t nwrote;
if (n == 0)
- return (1);
+ return 1;
nwrote = fwrite(base, 1, n, preciousfile);
if (nwrote == n)
- return (1);
+ return 1;
warn("write failed");
switch (inquire(terse
? "Botch overwriting: retry? "
@@ -722,25 +722,25 @@ mustwrite(const char *base, size_t n, FI
case Q_YES:
case Q_yes:
mustwrite(base + nwrote, n - nwrote, preciousfile);
- return (1);
+ return 1;
case Q_NO:
case Q_no:
switch (inquire("Are you sure? ")) {
case Q_error:
case Q_YES:
case Q_yes:
- return (0);
+ return 0;
case Q_NO:
case Q_no:
mustwrite(base + nwrote, n - nwrote, preciousfile);
- return (1);
+ return 1;
default:
abort();
}
/* FALLTHROUGH */
case Q_error:
default:
- return (0);
+ return 0;
}
}
@@ -787,7 +787,7 @@ inquire(const char *fmt, ...)
char buffer[128];
if (queryfile == NULL)
- return (Q_error);
+ return Q_error;
for (;;) {
fflush(stdout);
va_start(ap, fmt);
@@ -795,12 +795,12 @@ inquire(const char *fmt, ...)
va_end(ap);
fflush(stderr);
if (fgets(buffer, 127, queryfile) == NULL)
- return (Q_error);
+ return Q_error;
switch (buffer[0]) {
- case 'Y': return (Q_YES);
- case 'y': return (Q_yes);
- case 'N': return (Q_NO);
- case 'n': return (Q_no);
+ case 'Y': return Q_YES;
+ case 'y': return Q_yes;
+ case 'N': return Q_NO;
+ case 'n': return Q_no;
default: fprintf(stderr, "Yes or No only!\n");
}
}
@@ -812,10 +812,10 @@ probethisfile(const char *name)
struct stat statbuf;
if (stat(name, &statbuf) < 0)
- return (F_NOTEXIST);
+ return F_NOTEXIST;
if ((statbuf.st_mode & S_IREAD) == 0)
- return (F_NOTREAD);
+ return F_NOTREAD;
if ((statbuf.st_mode & S_IWRITE) == 0)
- return (F_NOTWRITE);
- return (F_TOUCHIT);
+ return F_NOTWRITE;
+ return F_TOUCHIT;
}