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.18 2017/04/26 07:40:09 abhinav Exp $ 32.\" 33.Dd April 26, 2017 34.Dt STRING 3 35.Os 36.Sh NAME 37.Nm string 38.Nd string specific functions 39.Sh LIBRARY 40.Lb libc 41.Sh SYNOPSIS 42.In string.h 43.Ft char * 44.Fn stpcpy "char *dst" "const char *src" 45.Ft char * 46.Fn stpncpy "char *dst" "const char *src" "size_t count" 47.Ft char * 48.Fn strcat "char *s" "const char * append" 49.Ft size_t 50.Fn strlcat "char *dst" "const char *src" "size_t size" 51.Ft char * 52.Fn strncat "char *s" "const char *append" "size_t count" 53.Ft char * 54.Fn strchr "const char *s" "int c" 55.Ft char * 56.Fn strrchr "const char *s" "int c" 57.Ft int 58.Fn strcmp "const char *s1" "const char *s2" 59.Ft int 60.Fn strncmp "const char *s1" "const char *s2" "size_t count" 61.Ft int 62.Fn strcasecmp "const char *s1" "const char *s2" 63.Ft int 64.Fn strncasecmp "const char *s1" "const char *s2" "size_t count" 65.Ft int 66.Fn strcoll "const char *s1" "const char *s2" 67.Ft char * 68.Fn strcpy "char *dst" "const char *src" 69.Ft size_t 70.Fn strlcpy "char *dst" "const char *src" "size_t size" 71.Ft char * 72.Fn strncpy "char *dst" "const char *src" "size_t count" 73.Ft char * 74.Fn strerror "int errno" 75.Ft int 76.Fn strerror_r "int errnum" "char *strerrbuf" "size_t buflen" 77.Ft size_t 78.Fn strlen "const char *s" 79.Ft size_t 80.Fn strnlen "const char *s" "size_t count" 81.Ft char * 82.Fn strpbrk "const char *s" "const char *charset" 83.Ft char * 84.Fn strsep "char **stringp" "const char *delim" 85.Ft char * 86.Fn stresep "char **stringp" "const char *delim" "int escape" 87.Ft size_t 88.Fn strspn "const char *s" "const char *charset" 89.Ft size_t 90.Fn strcspn "const char *s" "const char *charset" 91.Ft char * 92.Fn strdup "const char *str" 93.Ft char * 94.Fn strndup "const char *str" "size_t len" 95.Ft char * 96.Fn strstr "const char *big" "const char *little" 97.Ft char * 98.Fn strcasestr "const char *big" "const char *little" 99.Ft char * 100.Fn strtok "char *s" "const char *delim" 101.Ft char * 102.Fn strtok_r "char *s" "const char *delim" "char **lasts" 103.Ft size_t 104.Fn strxfrm "char *dst" "const char *src" "size_t n" 105.Sh DESCRIPTION 106The string 107functions manipulate strings terminated by a 108nul byte. 109.Pp 110See the specific manual pages for more information. 111For manipulating variable length generic objects as byte 112strings (without the nul 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 strcat 3 , 121.Xr strchr 3 , 122.Xr strcmp 3 , 123.Xr strcoll 3 , 124.Xr strcpy 3 , 125.Xr strcspn 3 , 126.Xr strdup 3 , 127.Xr strerror 3 , 128.Xr strings 3 , 129.Xr strlcat 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.Xr strxfrm 3 138.Sh STANDARDS 139The 140.Fn strcat , 141.Fn strncat , 142.Fn strchr , 143.Fn strrchr , 144.Fn strcmp , 145.Fn strncmp , 146.Fn strcpy , 147.Fn strncpy , 148.Fn strcoll , 149.Fn strerror , 150.Fn strlen , 151.Fn strpbrk , 152.Fn strsep , 153.Fn strspn , 154.Fn strcspn , 155.Fn strstr , 156.Fn strtok , 157and 158.Fn strxfrm 159functions conform to 160.St -ansiC . 161.Pp 162The 163.Fn strtok_r 164function conforms to 165.St -p1003.1c-95 . 166.Pp 167The 168.Fn strerror_r 169function conforms to 170.St -p1003.1-2001 . 171