summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2013-11-22 15:47:35 +0000
committerespie <espie@openbsd.org>2013-11-22 15:47:35 +0000
commit56afcde6d46083d59fb47c5abb3f4445f0346431 (patch)
tree94248cc78f737e8398dc716679a0989c1d27b1c0
parentremove unused goo, okay guenther@ (diff)
downloadwireguard-openbsd-56afcde6d46083d59fb47c5abb3f4445f0346431.tar.xz
wireguard-openbsd-56afcde6d46083d59fb47c5abb3f4445f0346431.zip
wrappers for is*/to* that make damn sure their arguments are
cast to unsigned chars. okay deraadt@
-rw-r--r--usr.bin/make/arch.c12
-rw-r--r--usr.bin/make/cond.c32
-rw-r--r--usr.bin/make/defines.h10
-rw-r--r--usr.bin/make/engine.c4
-rw-r--r--usr.bin/make/for.c14
-rw-r--r--usr.bin/make/parse.c54
-rw-r--r--usr.bin/make/parsevar.c10
-rw-r--r--usr.bin/make/str.c4
-rw-r--r--usr.bin/make/suff.c6
-rw-r--r--usr.bin/make/varmodifiers.c8
10 files changed, 81 insertions, 73 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index c564c5c7eea..1addfbabb09 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arch.c,v 1.81 2013/04/23 14:32:53 espie Exp $ */
+/* $OpenBSD: arch.c,v 1.82 2013/11/22 15:47:35 espie Exp $ */
/* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */
/*
@@ -259,10 +259,10 @@ parse_archive(Buffer expand, const char **linePtr, Lst nodeLst, SymTable *ctxt)
* a close paren). */
bool subst_member = false;
- while (isspace(*cp))
+ while (ISSPACE(*cp))
cp++;
member = cp;
- while (*cp != '\0' && *cp != ')' && !isspace(*cp)) {
+ while (*cp != '\0' && *cp != ')' && !ISSPACE(*cp)) {
if (*cp == '$') {
if (!Var_ParseSkip(&cp, ctxt))
return false;
@@ -359,7 +359,7 @@ parse_archive(Buffer expand, const char **linePtr, Lst nodeLst, SymTable *ctxt)
* entrance to the loop, cp is guaranteed to point at a ')') */
do {
cp++;
- } while (isspace(*cp));
+ } while (ISSPACE(*cp));
*linePtr = cp;
return true;
@@ -471,7 +471,7 @@ read_archive(const char *archive, const char *earchive)
/* BSD 4.4 extended AR format: #1/<namelen>, with name
* as the first <namelen> bytes of the file. */
if (memcmp(memberName, AR_EFMT1, sizeof(AR_EFMT1) - 1)
- == 0 && isdigit(memberName[sizeof(AR_EFMT1) - 1])) {
+ == 0 && ISDIGIT(memberName[sizeof(AR_EFMT1) - 1])) {
int elen = atoi(memberName +
sizeof(AR_EFMT1)-1);
@@ -801,7 +801,7 @@ ArchFindMember(
/* BSD 4.4 extended AR format: #1/<namelen>, with name as the
* first <namelen> bytes of the file. */
if (memcmp(memberName, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 &&
- isdigit(memberName[sizeof(AR_EFMT1) - 1])) {
+ ISDIGIT(memberName[sizeof(AR_EFMT1) - 1])) {
char ename[PATH_MAX];
int elength = atoi(memberName + sizeof(AR_EFMT1)-1);
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index c64b1525dd0..f024a6d0c10 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cond.c,v 1.49 2013/04/23 14:32:53 espie Exp $ */
+/* $OpenBSD: cond.c,v 1.50 2013/11/22 15:47:35 espie Exp $ */
/* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */
/*
@@ -207,7 +207,7 @@ CondGetArg(const char **linePtr, struct Name *arg, const char *func,
* work...
*/
if (parens) {
- while (isspace(*cp))
+ while (ISSPACE(*cp))
cp++;
if (*cp == '(')
cp++;
@@ -218,12 +218,12 @@ CondGetArg(const char **linePtr, struct Name *arg, const char *func,
if (*cp == '\0')
return false;
- while (isspace(*cp))
+ while (ISSPACE(*cp))
cp++;
cp = VarName_Get(cp, arg, NULL, true, find_cond);
- while (isspace(*cp))
+ while (ISSPACE(*cp))
cp++;
if (parens) {
if (*cp == ')')
@@ -369,10 +369,10 @@ CondCvtArg(const char *str, double *value)
for (str += 2, i = 0; *str; str++) {
int x;
- if (isdigit(*str))
+ if (ISDIGIT(*str))
x = *str - '0';
- else if (isxdigit(*str))
- x = 10 + *str - (isupper(*str) ? 'A' : 'a');
+ else if (ISXDIGIT(*str))
+ x = 10 + *str - (ISUPPER(*str) ? 'A' : 'a');
else
return false;
i = (i << 4) + x;
@@ -395,7 +395,7 @@ CondHandleNumber(bool doEval)
char *lhs;
end = condExpr;
- while (!isspace(*end) && strchr("!=><", *end) == NULL)
+ while (!ISSPACE(*end) && strchr("!=><", *end) == NULL)
end++;
lhs = Str_dupi(condExpr, end);
condExpr = end;
@@ -418,7 +418,7 @@ CondHandleVarSpec(bool doEval)
return Err;
condExpr += varSpecLen;
- if (!isspace(*condExpr) &&
+ if (!ISSPACE(*condExpr) &&
strchr("!=><", *condExpr) == NULL) {
BUFFER buf;
@@ -429,7 +429,7 @@ CondHandleVarSpec(bool doEval)
if (doFree)
free(lhs);
- for (;*condExpr && !isspace(*condExpr); condExpr++)
+ for (;*condExpr && !ISSPACE(*condExpr); condExpr++)
Buf_AddChar(&buf, *condExpr);
lhs = Var_Subst(Buf_Retrieve(&buf), NULL, doEval);
@@ -471,7 +471,7 @@ CondHandleComparison(char *lhs, bool doFree, bool doEval)
t = Err;
/* Skip whitespace to get to the operator. */
- while (isspace(*condExpr))
+ while (ISSPACE(*condExpr))
condExpr++;
/* Make sure the operator is a valid one. If it isn't a
@@ -494,7 +494,7 @@ CondHandleComparison(char *lhs, bool doFree, bool doEval)
goto do_compare;
}
- while (isspace(*condExpr))
+ while (ISSPACE(*condExpr))
condExpr++;
if (*condExpr == '\0') {
Parse_Error(PARSE_WARNING,
@@ -589,7 +589,7 @@ do_string_compare:
goto do_string_compare;
if (rhs == condExpr) {
/* Skip over the right-hand side. */
- while (!isspace(*condExpr) && *condExpr != '\0')
+ while (!ISSPACE(*condExpr) && *condExpr != '\0')
condExpr++;
}
}
@@ -678,7 +678,7 @@ CondHandleDefault(bool doEval)
/* A variable is empty when it just contains
* spaces... 4/15/92, christos */
char *p;
- for (p = val; isspace(*p); p++)
+ for (p = val; ISSPACE(*p); p++)
continue;
t = *p == '\0' ? True : False;
}
@@ -749,7 +749,7 @@ CondToken(bool doEval)
return t;
}
- while (isspace(*condExpr))
+ while (ISSPACE(*condExpr))
condExpr++;
switch (*condExpr) {
case '(':
@@ -933,7 +933,7 @@ Cond_Eval(const char *line)
level = PARSE_FATAL;
- for (end = line; islower(*end); end++)
+ for (end = line; ISLOWER(*end); end++)
;
/* quick path: recognize special targets early on */
if (*end == '.' || *end == ':')
diff --git a/usr.bin/make/defines.h b/usr.bin/make/defines.h
index b1eb15ddc0d..1ceee99474b 100644
--- a/usr.bin/make/defines.h
+++ b/usr.bin/make/defines.h
@@ -1,7 +1,7 @@
#ifndef DEFINES_H
#define DEFINES_H
-/* $OpenBSD: defines.h,v 1.13 2012/10/09 19:45:34 espie Exp $ */
+/* $OpenBSD: defines.h,v 1.14 2013/11/22 15:47:35 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -110,4 +110,12 @@ extern int debug;
#define DEBUG(module) (debug & CONCAT(DEBUG_,module))
+#define ISLOWER(c) (islower((unsigned char)(c)))
+#define ISUPPER(c) (isupper((unsigned char)(c)))
+#define ISDIGIT(c) (isdigit((unsigned char)(c)))
+#define ISXDIGIT(c) (isxdigit((unsigned char)(c)))
+#define ISSPACE(c) (isspace((unsigned char)(c)))
+#define TOUPPER(c) (toupper((unsigned char)(c)))
+#define TOLOWER(c) (tolower((unsigned char)(c)))
+
#endif
diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c
index c37ef64b2e5..215204504ba 100644
--- a/usr.bin/make/engine.c
+++ b/usr.bin/make/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.46 2013/08/26 14:15:07 naddy Exp $ */
+/* $OpenBSD: engine.c,v 1.47 2013/11/22 15:47:35 espie Exp $ */
/*
* Copyright (c) 2012 Marc Espie.
*
@@ -763,7 +763,7 @@ do_run_command(Job *job)
else
break;
}
- while (isspace(*cmd))
+ while (ISSPACE(*cmd))
cmd++;
/* Print the command before fork if make -n or !silent*/
if ( noExecute || !silent)
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c
index d89e743c358..9613acbfb89 100644
--- a/usr.bin/make/for.c
+++ b/usr.bin/make/for.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: for.c,v 1.44 2013/11/01 17:54:37 espie Exp $ */
+/* $OpenBSD: for.c,v 1.45 2013/11/22 15:47:35 espie Exp $ */
/* $NetBSD: for.c,v 1.4 1996/11/06 17:59:05 christos Exp $ */
/*
@@ -138,7 +138,7 @@ For_Eval(const char *line)
For *arg;
unsigned long n;
- while (isspace(*ptr))
+ while (ISSPACE(*ptr))
ptr++;
/* Parse loop. */
@@ -149,14 +149,14 @@ For_Eval(const char *line)
for (;;) {
/* Grab the variables. */
- for (wrd = ptr; *ptr && !isspace(*ptr); ptr++)
+ for (wrd = ptr; *ptr && !ISSPACE(*ptr); ptr++)
continue;
if (ptr - wrd == 0) {
Parse_Error(PARSE_FATAL, "Syntax error in for");
return 0;
}
endVar = ptr++;
- while (isspace(*ptr))
+ while (ISSPACE(*ptr))
ptr++;
/* End of variable list ? */
if (endVar - wrd == 2 && wrd[0] == 'i' && wrd[1] == 'n')
@@ -214,11 +214,11 @@ For_Accumulate(For *arg, const char *line)
if (*ptr == '.') {
- for (ptr++; isspace(*ptr); ptr++)
+ for (ptr++; ISSPACE(*ptr); ptr++)
continue;
if (strncmp(ptr, "endfor", 6) == 0 &&
- (isspace(ptr[6]) || !ptr[6])) {
+ (ISSPACE(ptr[6]) || !ptr[6])) {
if (DEBUG(FOR))
(void)fprintf(stderr, "For: end for %lu\n",
arg->level);
@@ -227,7 +227,7 @@ For_Accumulate(For *arg, const char *line)
return false;
}
else if (strncmp(ptr, "for", 3) == 0 &&
- isspace(ptr[3])) {
+ ISSPACE(ptr[3])) {
arg->level++;
if (DEBUG(FOR))
(void)fprintf(stderr, "For: new loop %lu\n",
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 10fa726477b..2f8edc7fba1 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.109 2012/11/24 11:06:08 espie Exp $ */
+/* $OpenBSD: parse.c,v 1.110 2013/11/22 15:47:35 espie Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
@@ -566,7 +566,7 @@ found_delimiter(const char *s)
p++;
/* Found the best match already. */
- if (isspace(*p) || *p == '\0')
+ if (ISSPACE(*p) || *p == '\0')
return true;
do {
@@ -574,7 +574,7 @@ found_delimiter(const char *s)
if (*p == '\0')
break;
p++;
- } while (!isspace(*p));
+ } while (!ISSPACE(*p));
/* No better match later on... */
if (*p == '\0')
@@ -589,7 +589,7 @@ parse_do_targets(Lst paths, unsigned int *op, const char *line)
const char *cp;
do {
- for (cp = line; *cp && !isspace(*cp) && *cp != '(';) {
+ for (cp = line; *cp && !ISSPACE(*cp) && *cp != '(';) {
if (*cp == '$')
/* Must be a dynamic source (would have been
* expanded otherwise), so call the Var module
@@ -653,7 +653,7 @@ parse_do_targets(Lst paths, unsigned int *op, const char *line)
if (*line != '\0')
add_target_nodes(line, cp);
- while (isspace(*cp))
+ while (ISSPACE(*cp))
cp++;
line = cp;
} while (*line != '!' && *line != ':' && *line);
@@ -762,7 +762,7 @@ parse_operator(const char **pos)
cp++; /* Advance beyond operator */
/* Get to the first source */
- while (isspace(*cp))
+ while (ISSPACE(*cp))
cp++;
*pos = cp;
return op;
@@ -893,7 +893,7 @@ ParseDoDependency(const char *line) /* the line to parse */
* If it was .NULL, the source is the suffix to use when a
* file has no valid suffix.
*/
- while (*cp && !isspace(*cp))
+ while (*cp && !ISSPACE(*cp))
cp++;
switch (specType) {
case SPECIAL_SUFFIXES:
@@ -913,7 +913,7 @@ ParseDoDependency(const char *line) /* the line to parse */
}
if (*cp != '\0')
cp++;
- while (isspace(*cp))
+ while (ISSPACE(*cp))
cp++;
line = cp;
}
@@ -925,7 +925,7 @@ ParseDoDependency(const char *line) /* the line to parse */
* archive specifications (i.e. things with left
* parentheses in them) and handle them accordingly.
*/
- while (*cp && !isspace(*cp)) {
+ while (*cp && !ISSPACE(*cp)) {
if (*cp == '(' && cp > line && cp[-1] != '$') {
/*
* Only stop for a left parenthesis if
@@ -966,7 +966,7 @@ ParseDoDependency(const char *line) /* the line to parse */
if (*cp)
cp++;
}
- while (isspace(*cp))
+ while (ISSPACE(*cp))
cp++;
line = cp;
}
@@ -1159,7 +1159,7 @@ lookup_bsd_include(const char *file)
bool isSystem;
/* find starting delimiter */
- while (isspace(*file))
+ while (ISSPACE(*file))
file++;
/* determine type of file */
@@ -1195,7 +1195,7 @@ lookup_sysv_style_include(const char *file, const char *directive,
const char *efile;
/* find beginning of name */
- while (isspace(*file))
+ while (ISSPACE(*file))
file++;
if (*file == '\0') {
Parse_Error(PARSE_FATAL, "Filename missing from \"%s\"",
@@ -1203,7 +1203,7 @@ lookup_sysv_style_include(const char *file, const char *directive,
return;
}
/* sys5 delimits file up to next blank character or end of line */
- for (efile = file; *efile != '\0' && !isspace(*efile);)
+ for (efile = file; *efile != '\0' && !ISSPACE(*efile);)
efile++;
handle_include_file(file, efile, true, errIfMissing);
@@ -1243,13 +1243,13 @@ handle_poison(const char *line)
bool paren_to_match = false;
const char *name, *ename;
- while (isspace(*p))
+ while (ISSPACE(*p))
p++;
if (*p == '!') {
not = true;
p++;
}
- while (isspace(*p))
+ while (ISSPACE(*p))
p++;
if (strncmp(p, "defined", 7) == 0) {
type = POISON_DEFINED;
@@ -1258,16 +1258,16 @@ handle_poison(const char *line)
type = POISON_EMPTY;
p += 5;
}
- while (isspace(*p))
+ while (ISSPACE(*p))
p++;
if (*p == '(') {
paren_to_match = true;
p++;
}
- while (isspace(*p))
+ while (ISSPACE(*p))
p++;
name = ename = p;
- while (*p != '\0' && !isspace(*p)) {
+ while (*p != '\0' && !ISSPACE(*p)) {
if (*p == ')' && paren_to_match) {
paren_to_match = false;
p++;
@@ -1276,7 +1276,7 @@ handle_poison(const char *line)
p++;
ename = p;
}
- while (isspace(*p))
+ while (ISSPACE(*p))
p++;
switch(type) {
case POISON_NORMAL:
@@ -1331,9 +1331,9 @@ handle_undef(const char *line)
{
const char *eline;
- while (isspace(*line))
+ while (ISSPACE(*line))
line++;
- for (eline = line; !isspace(*eline) && *eline != '\0';)
+ for (eline = line; !ISSPACE(*eline) && *eline != '\0';)
eline++;
Var_Deletei(line, eline);
return true;
@@ -1345,7 +1345,7 @@ handle_bsd_command(Buffer linebuf, Buffer copy, const char *line)
{
char *stripped;
- while (isspace(*line))
+ while (ISSPACE(*line))
line++;
/* delegate basic classification to the conditional module */
@@ -1355,7 +1355,7 @@ handle_bsd_command(Buffer linebuf, Buffer copy, const char *line)
do {
line = Parse_ReadNextConditionalLine(linebuf);
if (line != NULL) {
- while (isspace(*line))
+ while (ISSPACE(*line))
line++;
stripped = strip_comments(copy, line);
}
@@ -1450,7 +1450,7 @@ parse_as_special_line(Buffer buf, Buffer copy, const char *line)
return true;
if (FEATURES(FEATURE_SYSVINCLUDE) &&
strncmp(line, "include", 7) == 0 &&
- isspace(line[7]) &&
+ ISSPACE(line[7]) &&
strchr(line, ':') == NULL) {
/* It's an S3/S5-style "include". */
lookup_sysv_include(line + 7, "include");
@@ -1458,14 +1458,14 @@ parse_as_special_line(Buffer buf, Buffer copy, const char *line)
}
if (FEATURES(FEATURE_CONDINCLUDE) &&
strncmp(line, "sinclude", 8) == 0 &&
- isspace(line[8]) &&
+ ISSPACE(line[8]) &&
strchr(line, ':') == NULL) {
lookup_conditional_include(line+8, "sinclude");
return true;
}
if (FEATURES(FEATURE_CONDINCLUDE) &&
strncmp(line, "-include", 8) == 0 &&
- isspace(line[8]) &&
+ ISSPACE(line[8]) &&
strchr(line, ':') == NULL) {
lookup_conditional_include(line+8, "-include");
return true;
@@ -1512,7 +1512,7 @@ parse_target_line(struct growableArray *targets, const char *line,
if (cmd != NULL) {
do {
cmd++;
- } while (isspace(*cmd));
+ } while (ISSPACE(*cmd));
if (*cmd != '\0') {
parse_commands(targets, cmd);
*pcommands_seen = true;
diff --git a/usr.bin/make/parsevar.c b/usr.bin/make/parsevar.c
index db0f053a342..5c00622238a 100644
--- a/usr.bin/make/parsevar.c
+++ b/usr.bin/make/parsevar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parsevar.c,v 1.14 2010/07/19 19:46:44 espie Exp $ */
+/* $OpenBSD: parsevar.c,v 1.15 2013/11/22 15:47:35 espie Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
@@ -46,7 +46,7 @@ static const char *
find_op1(const char *p)
{
for(;; p++) {
- if (isspace(*p) || *p == '$' || *p == '\0')
+ if (ISSPACE(*p) || *p == '$' || *p == '\0')
break;
if (p[strspn(p, "?:!+")] == '=')
break;
@@ -60,7 +60,7 @@ static const char *
find_op2(const char *p)
{
for(;; p++) {
- if (isspace(*p) || *p == '$' || *p == '\0')
+ if (ISSPACE(*p) || *p == '$' || *p == '\0')
break;
if (p[strspn(p, "?:!+")] == '=')
break;
@@ -85,7 +85,7 @@ parse_variable_assignment(const char *line, int ctxt)
arg = VarName_Get(line, &name, NULL, true,
FEATURES(FEATURE_SUNSHCMD) ? find_op1 : find_op2);
- while (isspace(*arg))
+ while (ISSPACE(*arg))
arg++;
type = VAR_NORMAL;
@@ -140,7 +140,7 @@ parse_variable_assignment(const char *line, int ctxt)
}
arg++;
- while (isspace(*arg))
+ while (ISSPACE(*arg))
arg++;
/* If the variable already has a value, we don't do anything. */
if ((type & VAR_OPT) && Var_Definedi(name.s, name.e)) {
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c
index 14ef624c611..8aee1e375f2 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: str.c,v 1.27 2010/07/19 19:46:44 espie Exp $ */
+/* $OpenBSD: str.c,v 1.28 2013/11/22 15:47:35 espie Exp $ */
/* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */
/*-
@@ -202,7 +202,7 @@ iterate_words(const char **end)
char state = 0;
start = *end;
- while (isspace(*start))
+ while (ISSPACE(*start))
start++;
if (*start == '\0')
return NULL;
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index cac518e16a7..618c64febb6 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: suff.c,v 1.85 2013/04/23 14:32:53 espie Exp $ */
+/* $OpenBSD: suff.c,v 1.86 2013/11/22 15:47:35 espie Exp $ */
/* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */
/*
@@ -971,13 +971,13 @@ SuffExpandVarChildren(LstNode after, GNode *cgn, GNode *pgn)
for (start = cp; *start == ' ' || *start == '\t'; start++)
continue;
for (cp2 = start; *cp2 != '\0';) {
- if (isspace(*cp2)) {
+ if (ISSPACE(*cp2)) {
/* White-space -- terminate element, find the
* node, add it, skip any further spaces. */
gn = Targ_FindNodei(start, cp2, TARG_CREATE);
cp2++;
Lst_AtEnd(&members, gn);
- while (isspace(*cp2))
+ while (ISSPACE(*cp2))
cp2++;
/* Adjust cp2 for increment at start of loop,
* but set start to first non-space. */
diff --git a/usr.bin/make/varmodifiers.c b/usr.bin/make/varmodifiers.c
index 0d7aef4bc9b..abb73092711 100644
--- a/usr.bin/make/varmodifiers.c
+++ b/usr.bin/make/varmodifiers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: varmodifiers.c,v 1.34 2013/11/12 17:44:03 deraadt Exp $ */
+/* $OpenBSD: varmodifiers.c,v 1.35 2013/11/22 15:47:35 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@@ -867,7 +867,7 @@ VarRESubstitute(struct Name *word, bool addSpace, Buffer buf, void *patternp)
rp++;
}
else if (*rp == '&' ||
- (*rp == '\\' && isdigit(rp[1]))) {
+ (*rp == '\\' && ISDIGIT(rp[1]))) {
int n;
const char *subbuf;
int sublen;
@@ -1173,7 +1173,7 @@ do_upper(const char *s, const struct Name *n UNUSED, void *arg UNUSED)
len = strlen(s);
t = emalloc(len+1);
for (i = 0; i < len; i++)
- t[i] = toupper(s[i]);
+ t[i] = TOUPPER(s[i]);
t[len] = '\0';
return t;
}
@@ -1187,7 +1187,7 @@ do_lower(const char *s, const struct Name *n UNUSED, void *arg UNUSED)
len = strlen(s);
t = emalloc(len+1);
for (i = 0; i < len; i++)
- t[i] = tolower(s[i]);
+ t[i] = TOLOWER(s[i]);
t[len] = '\0';
return t;
}