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.\" 3. 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.\" from: @(#)string.3 8.2 (Berkeley) 12/11/93 31.\" $NetBSD: string.3,v 1.15 2007/02/17 09:32:58 wiz Exp $ 32.\" 33.Dd February 17, 2007 34.Dt STRING 3 35.Os 36.Sh NAME 37.Nm strcat , 38.Nm strlcat , 39.Nm strncat , 40.Nm strchr , 41.Nm strrchr , 42.Nm strcmp , 43.Nm strncmp , 44.Nm strcoll , 45.Nm strcpy , 46.Nm strlcpy , 47.Nm strncpy , 48.Nm strerror , 49.Nm strerror_r , 50.Nm strlen , 51.Nm strpbrk , 52.Nm strsep , 53.Nm stresep , 54.Nm strspn , 55.Nm strcspn , 56.Nm strdup , 57.Nm strndup , 58.Nm strstr , 59.Nm strcasestr , 60.Nm strtok , 61.Nm strtok_r , 62.Nm strxfrm 63.Nd string specific functions 64.Sh LIBRARY 65.Lb libc 66.Sh SYNOPSIS 67.In string.h 68.Ft char * 69.Fn strcat "char *s" "const char * append" 70.Ft size_t 71.Fn strlcat "char *dst" "const char *src" "size_t size" 72.Ft char * 73.Fn strncat "char *s" "const char *append" "size_t count" 74.Ft char * 75.Fn strchr "const char *s" "int c" 76.Ft char * 77.Fn strrchr "const char *s" "int c" 78.Ft int 79.Fn strcmp "const char *s1" "const char *s2" 80.Ft int 81.Fn strncmp "const char *s1" "const char *s2" "size_t count" 82.Ft int 83.Fn strcoll "const char *s1" "const char *s2" 84.Ft char * 85.Fn strcpy "char *dst" "const char *src" 86.Ft size_t 87.Fn strlcpy "char *dst" "const char *src" "size_t size" 88.Ft char * 89.Fn strncpy "char *dst" "const char *src" "size_t count" 90.Ft char * 91.Fn strerror "int errno" 92.Ft int 93.Fn strerror_r "int errnum" "char *strerrbuf" "size_t buflen" 94.Ft size_t 95.Fn strlen "const char *s" 96.Ft char * 97.Fn strpbrk "const char *s" "const char *charset" 98.Ft char * 99.Fn strsep "char **stringp" "const char *delim" 100.Ft char * 101.Fn stresep "char **stringp" "const char *delim" "int escape" 102.Ft size_t 103.Fn strspn "const char *s" "const char *charset" 104.Ft size_t 105.Fn strcspn "const char *s" "const char *charset" 106.Ft char * 107.Fn strdup "const char *str" 108.Ft char * 109.Fn strndup "const char *str" "size_t len" 110.Ft char * 111.Fn strstr "const char *big" "const char *little" 112.Ft char * 113.Fn strcasestr "const char *big" "const char *little" 114.Ft char * 115.Fn strtok "char *s" "const char *delim" 116.Ft char * 117.Fn strtok_r "char *s" "const char *delim" "char **lasts" 118.Ft size_t 119.Fn strxfrm "char *dst" "const char *src" "size_t n" 120.Sh DESCRIPTION 121The string 122functions manipulate strings terminated by a 123nul byte. 124.Pp 125See the specific manual pages for more information. 126For manipulating variable length generic objects as byte 127strings (without the nul byte check), see 128.Xr bstring 3 . 129.Pp 130Except as noted in their specific manual pages, 131the string functions do not test the destination 132for size limitations. 133.Sh SEE ALSO 134.Xr bstring 3 , 135.Xr strcat 3 , 136.Xr strchr 3 , 137.Xr strcmp 3 , 138.Xr strcoll 3 , 139.Xr strcpy 3 , 140.Xr strcspn 3 , 141.Xr strdup 3 , 142.Xr strerror 3 , 143.Xr strings 3 , 144.Xr strlcat 3 , 145.Xr strlen 3 , 146.Xr strpbrk 3 , 147.Xr strrchr 3 , 148.Xr strsep 3 , 149.Xr strspn 3 , 150.Xr strstr 3 , 151.Xr strtok 3 , 152.Xr strxfrm 3 153.Sh STANDARDS 154The 155.Fn strcat , 156.Fn strncat , 157.Fn strchr , 158.Fn strrchr , 159.Fn strcmp , 160.Fn strncmp , 161.Fn strcpy , 162.Fn strncpy , 163.Fn strcoll , 164.Fn strerror , 165.Fn strlen , 166.Fn strpbrk , 167.Fn strsep , 168.Fn strspn , 169.Fn strcspn , 170.Fn strstr , 171.Fn strtok , 172and 173.Fn strxfrm 174functions conform to 175.St -ansiC . 176.Pp 177The 178.Fn strtok_r 179function conforms to 180.St -p1003.1c-95 . 181.Pp 182The 183.Fn strerror_r 184function conform to 185.St -p1003.1-2001 . 186