1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-26 07:55:01 +00:00

Handle ".if ${T} > 1 || ${T} < 3" and friends correctly.

Reported-by:	asami
This commit is contained in:
Tim Vanderhoek 1999-05-25 13:45:08 +00:00
parent 8fa3a2e7ed
commit 168de44296
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47494

View File

@ -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.7 1997/02/22 19:27:07 peter 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 @@ CondToken(doEval)
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 @@ CondToken(doEval)
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,7 @@ CondToken(doEval)
condExpr += len;
}
} else {
if (!CondCvtArg(rhs, &right))
if (CondCvtArg(rhs, &right) == rhs)
goto do_string_compare;
if (rhs == condExpr) {
/*