1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Added asctime_r(), ctime_r(), gmtime_r(), localtime_r() and strtok_r().

git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14773 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2004-11-17 19:07:26 +00:00
parent 186887bba5
commit 2d5193371a
8 changed files with 173 additions and 48 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: string_strtok.c,v 1.2 2004-10-25 19:53:15 obarthel Exp $
* $Id: string_strtok.c,v 1.3 2004-11-17 19:07:22 obarthel Exp $
*
* :ts=4
*
@ -44,18 +44,17 @@
/****************************************************************************/
char *
strtok(char *str, const char *separator_set)
strtok_r(char *str, const char *separator_set,char ** state_ptr)
{
static char * last;
char * result = NULL;
char * last;
size_t size;
assert( separator_set != NULL );
assert( separator_set != NULL && state_ptr != NULL );
#if defined(CHECK_FOR_NULL_POINTERS)
{
if(separator_set == NULL)
if(separator_set == NULL || state_ptr == NULL)
{
errno = EFAULT;
goto out;
@ -63,6 +62,8 @@ strtok(char *str, const char *separator_set)
}
#endif /* CHECK_FOR_NULL_POINTERS */
last = (*state_ptr);
/* Did we get called before? Restart at the last valid position. */
if(str == NULL)
{
@ -104,5 +105,25 @@ strtok(char *str, const char *separator_set)
out:
if(state_ptr != NULL)
(*state_ptr) = last;
return(result);
}
/****************************************************************************/
char *
strtok(char *str, const char *separator_set)
{
static char * last;
char * result;
ENTER();
result = strtok_r(str,separator_set,&last);
RETURN(result);
return(result);
}