xref: /freebsd/lib/libc/string/string.3 (revision 1669d8afc64812c8d2d1d147ae1fd42ff441e1b1)
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$
32.\"
33.Dd December 11, 1993
34.Dt STRING 3
35.Os
36.Sh NAME
37.Nm stpcpy ,
38.Nm strcat ,
39.Nm strncat ,
40.Nm strchr ,
41.Nm strrchr ,
42.Nm strcmp ,
43.Nm strncmp ,
44.Nm strcasecmp ,
45.Nm strncasecmp ,
46.Nm strcpy ,
47.Nm strncpy ,
48.Nm strerror ,
49.Nm strlen ,
50.Nm strpbrk ,
51.Nm strsep ,
52.Nm strspn ,
53.Nm strcspn ,
54.Nm strstr ,
55.Nm strtok ,
56.Nm index ,
57.Nm rindex
58.Nd string specific functions
59.Sh LIBRARY
60.Lb libc
61.Sh SYNOPSIS
62.In string.h
63.Ft char *
64.Fn stpcpy "char *dst" "const char *src"
65.Ft char *
66.Fn strcat "char *s" "const char * append"
67.Ft char *
68.Fn strncat "char *s" "const char *append" "size_t count"
69.Ft char *
70.Fn strchr "const char *s" "int c"
71.Ft char *
72.Fn strrchr "const char *s" "int c"
73.Ft int
74.Fn strcmp "const char *s1" "const char *s2"
75.Ft int
76.Fn strncmp "const char *s1" "const char *s2" "size_t count"
77.Ft int
78.Fn strcasecmp "const char *s1" "const char *s2"
79.Ft int
80.Fn strncasecmp "const char *s1" "const char *s2" "size_t count"
81.Ft char *
82.Fn strcpy "char *dst" "const char *src"
83.Ft char *
84.Fn strncpy "char *dst" "const char *src" "size_t count"
85.Ft char *
86.Fn strerror "int errno"
87.Ft size_t
88.Fn strlen "const char *s"
89.Ft char *
90.Fn strpbrk "const char *s" "const char *charset"
91.Ft char *
92.Fn strsep "char **stringp" "const char *delim"
93.Ft size_t
94.Fn strspn "const char *s" "const char *charset"
95.Ft size_t
96.Fn strcspn "const char *s" "const char *charset"
97.Ft char *
98.Fn strstr "const char *big" "const char *little"
99.Ft char *
100.Fn strtok "char *s" "const char *delim"
101.Ft char *
102.Fn index "const char *s" "int c"
103.Ft char *
104.Fn rindex "const char *s" "int c"
105.Sh DESCRIPTION
106The string
107functions manipulate strings terminated by a
108null byte.
109.Pp
110See the specific manual pages for more information.
111For manipulating variable length generic objects as byte
112strings (without the null byte check), see
113.Xr bstring 3 .
114.Pp
115Except as noted in their specific manual pages,
116the string functions do not test the destination
117for size limitations.
118.Sh SEE ALSO
119.Xr bstring 3 ,
120.Xr index 3 ,
121.Xr rindex 3 ,
122.Xr stpcpy 3 ,
123.Xr strcasecmp 3 ,
124.Xr strcat 3 ,
125.Xr strchr 3 ,
126.Xr strcmp 3 ,
127.Xr strcpy 3 ,
128.Xr strcspn 3 ,
129.Xr strerror 3 ,
130.Xr strlen 3 ,
131.Xr strpbrk 3 ,
132.Xr strrchr 3 ,
133.Xr strsep 3 ,
134.Xr strspn 3 ,
135.Xr strstr 3 ,
136.Xr strtok 3
137.Sh STANDARDS
138The
139.Fn strcat ,
140.Fn strncat ,
141.Fn strchr ,
142.Fn strrchr ,
143.Fn strcmp ,
144.Fn strncmp ,
145.Fn strcpy ,
146.Fn strncpy ,
147.Fn strerror ,
148.Fn strlen ,
149.Fn strpbrk ,
150.Fn strspn ,
151.Fn strcspn ,
152.Fn strstr ,
153and
154.Fn strtok
155functions
156conform to
157.St -isoC .
158