Nut/OS  4.10.3
API Reference
Miscellaneous Functions

Complementary runtime support. More...

Collaboration diagram for Miscellaneous Functions:


char * strsep_rs (char **pp_str, CONST char *p_delim, char *p_sep)
 Thread safe variant of strsep.
char * strsep_r (char **pp_str, CONST char *p_delim)
 Thread safe version of strsep.

Detailed Description

Complementary runtime support.

The functions strtok_r(), strsep_r() and strsep_rs() are intended as a replacement for the strtok() function. While the strtok() function should be preferred for portability reasons (it conforms to ISO/IEC 9899:1990 ("ISO C89")) it may not be able to be used in a multi-threaded environment (that is it is not reentrant). Functions strsep_r() and strsep_rs() can handle empty fields, (i.e. detect fields delimited by two adjacent delimiter characters). Function strsep() first appeared in 4.4BSD.

Function Documentation

char* strsep_rs ( char **  pp_str,
CONST char *  p_delim,
char *  p_sep 

Thread safe variant of strsep.

This function is identical in operation to strsep_r(), except it returns the deliminating character.

Definition at line 112 of file strtok_r.c.

Referenced by strsep_r().

char* strsep_r ( char **  pp_str,
CONST char *  p_delim 

Thread safe version of strsep.

This function locates, in the string referenced by *str, the first occurrence of any character in the string delim (or the terminating `\0' character) and replaces it with a `\0'. The location of the next character after the delimiter character (or NULL, if the end of the string was reached) is stored in *str. The original value of *str is returned.

An "empty" field, i.e. one caused by two adjacent delimiter characters, can be detected by comparing the location referenced by the pointer returned in *str to `\0'.

If *str is initially NULL, strsep_r() returns NULL.

If delim is NULL or the empty string, strsep_r() returns *str.

Definition at line 160 of file strtok_r.c.

References strsep_rs().

Here is the call graph for this function: