[BACK]Return to strtok_r.c CVS log [TXT][DIR] Up to [local] / ircnowd / src / portab

Annotation of ircnowd/src/portab/strtok_r.c, Revision 1.1.1.1

1.1       tomglok     1: /*
                      2:  * ngIRCd -- The Next Generation IRC Daemon
                      3:  */
                      4:
                      5: #include "portab.h"
                      6:
                      7: /**
                      8:  * @file
                      9:  * Implementation of strtok_r()
                     10:  */
                     11:
                     12: #ifndef HAVE_STRTOK_R
                     13:
                     14: #include <string.h>
                     15:
                     16: char *
                     17: strtok_r(char *str, const char *delim, char **saveptr)
                     18: {
                     19:        char *tmp;
                     20:
                     21:        if (!str)
                     22:                str = *saveptr;
                     23:        str += strspn(str, delim);
                     24:        if (*str == 0)
                     25:                return NULL;
                     26:
                     27:        tmp = str + strcspn(str, delim); /* get end of token */
                     28:        if (*tmp) { /* another delimiter */
                     29:                *tmp = 0;
                     30:                tmp++;
                     31:        }
                     32:        *saveptr = tmp;
                     33:        return str;
                     34: }
                     35:
                     36: #endif

CVSweb