1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\" and Copyright 2014 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" Modified Sat Jul 24 17:45:39 1993 by Rik Faith (faith@cs.unc.edu)
7 .\" Modified 2000-02-13 by Nicolás Lichtmaier <nick@debian.org>
8 .TH TOUPPER 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
10 toupper, tolower, toupper_l, tolower_l \- convert uppercase or lowercase
13 .RI ( libc ", " \-lc )
18 .BI "int toupper(int " "c" );
19 .BI "int tolower(int " "c" );
21 .BI "int toupper_l(int " c ", locale_t " locale );
22 .BI "int tolower_l(int " c ", locale_t " locale );
26 Feature Test Macro Requirements for glibc (see
27 .BR feature_test_macros (7)):
39 These functions convert lowercase letters to uppercase, and vice versa.
43 is a lowercase letter,
45 returns its uppercase equivalent,
46 if an uppercase representation exists in the current locale.
51 function performs the same task,
52 but uses the locale referred to by the locale handle
57 is an uppercase letter,
59 returns its lowercase equivalent,
60 if a lowercase representation exists in the current locale.
65 function performs the same task,
66 but uses the locale referred to by the locale handle
75 the behavior of these functions
84 is the special locale object
88 or is not a valid locale object handle.
90 The value returned is that of the converted letter, or
92 if the conversion was not possible.
94 For an explanation of the terms used in this section, see
102 Interface Attribute Value
108 T} Thread safety MT-Safe
116 C89, C99, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
122 The standards require that the argument
124 for these functions is either
126 or a value that is representable in the type
127 .IR "unsigned char" .
133 .IR "unsigned char" ,
134 as in the following example:
140 res = toupper((unsigned char) c);
144 This is necessary because
146 may be the equivalent
148 in which case a byte where the top bit is set would be sign extended when
151 yielding a value that is outside the range of
152 .IR "unsigned char" .
154 The details of what constitutes an uppercase or lowercase letter depend
156 For example, the default
158 locale does not know about umlauts, so no conversion is done for them.
160 In some non-English locales, there are lowercase letters with no
161 corresponding uppercase equivalent;
162 .\" FIXME One day the statement about "sharp s" needs to be reworked,
163 .\" since there is nowadays a capital "sharp s" that has a codepoint
164 .\" in Unicode 5.0; see https://en.wikipedia.org/wiki/Capital_%E1%BA%9E
165 the German sharp s is one example.