diff options
Diffstat (limited to 'src/lib/libc/string/strtok.3')
-rw-r--r-- | src/lib/libc/string/strtok.3 | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/lib/libc/string/strtok.3 b/src/lib/libc/string/strtok.3 index fa2ec28cf0..143ffc2e42 100644 --- a/src/lib/libc/string/strtok.3 +++ b/src/lib/libc/string/strtok.3 | |||
@@ -33,7 +33,7 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: strtok.3,v 1.10 1999/11/09 11:20:13 art Exp $ | 36 | .\" $OpenBSD: strtok.3,v 1.11 2000/04/21 15:24:20 aaron Exp $ |
37 | .\" | 37 | .\" |
38 | .Dd June 29, 1991 | 38 | .Dd June 29, 1991 |
39 | .Dt STRTOK 3 | 39 | .Dt STRTOK 3 |
@@ -55,8 +55,7 @@ This interface is obsoleted by | |||
55 | .Pp | 55 | .Pp |
56 | The | 56 | The |
57 | .Fn strtok | 57 | .Fn strtok |
58 | function | 58 | function is used to isolate sequential tokens in a null-terminated string, |
59 | is used to isolate sequential tokens in a null-terminated string, | ||
60 | .Fa str . | 59 | .Fa str . |
61 | These tokens are separated in the string by at least one of the | 60 | These tokens are separated in the string by at least one of the |
62 | characters in | 61 | characters in |
@@ -81,9 +80,8 @@ The | |||
81 | .Fn strtok | 80 | .Fn strtok |
82 | and | 81 | and |
83 | .Fn strtok_r | 82 | .Fn strtok_r |
84 | functions | 83 | functions return a pointer to the beginning of each subsequent token |
85 | return a pointer to the beginning of each subsequent token in the string, | 84 | in the string, after replacing the separator character itself with an |
86 | after replacing the separator character itself with an | ||
87 | .Tn ASCII NUL | 85 | .Tn ASCII NUL |
88 | character. | 86 | character. |
89 | When no more tokens remain, a null pointer is returned. | 87 | When no more tokens remain, a null pointer is returned. |
@@ -116,13 +114,19 @@ for ((p = strtok_r(s, " ", &last)); p; (p = strtok_r(NULL, " ", &last)), i++) { | |||
116 | tokens[i] = '\e0'; | 114 | tokens[i] = '\e0'; |
117 | .Ed | 115 | .Ed |
118 | .Pp | 116 | .Pp |
119 | That is, tokens[0] will point to | 117 | That is, |
118 | .Li tokens[0] | ||
119 | will point to | ||
120 | .Qq cat , | 120 | .Qq cat , |
121 | tokens[1] will point to | 121 | .Li tokens[1] |
122 | will point to | ||
122 | .Qq dog , | 123 | .Qq dog , |
123 | tokens[2] will point to | 124 | .Li tokens[2] |
125 | will point to | ||
124 | .Qq horse , | 126 | .Qq horse , |
125 | and tokens[3] will point to | 127 | and |
128 | .Li tokens[3] | ||
129 | will point to | ||
126 | .Qq cow . | 130 | .Qq cow . |
127 | .Sh SEE ALSO | 131 | .Sh SEE ALSO |
128 | .Xr memchr 3 , | 132 | .Xr memchr 3 , |
@@ -136,8 +140,7 @@ and tokens[3] will point to | |||
136 | .Sh STANDARDS | 140 | .Sh STANDARDS |
137 | The | 141 | The |
138 | .Fn strtok | 142 | .Fn strtok |
139 | function | 143 | function conforms to |
140 | conforms to | ||
141 | .St -ansiC . | 144 | .St -ansiC . |
142 | .Sh BUGS | 145 | .Sh BUGS |
143 | The System V | 146 | The System V |