From: bernhardheld Date: Wed, 14 May 2003 08:30:35 +0000 (+0000) Subject: device/lib/_strtok.c: fixed bug #734355 by Lenny Story and Tim Woodall X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=d5717f0fe7b4119607ea6dae5305acd6c05ea731;p=fw%2Fsdcc device/lib/_strtok.c: fixed bug #734355 by Lenny Story and Tim Woodall git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2621 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 77bd4c72..74cdb83c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-05-14 Bernhard Held + + * device/lib/_strtok.c: fixed bug #734355 by Lenny Story and Tim Woodall + 2003-05-13 Bernhard Held * src/pic16/*: removed CR from many files, reported by Vangelis Rokas diff --git a/device/lib/_strtok.c b/device/lib/_strtok.c index 82a09c3a..ab260369 100644 --- a/device/lib/_strtok.c +++ b/device/lib/_strtok.c @@ -37,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) { @@ -47,6 +56,12 @@ char * strtok ( } s++ ; } - return (NULL); + + s = NULL; + + if (*s1) + return s1; + else + return NULL; }