(parse_something): func is called with val == 0 if no unit was given

(acc_flags, acc_units): update to new standard


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5263 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1998-12-06 18:52:09 +00:00
parent 251c80adc2
commit 617e2be4a3

View File

@@ -89,9 +89,7 @@ parse_something (const char *s, const struct units *units,
val = strtod (p, &next); /* strtol(p, &next, 0); */
if (val == 0 && p == next) {
if(accept_no_val_p)
val = 1;
else
if(!accept_no_val_p)
return -1;
}
p = next;
@@ -104,6 +102,7 @@ parse_something (const char *s, const struct units *units,
break;
} else if (*p == '+') {
++p;
val = 1;
} else if (*p == '-') {
++p;
val = -1;
@@ -150,6 +149,9 @@ parse_something (const char *s, const struct units *units,
static int
acc_units(int res, int val, unsigned mult)
{
if (val == 0)
val = 1;
return res + val * mult;
}
@@ -173,6 +175,8 @@ acc_flags(int res, int val, unsigned mult)
return res | mult;
else if(val == -1)
return res & ~mult;
else if (val == 0)
return mult;
else
return -1;
}