diff options
| author | Tim Vanderhoek <hoek@FreeBSD.org> | 1999-08-17 07:34:09 +0000 |
|---|---|---|
| committer | Tim Vanderhoek <hoek@FreeBSD.org> | 1999-08-17 07:34:09 +0000 |
| commit | eb89c07d1086093dccf5a448899b89bf208b675d (patch) | |
| tree | d70808f31957854152131c435eabc111413d442d /usr.bin/make | |
| parent | 2a4cdc4e4c9e0fbe954710c5c5b846c9548d7e8e (diff) | |
Notes
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/cond.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index d5c1fc2dc6ca..3476a8b6d012 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -35,7 +35,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: cond.c,v 1.9 1999/08/12 13:30:08 hoek Exp $ */ #ifndef lint @@ -103,7 +103,7 @@ static int CondStrMatch __P((ClientData, ClientData)); static Boolean CondDoMake __P((int, char *)); static Boolean CondDoExists __P((int, char *)); static Boolean CondDoTarget __P((int, char *)); -static Boolean CondCvtArg __P((char *, double *)); +static char * CondCvtArg __P((char *, double *)); static Token CondToken __P((Boolean)); static Token CondT __P((Boolean)); static Token CondF __P((Boolean)); @@ -427,7 +427,8 @@ CondDoTarget (argLen, arg) * * Results: * Sets 'value' to double value of string. - * Returns true if the string was a valid number, false o.w. + * Returns address of the first character after the last valid + * character of the converted number. * * Side Effects: * Can change 'value' even if string is not a valid number. @@ -435,7 +436,7 @@ CondDoTarget (argLen, arg) * *----------------------------------------------------------------------- */ -static Boolean +static char * CondCvtArg(str, value) register char *str; double *value; @@ -443,23 +444,23 @@ CondCvtArg(str, value) if ((*str == '0') && (str[1] == 'x')) { register long i; - for (str += 2, i = 0; *str; str++) { + for (str += 2, i = 0; ; str++) { int x; if (isdigit((unsigned char) *str)) x = *str - '0'; else if (isxdigit((unsigned char) *str)) x = 10 + *str - isupper((unsigned char) *str) ? 'A' : 'a'; - else - return FALSE; + else { + *value = (double) i; + return str; + } i = (i << 4) + x; } - *value = (double) i; - return TRUE; } else { char *eptr; *value = strtod(str, &eptr); - return *eptr == '\0'; + return eptr; } } @@ -685,7 +686,7 @@ do_string_compare: double left, right; char *string; - if (!CondCvtArg(lhs, &left)) + if (*CondCvtArg(lhs, &left) != '\0') goto do_string_compare; if (*rhs == '$') { int len; @@ -695,7 +696,7 @@ do_string_compare: if (string == var_Error) { right = 0.0; } else { - if (!CondCvtArg(string, &right)) { + if (*CondCvtArg(string, &right) != '\0') { if (freeIt) free(string); goto do_string_compare; @@ -706,7 +707,8 @@ do_string_compare: condExpr += len; } } else { - if (!CondCvtArg(rhs, &right)) + char *c = CondCvtArg(rhs, &right); + if (*c != '\0' && !isspace(*c)) goto do_string_compare; if (rhs == condExpr) { /* |
