From a17faa3b99e44a4d87b89f92e49870d5f25e0d42 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 7 Nov 1999 11:10:03 +0000 Subject: [PATCH] (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 --- lib/roken/parse_units.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/roken/parse_units.c b/lib/roken/parse_units.c index 6ec18727a..a8b590502 100644 --- a/lib/roken/parse_units.c +++ b/lib/roken/parse_units.c @@ -83,6 +83,7 @@ parse_something (const char *s, const struct units *units, const struct units *u, *partial_unit; size_t u_len; unsigned partial; + int no_val_p = 0; while(isspace((unsigned char)*p) || *p == ',') ++p; @@ -91,6 +92,7 @@ parse_something (const char *s, const struct units *units, if (val == 0 && p == next) { if(!accept_no_val_p) return -1; + no_val_p = 1; } p = next; while (isspace((unsigned char)*p)) @@ -107,7 +109,7 @@ parse_something (const char *s, const struct units *units, ++p; val = -1; } - if (val == 0) + if (no_val_p && val == 0) val = 1; u_len = strcspn (p, ", \t"); partial = 0;