2011-03-28 22:52:17 +08:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
<<strchrnul>>---search for character in string
|
|
|
|
|
|
|
|
INDEX
|
|
|
|
strchrnul
|
|
|
|
|
2017-11-30 16:20:06 +08:00
|
|
|
SYNOPSIS
|
2011-03-28 22:52:17 +08:00
|
|
|
#include <string.h>
|
|
|
|
char * strchrnul(const char *<[string]>, int <[c]>);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
This function finds the first occurence of <[c]> (converted to
|
|
|
|
a char) in the string pointed to by <[string]> (including the
|
|
|
|
terminating null character).
|
|
|
|
|
|
|
|
RETURNS
|
|
|
|
Returns a pointer to the located character, or a pointer
|
|
|
|
to the concluding null byte if <[c]> does not occur in <[string]>.
|
|
|
|
|
|
|
|
PORTABILITY
|
|
|
|
<<strchrnul>> is a GNU extension.
|
|
|
|
|
|
|
|
<<strchrnul>> requires no supporting OS subroutines. It uses
|
|
|
|
strchr() and strlen() from elsewhere in this library.
|
|
|
|
|
|
|
|
QUICKREF
|
|
|
|
strchrnul
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
char *
|
2017-12-04 11:43:30 +08:00
|
|
|
strchrnul (const char *s1,
|
2011-03-28 22:52:17 +08:00
|
|
|
int i)
|
|
|
|
{
|
|
|
|
char *s = strchr(s1, i);
|
|
|
|
|
2011-04-16 04:26:05 +08:00
|
|
|
return s ? s : (char *)s1 + strlen(s1);
|
2011-03-28 22:52:17 +08:00
|
|
|
}
|