|
@ -33,7 +33,7 @@ |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" SUCH DAMAGE. |
|
|
.\" SUCH DAMAGE. |
|
|
.\" |
|
|
.\" |
|
|
.\" $OpenBSD: strtok.3,v 1.10 1999/11/09 11:20:13 art Exp $ |
|
|
|
|
|
|
|
|
.\" $OpenBSD: strtok.3,v 1.11 2000/04/21 15:24:20 aaron Exp $ |
|
|
.\" |
|
|
.\" |
|
|
.Dd June 29, 1991 |
|
|
.Dd June 29, 1991 |
|
|
.Dt STRTOK 3 |
|
|
.Dt STRTOK 3 |
|
@ -55,8 +55,7 @@ This interface is obsoleted by |
|
|
.Pp |
|
|
.Pp |
|
|
The |
|
|
The |
|
|
.Fn strtok |
|
|
.Fn strtok |
|
|
function |
|
|
|
|
|
is used to isolate sequential tokens in a null-terminated string, |
|
|
|
|
|
|
|
|
function is used to isolate sequential tokens in a null-terminated string, |
|
|
.Fa str . |
|
|
.Fa str . |
|
|
These tokens are separated in the string by at least one of the |
|
|
These tokens are separated in the string by at least one of the |
|
|
characters in |
|
|
characters in |
|
@ -81,9 +80,8 @@ The |
|
|
.Fn strtok |
|
|
.Fn strtok |
|
|
and |
|
|
and |
|
|
.Fn strtok_r |
|
|
.Fn strtok_r |
|
|
functions |
|
|
|
|
|
return a pointer to the beginning of each subsequent token in the string, |
|
|
|
|
|
after replacing the separator character itself with an |
|
|
|
|
|
|
|
|
functions return a pointer to the beginning of each subsequent token |
|
|
|
|
|
in the string, after replacing the separator character itself with an |
|
|
.Tn ASCII NUL |
|
|
.Tn ASCII NUL |
|
|
character. |
|
|
character. |
|
|
When no more tokens remain, a null pointer is returned. |
|
|
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++) { |
|
|
tokens[i] = '\e0'; |
|
|
tokens[i] = '\e0'; |
|
|
.Ed |
|
|
.Ed |
|
|
.Pp |
|
|
.Pp |
|
|
That is, tokens[0] will point to |
|
|
|
|
|
|
|
|
That is, |
|
|
|
|
|
.Li tokens[0] |
|
|
|
|
|
will point to |
|
|
.Qq cat , |
|
|
.Qq cat , |
|
|
tokens[1] will point to |
|
|
|
|
|
|
|
|
.Li tokens[1] |
|
|
|
|
|
will point to |
|
|
.Qq dog , |
|
|
.Qq dog , |
|
|
tokens[2] will point to |
|
|
|
|
|
|
|
|
.Li tokens[2] |
|
|
|
|
|
will point to |
|
|
.Qq horse , |
|
|
.Qq horse , |
|
|
and tokens[3] will point to |
|
|
|
|
|
|
|
|
and |
|
|
|
|
|
.Li tokens[3] |
|
|
|
|
|
will point to |
|
|
.Qq cow . |
|
|
.Qq cow . |
|
|
.Sh SEE ALSO |
|
|
.Sh SEE ALSO |
|
|
.Xr memchr 3 , |
|
|
.Xr memchr 3 , |
|
@ -136,8 +140,7 @@ and tokens[3] will point to |
|
|
.Sh STANDARDS |
|
|
.Sh STANDARDS |
|
|
The |
|
|
The |
|
|
.Fn strtok |
|
|
.Fn strtok |
|
|
function |
|
|
|
|
|
conforms to |
|
|
|
|
|
|
|
|
function conforms to |
|
|
.St -ansiC . |
|
|
.St -ansiC . |
|
|
.Sh BUGS |
|
|
.Sh BUGS |
|
|
The System V |
|
|
The System V |
|
|