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 2016-10-08 "GNU" "Linux Programmer's Manual"
30 toupper, tolower, toupper_l, tolower_l \- convert uppercase or lowercase
35 .BI "int toupper(int " "c" );
37 .BI "int tolower(int " "c" );
39 .BI "int toupper_l(int " c ", locale_t " locale );
40 .BI "int tolower_l(int " c ", locale_t " locale );
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
54 _XOPEN_SOURCE\ >=\ 700
61 These functions convert lowercase letters to uppercase, and vice versa.
65 is a lowercase letter,
67 returns its uppercase equivalent,
68 if an uppercase representation exists in the current locale.
73 function performs the same task,
74 but uses the locale referred to by the locale handle
79 is an uppercase letter,
81 returns its lowercase equivalent,
82 if a lowercase representation exists in the current locale.
87 function performs the same task,
88 but uses the locale referred to by the locale handle
97 the behavior of these functions
106 is the special locale object
110 or is not a valid locale object handle.
112 The value returned is that of the converted letter, or
114 if the conversion was not possible.
116 For an explanation of the terms used in this section, see
122 Interface Attribute Value
129 T} Thread safety MT-Safe
134 C89, C99, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
140 The standards require that the argument
142 for these functions is either
144 or a value that is representable in the type
145 .IR "unsigned char" .
151 .IR "unsigned char" ,
152 as in the following example:
158 res = toupper((unsigned char) c);
162 This is necessary because
164 may be the equivalent
166 in which case a byte where the top bit is set would be sign extended when
169 yielding a value that is outside the range of
170 .IR "unsigned char" .
172 The details of what constitutes an uppercase or lowercase letter depend
174 For example, the default
176 locale does not know about umlauts, so no conversion is done for them.
178 In some non-English locales, there are lowercase letters with no
179 corresponding uppercase equivalent;
180 .\" FIXME One day the statement about "sharp s" needs to be reworked,
181 .\" since there is nowadays a capital "sharp s" that has a codepoint
182 .\" in Unicode 5.0; see https://en.wikipedia.org/wiki/Capital_%E1%BA%9E
183 the German sharp s is one example.