Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Guardian Native C Library Calls (s) strtok_r(3)
NAME
strtok_r - Splits string into tokens (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
32-bit H-series and J-series OSS processes that do not use Standard POSIX Threads:
/G/system/zdllnnn/zcredll
64-bit H-series and J-series OSS processes that do not use Standard POSIX Threads:
/G/system/zdllnnn/ycredll
H-series and J-series OSS processes that use the Standard POSIX Threads library:
/G/system/zdllnnn/zsptdll
SYNOPSIS
#include <string.h> | #include <spthread.h>
/* string.h is required for H-series and J-series processes that do not use */
/* the Standard POSIX Threads library */
/* spthread.h is required for G-series native OSS processes, and for H-series */
/* and J-series OSS processes that use the Standard POSIX Threads library */
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() function to continue
scanning the same string.
DESCRIPTION
The strtok_r() function is the reentrant version of the strtok() function.
The strtok_r() function 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 first call to strtok_r() function, 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. The
strtok_r() function returns a pointer to the first character of the first token, writes a null charac-
ter 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.
NOTES
On systems running H06.21 or later H-series RVUs or J06.10 or later J-series RVUs, you can use
either the POSIX User Thread Model library or the Standard POSIX Threads library for threaded
applications.
If you are NOT using the Standard POSIX Threads library (this is not a threaded application or
you are using the POSIX User Thread Model library), you must:
527192-018 Hewlett-Packard Company 6−131