diff options
author | saurabhb17 | 2020-02-26 16:20:48 +0530 |
---|---|---|
committer | GitHub | 2020-02-26 16:20:48 +0530 |
commit | b77f5d9d8097c38159c6f60917995d6af13bbe1c (patch) | |
tree | 1392c90227aeea231c1d86371131e04c40382918 /common/strtok_r.c | |
parent | dadc4d490966a24efe15b5cc533ef8695986048a (diff) | |
parent | 003d02608917e7a69d1a98438837e94ccf68352a (diff) | |
download | KiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.tar.gz KiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.tar.bz2 KiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.zip |
Merge pull request #4 from FOSSEE/develop
merging dev into master
Diffstat (limited to 'common/strtok_r.c')
-rw-r--r-- | common/strtok_r.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/common/strtok_r.c b/common/strtok_r.c new file mode 100644 index 0000000..a0b0997 --- /dev/null +++ b/common/strtok_r.c @@ -0,0 +1,35 @@ +/* + * public domain strtok_r() + */ + +#include <string.h> + +char* strtok_r( char* str, const char* delim, char** nextp ) +{ + char* ret; + + if( str == NULL ) + { + str = *nextp; + } + + str += strspn( str, delim ); + + if( *str == '\0' ) + { + return NULL; + } + + ret = str; + + str += strcspn( str, delim ); + + if( *str ) + { + *str++ = '\0'; + } + + *nextp = str; + + return ret; +} |