Rev 3343 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3343 | Rev 3492 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | * Copyright (c) 2005 Martin Decky |
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 | * All rights reserved. |
5 | * All rights reserved. |
4 | * |
6 | * |
5 | * Redistribution and use in source and binary forms, with or without |
7 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
8 | * modification, are permitted provided that the following conditions |
7 | * are met: |
9 | * are met: |
Line 394... | Line 396... | ||
394 | return (char *) NULL; |
396 | return (char *) NULL; |
395 | 397 | ||
396 | return (char *) memcpy(ret, s1, len); |
398 | return (char *) memcpy(ret, s1, len); |
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 | */ |