X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device%2Flib%2F_strtok.c;h=ab2603698e58f86d45c80d113831ad53d1dcd1d3;hb=f3ebd71273aef1ddc517e0a23875378dc09ab6af;hp=7f00370a78cd31b4b149cc2cec83fcc2c03f7ad1;hpb=cb7d8a8cab26fa0c173006da313fcc3e0bbb8d33;p=fw%2Fsdcc diff --git a/device/lib/_strtok.c b/device/lib/_strtok.c index 7f00370a..ab260369 100644 --- a/device/lib/_strtok.c +++ b/device/lib/_strtok.c @@ -22,7 +22,6 @@ what you give them. Help stamp out software-hoarding! -------------------------------------------------------------------------*/ #include "string.h" -#define NULL (void *)0 #if defined(SDCC_MODEL_LARGE) || defined (SDCC_MODEL_FLAT24) #pragma NOINDUCTION @@ -38,7 +37,16 @@ char * strtok ( if ( str ) s = str ; + if ( !s ) + return NULL; + while (*s) { + if (strchr(control,*s)) + s++; + else + break; + } + s1 = s ; while (*s) { @@ -48,6 +56,12 @@ char * strtok ( } s++ ; } - return (NULL); + + s = NULL; + + if (*s1) + return s1; + else + return NULL; }