Mercurial > flash_v2
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 197:51b34619b677 | 198:ea3f0bd33a73 |
|---|---|
| 365 bool | 365 bool |
| 366 parse_bool(char *s, bool *val) | 366 parse_bool(char *s, bool *val) |
| 367 { | 367 { |
| 368 while (*s == ' ') s++; | 368 while (*s == ' ') s++; |
| 369 if ((*s == 't') || (*s == 'T')) { | 369 if ((*s == 't') || (*s == 'T')) { |
| 370 char *p = "rue"; | |
| 371 char *P = "RUE"; | |
| 372 // check for (partial) rest of the word and no extra including the | |
| 373 // terminating zero. "tru" will match; "truef" will not. | |
| 374 while ( *++s ) { | |
| 375 if ( *p != *s && *P != *s ) return false; | |
| 376 p++; P++; | |
| 377 } | |
| 370 *val = true; | 378 *val = true; |
| 371 } else | 379 } else |
| 372 if ((*s == 'f') || (*s == 'F')) { | 380 if ((*s == 'f') || (*s == 'F')) { |
| 381 char *p = "alse"; | |
| 382 char *P = "ALSE"; | |
| 383 while ( *++s ) { | |
| 384 if ( *p != *s && *P != *s ) return false; | |
| 385 p++; P++; | |
| 386 } | |
| 373 *val = false; | 387 *val = false; |
| 374 } else { | 388 } else { |
| 375 return false; | 389 return false; |
| 376 } | 390 } |
| 377 return true; | 391 return true; |
