Changeset 69df837f in mainline
- Timestamp:
- 2008-09-16T10:06:32Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 06a195bc
- Parents:
- eeb2bde2
- Location:
- uspace/lib/libc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/string.c
reeb2bde2 r69df837f 1 1 /* 2 2 * Copyright (c) 2005 Martin Decky 3 * Copyright (C) 1998 by Wes Peters <wes@softweyr.com> 4 * Copyright (c) 1988, 1993 The Regents of the University of California. 3 5 * All rights reserved. 4 6 * … … 397 399 } 398 400 401 /* Ported from FBSD strtok.c 8.1 (Berkeley) 6/4/93 */ 402 char * strtok_r(char *s, const char *delim, char **last) 403 { 404 char *spanp, *tok; 405 int c, sc; 406 407 if (s == NULL && (s = *last) == NULL) 408 return (NULL); 409 410 cont: 411 c = *s++; 412 for (spanp = (char *)delim; (sc = *spanp++) != 0;) { 413 if (c == sc) 414 goto cont; 415 } 416 417 if (c == 0) { /* no non-delimiter characters */ 418 *last = NULL; 419 return (NULL); 420 } 421 422 tok = s - 1; 423 424 for (;;) { 425 c = *s++; 426 spanp = (char *)delim; 427 do { 428 if ((sc = *spanp++) == c) { 429 if (c == 0) 430 s = NULL; 431 else 432 s[-1] = '\0'; 433 *last = s; 434 return (tok); 435 } 436 } while (sc != 0); 437 } 438 } 439 440 /* Ported from FBSD strtok.c 8.1 (Berkeley) 6/4/93 */ 441 char * strtok(char *s, const char *delim) 442 { 443 static char *last; 444 445 return (strtok_r(s, delim, &last)); 446 } 447 399 448 /** @} 400 449 */ -
uspace/lib/libc/include/string.h
reeb2bde2 r69df837f 65 65 extern unsigned long strtoul(const char *, char **, int); 66 66 67 extern char * strtok_r(char *, const char *, char **); 68 extern char * strtok(char *, const char *); 69 67 70 #endif 68 71
Note:
See TracChangeset
for help on using the changeset viewer.