1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\" and Copyright 2014 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Modified Sat Jul 24 17:45:39 1993 by Rik Faith (faith@cs.unc.edu)
27 .\" Modified 2000-02-13 by Nicolás Lichtmaier <nick@debian.org>
28 .TH TOUPPER 3 2021-03-22 "GNU" "Linux Programmer's Manual"
30 toupper, tolower, toupper_l, tolower_l \- convert uppercase or lowercase
35 .BI "int toupper(int " "c" );
36 .BI "int tolower(int " "c" );
38 .BI "int toupper_l(int " c ", locale_t " locale );
39 .BI "int tolower_l(int " c ", locale_t " locale );
43 Feature Test Macro Requirements for glibc (see
44 .BR feature_test_macros (7)):
56 These functions convert lowercase letters to uppercase, and vice versa.
60 is a lowercase letter,
62 returns its uppercase equivalent,
63 if an uppercase representation exists in the current locale.
68 function performs the same task,
69 but uses the locale referred to by the locale handle
74 is an uppercase letter,
76 returns its lowercase equivalent,
77 if a lowercase representation exists in the current locale.
82 function performs the same task,
83 but uses the locale referred to by the locale handle
92 the behavior of these functions
101 is the special locale object
105 or is not a valid locale object handle.
107 The value returned is that of the converted letter, or
109 if the conversion was not possible.
111 For an explanation of the terms used in this section, see
119 Interface Attribute Value
125 T} Thread safety MT-Safe
133 C89, C99, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
139 The standards require that the argument
141 for these functions is either
143 or a value that is representable in the type
144 .IR "unsigned char" .
150 .IR "unsigned char" ,
151 as in the following example:
157 res = toupper((unsigned char) c);
161 This is necessary because
163 may be the equivalent
165 in which case a byte where the top bit is set would be sign extended when
168 yielding a value that is outside the range of
169 .IR "unsigned char" .
171 The details of what constitutes an uppercase or lowercase letter depend
173 For example, the default
175 locale does not know about umlauts, so no conversion is done for them.
177 In some non-English locales, there are lowercase letters with no
178 corresponding uppercase equivalent;
179 .\" FIXME One day the statement about "sharp s" needs to be reworked,
180 .\" since there is nowadays a capital "sharp s" that has a codepoint
181 .\" in Unicode 5.0; see https://en.wikipedia.org/wiki/Capital_%E1%BA%9E
182 the German sharp s is one example.