/ string / FreeBSD / string.3
string.3
  1  .\" Copyright (c) 1990, 1991, 1993
  2  .\"	The Regents of the University of California.  All rights reserved.
  3  .\"
  4  .\" This code is derived from software contributed to Berkeley by
  5  .\" Chris Torek.
  6  .\" Redistribution and use in source and binary forms, with or without
  7  .\" modification, are permitted provided that the following conditions
  8  .\" are met:
  9  .\" 1. Redistributions of source code must retain the above copyright
 10  .\"    notice, this list of conditions and the following disclaimer.
 11  .\" 2. Redistributions in binary form must reproduce the above copyright
 12  .\"    notice, this list of conditions and the following disclaimer in the
 13  .\"    documentation and/or other materials provided with the distribution.
 14  .\" 4. Neither the name of the University nor the names of its contributors
 15  .\"    may be used to endorse or promote products derived from this software
 16  .\"    without specific prior written permission.
 17  .\"
 18  .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19  .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20  .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 21  .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 22  .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 23  .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 24  .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 25  .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 26  .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 27  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 28  .\" SUCH DAMAGE.
 29  .\"
 30  .\"     @(#)string.3	8.2 (Berkeley) 12/11/93
 31  .\" $FreeBSD: src/lib/libc/string/string.3,v 1.14 2007/01/09 00:28:12 imp Exp $
 32  .\"
 33  .Dd December 11, 1993
 34  .Dt STRING 3
 35  .Os
 36  .Sh NAME
 37  .Nm index ,
 38  .Nm rindex ,
 39  .Nm stpcpy ,
 40  .Nm strcasecmp ,
 41  .Nm strcat ,
 42  .Nm strchr ,
 43  .Nm strcmp ,
 44  .Nm strcpy ,
 45  .Nm strcspn ,
 46  .Nm strerror ,
 47  .Nm strlen ,
 48  .Nm strncasecmp ,
 49  .Nm strncat ,
 50  .Nm strncmp ,
 51  .Nm strncpy ,
 52  .Nm strpbrk ,
 53  .Nm strrchr ,
 54  .Nm strsep ,
 55  .Nm strspn ,
 56  .Nm strstr ,
 57  .Nm strtok
 58  .Nd string specific functions
 59  .Sh LIBRARY
 60  .Lb libc
 61  .Sh SYNOPSIS
 62  .In strings.h
 63  .Ft char *
 64  .Fo index
 65  .Fa "const char *s"
 66  .Fa "int c"
 67  .Fc
 68  .Ft char *
 69  .Fo rindex
 70  .Fa "const char *s"
 71  .Fa "int c"
 72  .Fc
 73  .Ft int
 74  .Fo strcasecmp
 75  .Fa "const char *s1"
 76  .Fa "const char *s2"
 77  .Fc
 78  .Ft int
 79  .Fo strncasecmp
 80  .Fa "const char *s1"
 81  .Fa "const char *s2"
 82  .Fa "size_t n"
 83  .Fc
 84  .In string.h
 85  .Ft char *
 86  .Fo stpcpy
 87  .Fa "char *dst"
 88  .Fa "const char *src"
 89  .Fc
 90  .Ft char *
 91  .Fo strcat
 92  .Fa "char *restrict s1"
 93  .Fa "const char *restrict s2"
 94  .Fc
 95  .Ft char *
 96  .Fo strchr
 97  .Fa "const char *s"
 98  .Fa "int c"
 99  .Fc
100  .Ft int
101  .Fo strcmp
102  .Fa "const char *s1"
103  .Fa "const char *s2"
104  .Fc
105  .Ft char *
106  .Fo strcpy
107  .Fa "char *restrict s1"
108  .Fa "const char *restrict s2"
109  .Fc
110  .Ft size_t
111  .Fo strcspn
112  .Fa "const char *s1"
113  .Fa "const char *s2"
114  .Fc
115  .Ft char *
116  .Fo strerror
117  .Fa "int errnum"
118  .Fc
119  .Ft size_t
120  .Fo strlen
121  .Fa "const char *s"
122  .Fc
123  .Ft char *
124  .Fo strncat
125  .Fa "char *restrict s1"
126  .Fa "const char *restrict s2"
127  .Fa "size_t n"
128  .Fc
129  .Ft int
130  .Fo strncmp
131  .Fa "const char *s1"
132  .Fa "const char *s2"
133  .Fa "size_t n"
134  .Fc
135  .Ft char *
136  .Fo strncpy
137  .Fa "char *restrict s1"
138  .Fa "const char *restrict s2"
139  .Fa "size_t n"
140  .Fc
141  .Ft char *
142  .Fo strpbrk
143  .Fa "const char *s1"
144  .Fa "const char *s2"
145  .Fc
146  .Ft char *
147  .Fo strrchr
148  .Fa "const char *s"
149  .Fa "int c"
150  .Fc
151  .Ft char *
152  .Fo strsep
153  .Fa "char **stringp"
154  .Fa "const char *delim"
155  .Fc
156  .Ft size_t
157  .Fo strspn
158  .Fa "const char *s1"
159  .Fa "const char *s2"
160  .Fc
161  .Ft char *
162  .Fo strstr
163  .Fa "const char *s1"
164  .Fa "const char *s2"
165  .Fc
166  .Ft char *
167  .Fo strtok
168  .Fa "char *restrict s1"
169  .Fa "const char *restrict s2"
170  .Fc
171  .Sh DESCRIPTION
172  The string
173  functions manipulate strings that are terminated by a
174  null byte.
175  .Pp
176  See the specific manual pages for more information.
177  For manipulating variable length generic objects as byte
178  strings (without the null byte check), see
179  .Xr bstring 3 .
180  .Pp
181  Except as noted in their specific manual pages,
182  the string functions do not test the destination
183  for size limitations.
184  .Sh SEE ALSO
185  .Xr bstring 3 ,
186  .Xr index 3 ,
187  .Xr rindex 3 ,
188  .Xr stpcpy 3 ,
189  .Xr strcasecmp 3 ,
190  .Xr strcat 3 ,
191  .Xr strchr 3 ,
192  .Xr strcmp 3 ,
193  .Xr strcpy 3 ,
194  .Xr strcspn 3 ,
195  .Xr strerror 3 ,
196  .Xr strlen 3 ,
197  .Xr strpbrk 3 ,
198  .Xr strrchr 3 ,
199  .Xr strsep 3 ,
200  .Xr strspn 3 ,
201  .Xr strstr 3 ,
202  .Xr strtok 3
203  .Sh STANDARDS
204  The
205  .Fn strcat ,
206  .Fn strncat ,
207  .Fn strchr ,
208  .Fn strrchr ,
209  .Fn strcmp ,
210  .Fn strncmp ,
211  .Fn strcpy ,
212  .Fn strncpy ,
213  .Fn strerror ,
214  .Fn strlen ,
215  .Fn strpbrk ,
216  .Fn strspn ,
217  .Fn strcspn ,
218  .Fn strstr ,
219  and
220  .Fn strtok
221  functions
222  conform to
223  .St -isoC .