xref: /openbsd/lib/libc/gen/tolower.3 (revision 4cfece93)
1.\"	$OpenBSD: tolower.3,v 1.14 2017/09/05 03:16:13 schwarze Exp $
2.\"
3.\" Copyright (c) 1989, 1991 The Regents of the University of California.
4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to Berkeley by
8.\" the American National Standards Committee X3, on Information
9.\" Processing Systems.
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
14.\" 1. Redistributions of source code must retain the above copyright
15.\"    notice, this list of conditions and the following disclaimer.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\"    notice, this list of conditions and the following disclaimer in the
18.\"    documentation and/or other materials provided with the distribution.
19.\" 3. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.Dd $Mdocdate: September 5 2017 $
36.Dt TOLOWER 3
37.Os
38.Sh NAME
39.Nm tolower ,
40.Nm tolower_l ,
41.Nm _tolower
42.Nd upper case to lower case letter conversion
43.Sh SYNOPSIS
44.In ctype.h
45.Ft int
46.Fn tolower "int c"
47.Ft int
48.Fn tolower_l "int c" "locale_t locale"
49.Ft int
50.Fn _tolower "int c"
51.Sh DESCRIPTION
52The
53.Fn tolower
54and
55.Fn tolower_l
56functions convert an upper-case letter to the corresponding lower-case
57letter.
58The
59.Fn _tolower
60function is identical to
61.Fn tolower
62except that
63.Fa c
64must be an upper-case letter.
65.Pp
66.Ox
67always uses the C locale for these functions,
68ignoring the global locale, the thread-specific locale, and the
69.Fa locale
70argument.
71.Sh RETURN VALUES
72If the argument to the
73.Fn tolower
74or
75.Fn tolower_l
76function is an upper-case letter, the corresponding lower-case letter
77is returned if there is one; otherwise the argument is returned unchanged.
78If the argument to the
79.Fn _tolower
80function is an upper-case letter, the corresponding lower-case letter
81is returned; otherwise the output is undefined.
82.Sh ENVIRONMENT
83On systems supporting non-ASCII single-byte character encodings,
84the results of
85.Fn tolower
86and
87.Fn _tolower
88may depend on the
89.Ev LC_CTYPE
90.Xr locale 1 .
91.Sh SEE ALSO
92.Xr isalnum 3 ,
93.Xr isalpha 3 ,
94.Xr isascii 3 ,
95.Xr isblank 3 ,
96.Xr iscntrl 3 ,
97.Xr isdigit 3 ,
98.Xr isgraph 3 ,
99.Xr islower 3 ,
100.Xr isprint 3 ,
101.Xr ispunct 3 ,
102.Xr isspace 3 ,
103.Xr isupper 3 ,
104.Xr isxdigit 3 ,
105.Xr stdio 3 ,
106.Xr toascii 3 ,
107.Xr toupper 3 ,
108.Xr towlower 3 ,
109.Xr ascii 7
110.Sh STANDARDS
111The
112.Fn tolower
113and
114.Fn _tolower
115functions conform to
116.St -ansiC ,
117and
118.Fn tolower_l
119to
120.St -p1003.1-2008 .
121.Sh HISTORY
122The
123.Fn tolower
124function first appeared in
125.At v7
126and acquired the current semantics in
127.At III ,
128where
129.Fn _tolower
130first appeared.
131.Pp
132The
133.Fn tolower_l
134function has been available since
135.Ox 6.2 .
136.Sh CAVEATS
137The argument
138.Fa c
139must be
140.Dv EOF
141or representable as an
142.Li unsigned char ;
143otherwise, the result is undefined.
144