Open System Services System Calls Reference Manual (G06.28+)

strtok_r(2) OSS System Calls Reference Manual
NAME
strtok_r - Splits string into tokens (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
char *strtok_r (
char *s,
const char *sep,
char **lasts
);
PARAMETERS
s Contains a pointer to the string to be searched.
sep Contains a pointer to the string of byte token delimiters.
lasts Contains stored information necessary for the strtok_r() func-
tion to continue scanning the same string.
DESCRIPTION
The strtok_r() function is the reentrant version of the strtok() function.
strtok_r() considers the null-terminated string s as a sequence of zero or more text tokens
separated by spans of one or more characters from the separator string sep. The value of the lasts
parameter points to a user-provided pointer that points to stored information necessary for
strtok_r() to continue scanning the same string.
In the rst call to strtok_r(), s points to a null-terminated string, sep to a null-terminated string
of separator characters, and the value pointed to by lasts is ignored. strtok_r() returns a pointer
to the rst character of the rst token, writes a null character into s immediately following the
returned token, and updates the pointer to which lasts points.
In subsequent calls, s is a null pointer and lasts is unchanged from the previous call so that subse-
quent calls move through the string s, returning successive tokens until no tokens remain. The
separator string sep can be different from call to call. When no token remains in s, a null pointer
is returned.
RETURN VALUES
Upon successful completion, the strtok_r() function returns a pointer to the rst byte of the
parsed token in the string. When there is no token in the string, a null pointer is returned.
ERRORS
No error values are returned. This function does not set the errno variable.
RELATED INFORMATION
Functions: strcat(3), strtok(3).
STANDARDS CONFORMANCE
This function is an extension to the UNIX98 specication. Interfaces documented on this refer-
ence page conform to the following industry standards:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
7388 Hewlett-Packard Company 527186-005