summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/cond.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/make/cond.c')
-rw-r--r--usr.bin/make/cond.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index cec9e1e..c99010d 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
+ * Copyright (c) 1988, 1989 by Adam de Boor
* Copyright (c) 1989 by Berkeley Softworks
* All rights reserved.
*
@@ -96,7 +96,7 @@ typedef enum {
*/
static int CondGetArg __P((char **, char **, char *, Boolean));
static Boolean CondDoDefined __P((int, char *));
-static int CondStrMatch __P((char *, char *));
+static int CondStrMatch __P((ClientData, ClientData));
static Boolean CondDoMake __P((int, char *));
static Boolean CondDoExists __P((int, char *));
static Boolean CondDoTarget __P((int, char *));
@@ -277,14 +277,17 @@ CondDoDefined (argLen, arg)
char *arg;
{
char savec = arg[argLen];
+ char *p1;
Boolean result;
arg[argLen] = '\0';
- if (Var_Value (arg, VAR_CMD) != (char *)NULL) {
+ if (Var_Value (arg, VAR_CMD, &p1) != (char *)NULL) {
result = TRUE;
} else {
result = FALSE;
}
+ if (p1)
+ free(p1);
arg[argLen] = savec;
return (result);
}
@@ -305,10 +308,10 @@ CondDoDefined (argLen, arg)
*/
static int
CondStrMatch(string, pattern)
- char *string;
- char *pattern;
+ ClientData string;
+ ClientData pattern;
{
- return(!Str_Match(string,pattern));
+ return(!Str_Match((char *) string,(char *) pattern));
}
/*-
@@ -532,7 +535,8 @@ CondToken(doEval)
}
condExpr += varSpecLen;
- if (!isspace(*condExpr) && strchr("!=><", *condExpr) == NULL) {
+ if (!isspace((unsigned char) *condExpr) &&
+ strchr("!=><", *condExpr) == NULL) {
Buffer buf;
char *cp;
@@ -544,7 +548,8 @@ CondToken(doEval)
if (doFree)
free(lhs);
- for (;*condExpr && !isspace(*condExpr); condExpr++)
+ for (;*condExpr && !isspace((unsigned char) *condExpr);
+ condExpr++)
Buf_AddByte(buf, (Byte)*condExpr);
Buf_AddByte(buf, (Byte)'\0');
@@ -557,7 +562,7 @@ CondToken(doEval)
/*
* Skip whitespace to get to the operator
*/
- while (isspace(*condExpr))
+ while (isspace((unsigned char) *condExpr))
condExpr++;
/*
@@ -583,7 +588,7 @@ CondToken(doEval)
goto do_compare;
}
- while (isspace(*condExpr)) {
+ while (isspace((unsigned char) *condExpr)) {
condExpr++;
}
if (*condExpr == '\0') {
@@ -703,7 +708,8 @@ do_string_compare:
/*
* Skip over the right-hand side
*/
- while(!isspace(*condExpr) && (*condExpr != '\0')) {
+ while(!isspace((unsigned char) *condExpr) &&
+ (*condExpr != '\0')) {
condExpr++;
}
}
@@ -810,9 +816,8 @@ error:
for (arglen = 0;
condExpr[arglen] != '(' && condExpr[arglen] != '\0';
arglen += 1)
- {
- /* void */ ;
- }
+ continue;
+
if (condExpr[arglen] != '\0') {
val = Var_Parse(&condExpr[arglen - 1], VAR_CMD,
doEval, &length, &doFree);
@@ -824,7 +829,7 @@ error:
* spaces... 4/15/92, christos
*/
char *p;
- for (p = val; *p && isspace(*p); p++)
+ for (p = val; *p && isspace((unsigned char)*p); p++)
continue;
t = (*p == '\0') ? True : False;
}
OpenPOWER on IntegriCloud