X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device%2Flib%2F_strtok.c;h=ac4f68c9508fe3833120710c45c47314443ba24f;hb=648829c47ac40329b8e1f096e24e588b6a63a8ea;hp=7f00370a78cd31b4b149cc2cec83fcc2c03f7ad1;hpb=cb7d8a8cab26fa0c173006da313fcc3e0bbb8d33;p=fw%2Fsdcc diff --git a/device/lib/_strtok.c b/device/lib/_strtok.c index 7f00370a..ac4f68c9 100644 --- a/device/lib/_strtok.c +++ b/device/lib/_strtok.c @@ -22,11 +22,10 @@ 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 -#pragma NOINVARIANT +#pragma noinduction +#pragma noinvariant #endif char * strtok ( @@ -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; }