mount_setattr.2: Reword the description of the 'propagation field'
[man-pages.git] / man3 / toupper.3
blob8472dbc4ec4d71f2be1e6e93d093e3ef2c32b05f
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\" and Copyright 2014 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
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.
8 .\"
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.
13 .\"
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
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
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"
29 .SH NAME
30 toupper, tolower, toupper_l, tolower_l \- convert uppercase or lowercase
31 .SH SYNOPSIS
32 .nf
33 .B #include <ctype.h>
34 .PP
35 .BI "int toupper(int " "c" );
36 .BI "int tolower(int " "c" );
37 .PP
38 .BI "int toupper_l(int " c ", locale_t " locale );
39 .BI "int tolower_l(int " c ", locale_t " locale );
40 .fi
41 .PP
42 .RS -4
43 Feature Test Macro Requirements for glibc (see
44 .BR feature_test_macros (7)):
45 .RE
46 .PP
47 .BR toupper_l (),
48 .BR tolower_l ():
49 .nf
50     Since glibc 2.10:
51         _XOPEN_SOURCE >= 700
52     Before glibc 2.10:
53         _GNU_SOURCE
54 .fi
55 .SH DESCRIPTION
56 These functions convert lowercase letters to uppercase, and vice versa.
57 .PP
59 .I c
60 is a lowercase letter,
61 .BR toupper ()
62 returns its uppercase equivalent,
63 if an uppercase representation exists in the current locale.
64 Otherwise, it returns
65 .IR c .
66 The
67 .BR toupper_l ()
68 function performs the same task,
69 but uses the locale referred to by the locale handle
70 .IR locale .
71 .PP
73 .I c
74 is an uppercase letter,
75 .BR tolower ()
76 returns its lowercase equivalent,
77 if a lowercase representation exists in the current locale.
78 Otherwise, it returns
79 .IR c .
80 The
81 .BR tolower_l ()
82 function performs the same task,
83 but uses the locale referred to by the locale handle
84 .IR locale .
85 .PP
87 .I c
88 is neither an
89 .I "unsigned char"
90 value nor
91 .BR EOF ,
92 the behavior of these functions
93 is undefined.
94 .PP
95 The behavior of
96 .BR toupper_l ()
97 and
98 .BR tolower_l ()
99 is undefined if
100 .I locale
101 is the special locale object
102 .B LC_GLOBAL_LOCALE
103 (see
104 .BR duplocale (3))
105 or is not a valid locale object handle.
106 .SH RETURN VALUE
107 The value returned is that of the converted letter, or
108 .I c
109 if the conversion was not possible.
110 .SH ATTRIBUTES
111 For an explanation of the terms used in this section, see
112 .BR attributes (7).
113 .ad l
116 allbox;
117 lbx lb lb
118 l l l.
119 Interface       Attribute       Value
121 .BR toupper (),
122 .BR tolower (),
123 .BR toupper_l (),
124 .BR tolower_l ()
125 T}      Thread safety   MT-Safe
129 .sp 1
130 .SH CONFORMING TO
131 .BR toupper (),
132 .BR tolower ():
133 C89, C99, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
135 .BR toupper_l (),
136 .BR tolower_l ():
137 POSIX.1-2008.
138 .SH NOTES
139 The standards require that the argument
140 .I c
141 for these functions is either
142 .B EOF
143 or a value that is representable in the type
144 .IR "unsigned char" .
145 If the argument
146 .I c
147 is of type
148 .IR char ,
149 it must be cast to
150 .IR "unsigned char" ,
151 as in the following example:
153 .in +4n
155 char c;
156 \&...
157 res = toupper((unsigned char) c);
161 This is necessary because
162 .I char
163 may be the equivalent
164 .IR "signed char" ,
165 in which case a byte where the top bit is set would be sign extended when
166 converting to
167 .IR int ,
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
172 on the locale.
173 For example, the default
174 .B """C"""
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.
183 .SH SEE ALSO
184 .BR isalpha (3),
185 .BR newlocale (3),
186 .BR setlocale (3),
187 .BR towlower (3),
188 .BR towupper (3),
189 .BR uselocale (3),
190 .BR locale (7)