Don't redeclare strsep if the system already has it.
[gnulib.git] / lib / strsep.h
1 /* Copyright (C) 2004 Free Software Foundation, Inc.
2  * Written by Yoann Vandoorselaere <yoann@prelude-ids.org>
3  *
4  * The file is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This file is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this file; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA.
18  */
19
20 #ifndef GNULIB_STRSEP_H_
21 #define GNULIB_STRSEP_H_
22
23 #if HAVE_STRSEP
24
25 /*
26  * Get strsep() declaration.
27  */
28 #include <string.h>
29
30 #else
31
32 /* Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
33    If one is found, it is overwritten with a NUL, and *STRINGP is advanced
34    to point to the next char after it.  Otherwise, *STRINGP is set to NULL.
35    If *STRINGP was already NULL, nothing happens.
36    Returns the old value of *STRINGP.
37
38    This is a variant of strtok() that is multithread-safe and supports
39    empty fields.
40
41    Caveat: It modifies the original string.
42    Caveat: It doesn't work with multibyte strings unless all of the delimiter
43            characters are ASCII characters < 0x30.  */
44
45 extern char *strsep (char **stringp, const char *delim);
46
47 #endif
48
49 #endif /* GNULIB_STRSEP_H_ */