X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrtok_r.c;h=2d636a5f61644d408537595a0cd401925d1b3aaf;hb=bda3b4454a255896a1aaa6ff89b677f52474b636;hp=232474a7be894741a3c8e000772806b23911de24;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/strtok_r.c b/lib/strtok_r.c index 232474a7b..2d636a5f6 100644 --- a/lib/strtok_r.c +++ b/lib/strtok_r.c @@ -1,5 +1,6 @@ /* Reentrant string tokenizer. Generic version. - Copyright (C) 1991,1996-1999,2001,2004,2007 Free Software Foundation, Inc. + Copyright (C) 1991, 1996-1999, 2001, 2004, 2007, 2009-2010 Free Software + Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -21,10 +22,10 @@ #include -#undef strtok_r -#undef __strtok_r - -#ifndef _LIBC +#ifdef _LIBC +# undef strtok_r +# undef __strtok_r +#else # define __strtok_r strtok_r # define __rawmemchr strchr #endif @@ -32,12 +33,12 @@ /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: - char s[] = "-abc-=-def"; - char *sp; - x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" - x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL - x = strtok_r(NULL, "=", &sp); // x = NULL - // s = "abc\0-def\0" + char s[] = "-abc-=-def"; + char *sp; + x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = strtok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" */ char * __strtok_r (char *s, const char *delim, char **save_ptr)