OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [string/] [strtok.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/*
2
FUNCTION
3
        <<strtok>>---get next token from a string
4
 
5
INDEX
6
        strtok
7
 
8
INDEX
9
        strtok_r
10
 
11
ANSI_SYNOPSIS
12
        #include <string.h>
13
        char *strtok(char *<[source]>, const char *<[delimiters]>)
14
        char *strtok_r(char *<[source]>, const char *<[delimiters]>,
15
                        char **<[lasts]>)
16
 
17
TRAD_SYNOPSIS
18
        #include <string.h>
19
        char *strtok(<[source]>, <[delimiters]>)
20
        char *<[source]>;
21
        char *<[delimiters]>;
22
 
23
        char *strtok_r(<[source]>, <[delimiters]>, <[lasts]>)
24
        char *<[source]>;
25
        char *<[delimiters]>;
26
        char **<[lasts]>;
27
 
28
DESCRIPTION
29
        The <<strtok>> function is used to isolate sequential tokens in a
30
        null-terminated string, <<*<[source]>>>. These tokens are delimited
31
        in the string by at least one of the characters in <<*<[delimiters]>>>.
32
        The first time that <<strtok>> is called, <<*<[source]>>> should be
33
        specified; subsequent calls, wishing to obtain further tokens from
34
        the same string, should pass a null pointer instead.  The separator
35
        string, <<*<[delimiters]>>>, must be supplied each time, and may
36
        change between calls.
37
 
38
        The <<strtok>> function returns a pointer to the beginning of each
39
        subsequent token in the string, after replacing the separator
40
        character itself with a NUL character.  When no more tokens remain,
41
        a null pointer is returned.
42
 
43
        The <<strtok_r>> function has the same behavior as <<strtok>>, except
44
        a pointer to placeholder <<*[lasts]>> must be supplied by the caller.
45
 
46
RETURNS
47
        <<strtok>> returns a pointer to the next token, or <<NULL>> if
48
        no more tokens can be found.
49
 
50
NOTES
51
        <<strtok>> is unsafe for multi-thread applications.  <<strtok_r>>
52
        is MT-Safe and should be used instead.
53
 
54
PORTABILITY
55
<<strtok>> is ANSI C.
56
 
57
<<strtok>> requires no supporting OS subroutines.
58
 
59
QUICKREF
60
        strtok ansi impure
61
*/
62
 
63
#include <string.h>
64
#include <_ansi.h>
65 56 joel
#include <reent.h>
66 39 lampret
 
67
#ifndef _REENT_ONLY
68
 
69
char *
70
_DEFUN (strtok, (s, delim),
71
        register char *s _AND
72
        register const char *delim)
73
{
74 56 joel
        return strtok_r (s, delim, &(_REENT->_new._reent._strtok_last));
75 39 lampret
}
76
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.