OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / toupper.3
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  2014-03-18 "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 .sp
35 .BI "int toupper(int " "c" );
36 .br
37 .BI "int tolower(int " "c" );
38
39 .BI "int toupper_l(int " c ", locale_t " locale );
40 .BI "int tolower_l(int " c ", locale_t " locale );
41 .fi
42 .sp
43 .in -4n
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
46 .in
47 .sp
48 .BR toupper_l (),
49 .BR tolower_l ():
50 .PD 0
51 .RS 4
52 .TP
53 Since glibc 2.10:
54 _XOPEN_SOURCE\ >=\ 700
55 .TP
56 Before glibc 2.10:
57 _GNU_SOURCE
58 .RE
59 .PD
60 .SH DESCRIPTION
61 These functions convert lowercase letters to uppercase, and vice versa.
62
63 If
64 .I c
65 is a lowercase letter,
66 .BR toupper ()
67 returns its uppercase equivalent,
68 if an uppercase representation exists in the current locale.
69 Otherwise, it returns
70 .IR c .
71 The
72 .BR toupper_l ()
73 function performs the same task,
74 but uses the locale referred to by the locale handle
75 .IR locale .
76
77 If
78 .I c
79 is a uppercase letter,
80 .BR tolower ()
81 returns its lowercase equivalent,
82 if a lowercase representation exists in the current locale.
83 Otherwise, it returns
84 .IR c .
85 The
86 .BR tolower_l ()
87 function performs the same task,
88 but uses the locale referred to by the locale handle
89 .IR locale .
90 .PP
91 If
92 .I c
93 is neither an
94 .I "unsigned char"
95 value nor
96 .BR EOF ,
97 the behavior of these functions
98 is undefined.
99
100 The behavior of
101 .BR toupper_l ()
102 and
103 .BR tolower_l ()
104 is undefined if
105 .I locale
106 is the special locale object
107 .BR LC_GLOBAL_LOCALE
108 (see
109 .BR duplocale (3))
110 or is not a valid locale object handle.
111 .SH RETURN VALUE
112 The value returned is that of the converted letter, or
113 .I c
114 if the conversion was not possible.
115 .SH ATTRIBUTES
116 .SS Multithreading (see pthreads(7))
117 The
118 .BR toupper ()
119 and
120 .BR tolower ()
121 functions are thread-safe with exceptions.
122 These functions can be safely used in multithreaded applications,
123 as long as
124 .BR setlocale (3)
125 is not called to change the locale during their execution.
126 .\" FIXME . Add toupper_l() and tolower_l()
127 .SH CONFORMING TO
128 .BR toupper (),
129 .BR tolower ():
130 C89, C99, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
131
132 .BR toupper_l (),
133 .BR tolower_l ():
134 POSIX.1-2008.
135 .SH NOTES
136 The details of what constitutes an uppercase or lowercase letter depend
137 on the locale.
138 For example, the default
139 .B """C"""
140 locale does not know about umlauts, so no conversion is done for them.
141 .PP
142 In some non-English locales, there are lowercase letters with no
143 corresponding uppercase equivalent;
144 .\" FIXME One day the statement about "sharp s" needs to be reworked,
145 .\" since there is nowadays a capital "sharp s" that has a codepoint
146 .\" in Unicode 5.0; see https://en.wikipedia.org/wiki/Capital_%E1%BA%9E
147 the German sharp s is one example.
148 .SH SEE ALSO
149 .BR isalpha (3),
150 .BR newlocale (3),
151 .BR setlocale (3),
152 .BR uselocale (3),
153 .BR towlower (3),
154 .BR towupper (3),
155 .BR locale (7)
156 .SH COLOPHON
157 This page is part of release 3.79 of the Linux
158 .I man-pages
159 project.
160 A description of the project,
161 information about reporting bugs,
162 and the latest version of this page,
163 can be found at
164 \%http://www.kernel.org/doc/man\-pages/.