From 034f6378da4e548efbbb13e65e4a734198dc09e6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 29 May 2001 19:17:03 +0000 Subject: Added strtok.[ch] --- lib/strtok.c | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 lib/strtok.c (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c new file mode 100644 index 000000000..1c1c1d787 --- /dev/null +++ b/lib/strtok.c @@ -0,0 +1,137 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2000, Daniel Stenberg, , et al. + * + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + *****************************************************************************/ + + +#include "setup.h" + +#ifndef HAVE_STRTOK_R + +/* + * Copyright (c) 1998 Softweyr LLC. All rights reserved. + * + * strtok_r, from Berkeley strtok + * Oct 13, 1998 by Wes Peters + * + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notices, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notices, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * + * This product includes software developed by Softweyr LLC, the + * University of California, Berkeley, and its contributors. + * + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE + * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +char * +curl_strtok_r(char *s, const char *delim, char **last) +{ + char *spanp; + int c, sc; + char *tok; + + if (s == NULL && (s = *last) == NULL) + { + return NULL; + } + + /* + * Skip (span) leading delimiters (s += strspn(s, delim), sort of). + */ +cont: + c = *s++; + for (spanp = (char *)delim; (sc = *spanp++) != 0; ) + { + if (c == sc) + { + goto cont; + } + } + + if (c == 0) /* no non-delimiter characters */ + { + *last = NULL; + return NULL; + } + tok = s - 1; + + /* + * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). + * Note that delim must have one NUL; we stop if we see that, too. + */ + for (;;) + { + c = *s++; + spanp = (char *)delim; + do + { + if ((sc = *spanp++) == c) + { + if (c == 0) + { + s = NULL; + } + else + { + char *w = s - 1; + *w = '\0'; + } + *last = s; + return tok; + } + } + while (sc != 0); + } + /* NOTREACHED */ +} + +#endif + -- cgit v1.2.1 From 88d536eb3bff00ca5de59ce91cf3b014b0dff36c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 29 May 2001 19:20:21 +0000 Subject: re-indented to follow "project curl"-style, renamed curl_ prefix to Curl_ --- lib/strtok.c | 97 +++++++++++++++++++++++++++--------------------------------- 1 file changed, 44 insertions(+), 53 deletions(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 1c1c1d787..8c765d425 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -72,65 +72,56 @@ #include char * -curl_strtok_r(char *s, const char *delim, char **last) +Curl_strtok_r(char *s, const char *delim, char **last) { - char *spanp; - int c, sc; - char *tok; + char *spanp; + int c, sc; + char *tok; - if (s == NULL && (s = *last) == NULL) - { - return NULL; - } + if (s == NULL && (s = *last) == NULL) { + return NULL; + } - /* - * Skip (span) leading delimiters (s += strspn(s, delim), sort of). - */ -cont: - c = *s++; - for (spanp = (char *)delim; (sc = *spanp++) != 0; ) - { - if (c == sc) - { - goto cont; - } + /* + * Skip (span) leading delimiters (s += strspn(s, delim), sort of). + */ + cont: + c = *s++; + for (spanp = (char *)delim; (sc = *spanp++) != 0; ) { + if (c == sc) { + goto cont; } + } - if (c == 0) /* no non-delimiter characters */ - { - *last = NULL; - return NULL; - } - tok = s - 1; - - /* - * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). - * Note that delim must have one NUL; we stop if we see that, too. - */ - for (;;) - { - c = *s++; - spanp = (char *)delim; - do - { - if ((sc = *spanp++) == c) - { - if (c == 0) - { - s = NULL; - } - else - { - char *w = s - 1; - *w = '\0'; - } - *last = s; - return tok; - } - } - while (sc != 0); + if (c == 0) { /* no non-delimiter characters */ + *last = NULL; + return NULL; + } + tok = s - 1; + + /* + * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). + * Note that delim must have one NUL; we stop if we see that, too. + */ + for (;;) { + c = *s++; + spanp = (char *)delim; + do { + if ((sc = *spanp++) == c) { + if (c == 0) { + s = NULL; + } + else { + char *w = s - 1; + *w = '\0'; + } + *last = s; + return tok; + } } - /* NOTREACHED */ + while (sc != 0); + } + /* NOTREACHED */ } #endif -- cgit v1.2.1 From 56f6815d3d2e9d4b2823f64825fc0bbf4aa96379 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 24 Aug 2001 10:25:02 +0000 Subject: rewrite to work around BSD announcement license issues, this is also somewhat easier to understand if I may say so. It is slightly slower. --- lib/strtok.c | 120 +++++++++++++++-------------------------------------------- 1 file changed, 29 insertions(+), 91 deletions(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 8c765d425..901042430 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2000, Daniel Stenberg, , et al. + * Copyright (C) 2001, Daniel Stenberg, , et al. * * In order to be useful for every potential user, curl and libcurl are * dual-licensed under the MPL and the MIT/X-derivate licenses. @@ -21,108 +21,46 @@ * $Id$ *****************************************************************************/ - #include "setup.h" #ifndef HAVE_STRTOK_R - -/* - * Copyright (c) 1998 Softweyr LLC. All rights reserved. - * - * strtok_r, from Berkeley strtok - * Oct 13, 1998 by Wes Peters - * - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notices, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notices, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by Softweyr LLC, the - * University of California, Berkeley, and its contributors. - * - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE - * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include char * -Curl_strtok_r(char *s, const char *delim, char **last) +Curl_strtok_r(char *ptr, const char *sep, char **end) { - char *spanp; - int c, sc; - char *tok; + if (!ptr) + /* we got NULL input so then we get our last position instead */ + ptr = *end; - if (s == NULL && (s = *last) == NULL) { - return NULL; - } + /* pass all letters that are including in the separator string */ + while (*ptr && strchr(sep, *ptr)) + ++ptr; - /* - * Skip (span) leading delimiters (s += strspn(s, delim), sort of). - */ - cont: - c = *s++; - for (spanp = (char *)delim; (sc = *spanp++) != 0; ) { - if (c == sc) { - goto cont; - } - } + if (*ptr) { + /* so this is where the next piece of string starts */ + char *start = ptr; - if (c == 0) { /* no non-delimiter characters */ - *last = NULL; - return NULL; - } - tok = s - 1; - - /* - * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). - * Note that delim must have one NUL; we stop if we see that, too. - */ - for (;;) { - c = *s++; - spanp = (char *)delim; - do { - if ((sc = *spanp++) == c) { - if (c == 0) { - s = NULL; - } - else { - char *w = s - 1; - *w = '\0'; - } - *last = s; - return tok; - } + /* set the end pointer to the first byte after the start */ + *end = ptr + 1; + + /* scan through the string to find where it ends, it ends on a + null byte or a character that exists in the separator string */ + while (**end && !strchr(sep, **end)) + ++*end; + + if (**end) { + /* the end is not a null byte */ + **end = '\0';, /* zero terminate it! */ + ++*end; /* advance the last pointer to beyond the null byte */ } - while (sc != 0); + + return start; /* return the position where the string starts */ } - /* NOTREACHED */ + + /* we ended up on a null byte, there are no more strings to find! */ + return NULL; } -#endif +#endif /* this was only compiled if strtok_r wasn't present */ -- cgit v1.2.1 From 8d52681e1d373ce66db3db3000394a2916351b63 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 26 Aug 2001 14:27:07 +0000 Subject: Added #include and removed a silly mistakenly added , --- lib/strtok.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 901042430..bb740037d 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -25,6 +25,7 @@ #ifndef HAVE_STRTOK_R #include +#include char * Curl_strtok_r(char *ptr, const char *sep, char **end) @@ -51,7 +52,7 @@ Curl_strtok_r(char *ptr, const char *sep, char **end) if (**end) { /* the end is not a null byte */ - **end = '\0';, /* zero terminate it! */ + **end = '\0'; /* zero terminate it! */ ++*end; /* advance the last pointer to beyond the null byte */ } -- cgit v1.2.1 From 321ba15a82df0dba12b8f21fa60025c02e3bb998 Mon Sep 17 00:00:00 2001 From: Sterling Hughes Date: Sun, 26 Aug 2001 20:51:16 +0000 Subject: we should be using start here. --- lib/strtok.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index bb740037d..a1525df02 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -43,7 +43,7 @@ Curl_strtok_r(char *ptr, const char *sep, char **end) char *start = ptr; /* set the end pointer to the first byte after the start */ - *end = ptr + 1; + *end = start + 1; /* scan through the string to find where it ends, it ends on a null byte or a character that exists in the separator string */ -- cgit v1.2.1 From 6147879837a53d22c9be04e7a4fc315a297ba2b3 Mon Sep 17 00:00:00 2001 From: Sterling Hughes Date: Fri, 7 Sep 2001 04:01:32 +0000 Subject: Added formatting sections for emacs and vim --- lib/strtok.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index a1525df02..b80bdb138 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -65,3 +65,10 @@ Curl_strtok_r(char *ptr, const char *sep, char **end) #endif /* this was only compiled if strtok_r wasn't present */ +/* + * local variables: + * eval: (load-file "../curl-mode.el") + * end: + * vim600: et sw=2 ts=2 sts=2 tw=78 fdm=marker + * vim<600: et sw=2 ts=2 sts=2 tw=78 + */ -- cgit v1.2.1 From 8e91d5de8e4e17ce3d4936cc91171d09726e7bb3 Mon Sep 17 00:00:00 2001 From: Sterling Hughes Date: Thu, 11 Oct 2001 09:32:19 +0000 Subject: looks nicer and is better compatible with older vim versions --- lib/strtok.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index b80bdb138..e7724d93c 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -69,6 +69,6 @@ Curl_strtok_r(char *ptr, const char *sep, char **end) * local variables: * eval: (load-file "../curl-mode.el") * end: - * vim600: et sw=2 ts=2 sts=2 tw=78 fdm=marker - * vim<600: et sw=2 ts=2 sts=2 tw=78 + * vim600: fdm=marker + * vim: et sw=2 ts=2 sts=2 tw=78 */ -- cgit v1.2.1 From 974f314f5785156af6983675aeb28313cc8ba2ea Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 19 Mar 2002 07:54:55 +0000 Subject: copyright string (year) update --- lib/strtok.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index e7724d93c..abbb194a6 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2001, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. * * In order to be useful for every potential user, curl and libcurl are * dual-licensed under the MPL and the MIT/X-derivate licenses. -- cgit v1.2.1 From ba4e69bebc8f7f32f3bc7faa1e13e7580754075b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 3 Sep 2002 11:52:59 +0000 Subject: updated source code boilerplate/header --- lib/strtok.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index abbb194a6..42ac1d82f 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -1,4 +1,4 @@ -/***************************************************************************** +/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | @@ -7,19 +7,19 @@ * * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. * - * In order to be useful for every potential user, curl and libcurl are - * dual-licensed under the MPL and the MIT/X-derivate licenses. - * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the MPL or the MIT/X-derivate - * licenses. You may pick one of these licenses. + * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * * $Id$ - *****************************************************************************/ + ***************************************************************************/ #include "setup.h" -- cgit v1.2.1 From f26a338a54e04d0a6907f5d2479d8b0fa9daf297 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 16 Jan 2003 21:08:12 +0000 Subject: copyright year update in the source header --- lib/strtok.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 42ac1d82f..a04227b4d 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2003, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From a7c72b7abf1213c471f3fd11e6b8e3a37d526f60 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 29 Jan 2003 10:14:20 +0000 Subject: removed the local variables for emacs and vim, use the new sample.emacs way for emacs, and vim users should provide a similar non-polluting style --- lib/strtok.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index a04227b4d..62bfe4755 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -64,11 +64,3 @@ Curl_strtok_r(char *ptr, const char *sep, char **end) } #endif /* this was only compiled if strtok_r wasn't present */ - -/* - * local variables: - * eval: (load-file "../curl-mode.el") - * end: - * vim600: fdm=marker - * vim: et sw=2 ts=2 sts=2 tw=78 - */ -- cgit v1.2.1 From 053f6c85efd0bf698f73343989474d672d0563a8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 7 Jan 2004 09:19:33 +0000 Subject: updated year in the copyright string --- lib/strtok.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 62bfe4755..33927ee8d 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2003, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From 4d17d6876e4b2f08380812c4ec113073b0a14639 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 29 Jan 2004 13:56:45 +0000 Subject: Dan Fandrich's cleanup patch to make pedantic compiler options cause less warnings. Minor edits by me. --- lib/strtok.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 33927ee8d..630e4e029 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -27,6 +27,8 @@ #include #include +#include "strtok.h" + char * Curl_strtok_r(char *ptr, const char *sep, char **end) { -- cgit v1.2.1 From cbd1a77ec24e397d05f20c6de106625676343c9d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 7 Nov 2007 09:21:35 +0000 Subject: if () => if() while () => while() and some other minor re-indentings --- lib/strtok.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 630e4e029..4895414e9 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -1,16 +1,16 @@ /*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. - * + * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. @@ -32,15 +32,15 @@ char * Curl_strtok_r(char *ptr, const char *sep, char **end) { - if (!ptr) + if(!ptr) /* we got NULL input so then we get our last position instead */ ptr = *end; /* pass all letters that are including in the separator string */ - while (*ptr && strchr(sep, *ptr)) + while(*ptr && strchr(sep, *ptr)) ++ptr; - if (*ptr) { + if(*ptr) { /* so this is where the next piece of string starts */ char *start = ptr; @@ -49,10 +49,10 @@ Curl_strtok_r(char *ptr, const char *sep, char **end) /* scan through the string to find where it ends, it ends on a null byte or a character that exists in the separator string */ - while (**end && !strchr(sep, **end)) + while(**end && !strchr(sep, **end)) ++*end; - if (**end) { + if(**end) { /* the end is not a null byte */ **end = '\0'; /* zero terminate it! */ ++*end; /* advance the last pointer to beyond the null byte */ -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/strtok.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 4895414e9..91c254156 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -18,7 +18,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ #include "setup.h" -- cgit v1.2.1 From f1586cb4775681810afd8e6626e7842d459f3b85 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 26 Jul 2011 17:23:27 +0200 Subject: stdio.h, stdlib.h, string.h, stdarg.h and ctype.h inclusion done in setup_once.h --- lib/strtok.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/strtok.c') diff --git a/lib/strtok.c b/lib/strtok.c index 91c254156..94eac0e64 100644 --- a/lib/strtok.c +++ b/lib/strtok.c @@ -24,7 +24,6 @@ #ifndef HAVE_STRTOK_R #include -#include #include "strtok.h" -- cgit v1.2.1