2 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" and Copyright 2014 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\" Modified Sat Jul 24 17:45:39 1993 by Rik Faith (faith@cs.unc.edu)
8 .\" Modified 2000-02-13 by Nicolás Lichtmaier <nick@debian.org>
9 .TH toupper 3 (date) "Linux man-pages (unreleased)"
11 toupper, tolower, toupper_l, tolower_l \- convert uppercase or lowercase
14 .RI ( libc ", " \-lc )
19 .BI "int toupper(int " "c" );
20 .BI "int tolower(int " "c" );
22 .BI "int toupper_l(int " c ", locale_t " locale );
23 .BI "int tolower_l(int " c ", locale_t " locale );
27 Feature Test Macro Requirements for glibc (see
28 .BR feature_test_macros (7)):
40 These functions convert lowercase letters to uppercase, and vice versa.
44 is a lowercase letter,
46 returns its uppercase equivalent,
47 if an uppercase representation exists in the current locale.
52 function performs the same task,
53 but uses the locale referred to by the locale handle
58 is an uppercase letter,
60 returns its lowercase equivalent,
61 if a lowercase representation exists in the current locale.
66 function performs the same task,
67 but uses the locale referred to by the locale handle
76 the behavior of these functions
85 is the special locale object
89 or is not a valid locale object handle.
91 The value returned is that of the converted letter, or
93 if the conversion was not possible.
95 For an explanation of the terms used in this section, see
101 Interface Attribute Value
109 T} Thread safety MT-Safe
127 C89, 4.3BSD, POSIX.1-2001.
134 The standards require that the argument
136 for these functions is either
138 or a value that is representable in the type
139 .IR "unsigned char" .
145 .IR "unsigned char" ,
146 as in the following example:
152 res = toupper((unsigned char) c);
156 This is necessary because
158 may be the equivalent
160 in which case a byte where the top bit is set would be sign extended when
163 yielding a value that is outside the range of
164 .IR "unsigned char" .
166 The details of what constitutes an uppercase or lowercase letter depend
168 For example, the default
170 locale does not know about umlauts, so no conversion is done for them.
172 In some non-English locales, there are lowercase letters with no
173 corresponding uppercase equivalent;
174 .\" FIXME One day the statement about "sharp s" needs to be reworked,
175 .\" since there is nowadays a capital "sharp s" that has a codepoint
176 .\" in Unicode 5.0; see https://en.wikipedia.org/wiki/Capital_%E1%BA%9E
177 the German sharp s is one example.