1.\" $OpenBSD: strcasecmp.3,v 1.14 2017/09/05 03:16:13 schwarze Exp $ 2.\" 3.\" Copyright (c) 1990, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 6.\" 7.\" This code is derived from software contributed to Berkeley by 8.\" Chris Torek. 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. Neither the name of the University nor the names of its contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" SUCH DAMAGE. 32.\" 33.\" @(#)strcasecmp.3 8.1 (Berkeley) 6/9/93 34.\" 35.Dd $Mdocdate: September 5 2017 $ 36.Dt STRCASECMP 3 37.Os 38.Sh NAME 39.Nm strcasecmp , 40.Nm strcasecmp_l , 41.Nm strncasecmp , 42.Nm strncasecmp_l 43.Nd compare strings, ignoring case 44.Sh SYNOPSIS 45.In strings.h 46.Ft int 47.Fo strcasecmp 48.Fa "const char *s1" 49.Fa "const char *s2" 50.Fc 51.Ft int 52.Fo strcasecmp_l 53.Fa "const char *s1" 54.Fa "const char *s2" 55.Fa "locale_t locale" 56.Fc 57.Ft int 58.Fo strncasecmp 59.Fa "const char *s1" 60.Fa "const char *s2" 61.Fa "size_t len" 62.Fc 63.Ft int 64.Fo strncasecmp_l 65.Fa "const char *s1" 66.Fa "const char *s2" 67.Fa "size_t len" 68.Fa "locale_t locale" 69.Fc 70.Sh DESCRIPTION 71These functions compare the NUL-terminated strings 72.Fa s1 73and 74.Fa s2 75and return an integer greater than, equal to, or less than 0, 76according to whether 77.Fa s1 78is lexicographically greater than, equal to, or less than 79.Fa s2 80after translation of each corresponding character to lower-case. 81The strings themselves are not modified. 82The comparison is done using unsigned characters, so that 83.Sq Li \e200 84is greater than 85.Ql \e0 . 86.Pp 87.Fn strncasecmp 88and 89.Fn strncasecmp_l 90compare at most 91.Fa len 92characters. 93.Pp 94On 95.Ox , 96these functions always use the C locale and ignore 97the global locale, the thread-specific locale, and the 98.Fa locale 99argument. 100.Sh ENVIRONMENT 101On other operating systems, the behaviour of 102.Fn strcasecmp 103and 104.Fn strncasecmp 105may depend on the 106.Dv LC_CTYPE 107.Xr locale 1 . 108.Sh SEE ALSO 109.Xr strcmp 3 , 110.Xr strcoll 3 , 111.Xr strxfrm 3 , 112.Xr wcscasecmp 3 113.Sh STANDARDS 114These functions conform to 115.St -p1003.1-2008 . 116.Sh HISTORY 117The 118.Fn strcasecmp 119and 120.Fn strncasecmp 121functions have been available since 122.Bx 4.3 Tahoe , 123and 124.Fn strcasecmp_l 125and 126.Fn strncasecmp_l 127since 128.Ox 6.2 . 129