(parse_something): try to handle the case of no value specified a
little bit better git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7322 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -83,6 +83,7 @@ parse_something (const char *s, const struct units *units,
|
|||||||
const struct units *u, *partial_unit;
|
const struct units *u, *partial_unit;
|
||||||
size_t u_len;
|
size_t u_len;
|
||||||
unsigned partial;
|
unsigned partial;
|
||||||
|
int no_val_p = 0;
|
||||||
|
|
||||||
while(isspace((unsigned char)*p) || *p == ',')
|
while(isspace((unsigned char)*p) || *p == ',')
|
||||||
++p;
|
++p;
|
||||||
@@ -91,6 +92,7 @@ parse_something (const char *s, const struct units *units,
|
|||||||
if (val == 0 && p == next) {
|
if (val == 0 && p == next) {
|
||||||
if(!accept_no_val_p)
|
if(!accept_no_val_p)
|
||||||
return -1;
|
return -1;
|
||||||
|
no_val_p = 1;
|
||||||
}
|
}
|
||||||
p = next;
|
p = next;
|
||||||
while (isspace((unsigned char)*p))
|
while (isspace((unsigned char)*p))
|
||||||
@@ -107,7 +109,7 @@ parse_something (const char *s, const struct units *units,
|
|||||||
++p;
|
++p;
|
||||||
val = -1;
|
val = -1;
|
||||||
}
|
}
|
||||||
if (val == 0)
|
if (no_val_p && val == 0)
|
||||||
val = 1;
|
val = 1;
|
||||||
u_len = strcspn (p, ", \t");
|
u_len = strcspn (p, ", \t");
|
||||||
partial = 0;
|
partial = 0;
|
||||||
|
Reference in New Issue
Block a user