1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
27 .\" Modified Sat Jul 24 18:00:10 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Mon Jan 20 12:04:18 1997 by Andries Brouwer (aeb@cwi.nl)
29 .\" Modified Tue Jan 23 20:23:07 2001 by Andries Brouwer (aeb@cwi.nl)
31 .TH STRSEP 3 2011-09-28 "GNU" "Linux Programmer's Manual"
33 strsep \- extract token from string
36 .B #include <string.h>
38 .BI "char *strsep(char **" stringp ", const char *" delim );
42 Feature Test Macro Requirements for glibc (see
43 .BR feature_test_macros (7)):
49 If \fI*stringp\fP is NULL, the
52 and does nothing else.
53 Otherwise, this function finds the first token
54 in the string \fI*stringp\fP, where tokens
55 are delimited by symbols in the string \fIdelim\fP.
56 This token is terminated by overwriting the delimiter
57 with a null byte (\(aq\\0\(aq)
58 and \fI*stringp\fP is updated to point past the token.
59 In case no delimiter was found, the token is taken to be
60 the entire string \fI*stringp\fP, and \fI*stringp\fP is made NULL.
64 function returns a pointer to the token,
65 that is, it returns the original value of \fI*stringp\fP.
71 function was introduced as a replacement for
73 since the latter cannot handle empty fields.
76 conforms to C89/C99 and hence is more portable.
78 Be cautious when using this function.
79 If you do use it, note that:
81 This function modifies its first argument.
83 This function cannot be used on constant strings.
85 The identity of the delimiting character is lost.