Changeset 36907
- Timestamp:
- Jun 18, 2014, 9:43:39 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140610/Ohana/src/libohana
- Files:
-
- 2 edited
-
include/ohana.h (modified) (1 diff)
-
src/string.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140610/Ohana/src/libohana/include/ohana.h
r35754 r36907 267 267 char *strsubs PROTO((char *string, char *match, char *with)); 268 268 269 char *getword PROTO((char *string)); 270 char *skipword PROTO((char *string)); 271 269 272 /* in findexec.c */ 270 273 char *pathname PROTO((char *name)); -
branches/eam_branches/ipp-20140610/Ohana/src/libohana/src/string.c
r34753 r36907 402 402 return (q); 403 403 } 404 405 // return a newly allocated string containing the first complete set of non-whitespace 406 char *getword (char *string) { 407 408 int i, j; 409 char *word; 410 411 if (!string) return (NULL); 412 413 // find the end of the whitespace (is there any non-whitespace?) 414 for (i = 0; OHANA_WHITESPACE (string[i]); i++); 415 if (!string[i]) return (NULL); 416 417 for (j = i; string[j] && !OHANA_WHITESPACE(string[j]); j++); 418 word = strncreate (&string[i], j - i); 419 return (word); 420 } 421 422 // returns a pointer to the next word, or NULL if there is not a next word 423 char *skipword (char *string) { 424 425 int i; 426 427 if (!string) return (NULL); 428 429 // find the end of the whitespace (is there any non-whitespace?) 430 for (i = 0; OHANA_WHITESPACE (string[i]); i++); 431 if (!string[i]) return (NULL); 432 433 // find the end of the non-whitespace (this word) 434 while (string[i] && !OHANA_WHITESPACE(string[i])) i++; 435 436 // find the end of the following whitespace 437 while (string[i] && OHANA_WHITESPACE(string[i])) i++; 438 if (!string[i]) return (NULL); 439 440 return (&string[i]); 441 } 442
Note:
See TracChangeset
for help on using the changeset viewer.
