Mercurial > ecos
diff packages/redboot/current/src/parse.c @ 198:ea3f0bd33a73
Merge from eCos master repository on 2001-12-07-11:40:47-GMT
| author | jlarmour |
|---|---|
| date | Fri, 07 Dec 2001 14:15:03 +0000 |
| parents | 9160a8005d76 |
| children | e0c0827131d1 |
line wrap: on
line diff
--- a/packages/redboot/current/src/parse.c +++ b/packages/redboot/current/src/parse.c @@ -367,9 +367,23 @@ parse_bool(char *s, bool *val) { while (*s == ' ') s++; if ((*s == 't') || (*s == 'T')) { + char *p = "rue"; + char *P = "RUE"; + // check for (partial) rest of the word and no extra including the + // terminating zero. "tru" will match; "truef" will not. + while ( *++s ) { + if ( *p != *s && *P != *s ) return false; + p++; P++; + } *val = true; } else if ((*s == 'f') || (*s == 'F')) { + char *p = "alse"; + char *P = "ALSE"; + while ( *++s ) { + if ( *p != *s && *P != *s ) return false; + p++; P++; + } *val = false; } else { return false;
