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