1.\"	$OpenBSD: toupper.3,v 1.16 2017/09/05 03:16:13 schwarze Exp $
2.\"
3.\" Copyright (c) 1989, 1991 The Regents of the University of California.
4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to Berkeley by
8.\" the American National Standards Committee X3, on Information
9.\" Processing Systems.
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
14.\" 1. Redistributions of source code must retain the above copyright
15.\"    notice, this list of conditions and the following disclaimer.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\"    notice, this list of conditions and the following disclaimer in the
18.\"    documentation and/or other materials provided with the distribution.
19.\" 3. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.Dd $Mdocdate: September 5 2017 $
36.Dt TOUPPER 3
37.Os
38.Sh NAME
39.Nm toupper ,
40.Nm toupper_l ,
41.Nm _toupper
42.Nd lower case to upper case letter conversion
43.Sh SYNOPSIS
44.In ctype.h
45.Ft int
46.Fn toupper "int c"
47.Ft int
48.Fn toupper_l "int c" "locale_t locale"
49.Ft int
50.Fn _toupper "int c"
51.Sh DESCRIPTION
52The
53.Fn toupper
54and
55.Fn toupper_l
56functions convert a lower-case letter to the corresponding
57upper-case letter.
58The
59.Fn _toupper
60function is identical to
61.Fn toupper
62except that
63.Fa c
64must be a lower-case letter.
65.Pp
66.Ox
67always uses the C locale for these functions,
68ignoring the global locale, the thread-specific locale, and the
69.Fa locale
70argument.
71.Sh RETURN VALUES
72If the argument to the
73.Fn toupper
74or
75.Fn toupper_l
76function is a lower-case letter, the corresponding upper-case letter
77is returned if there is one; otherwise the argument is returned unchanged.
78If the argument to the
79.Fn _toupper
80function is a lower-case letter, the corresponding upper-case letter
81is returned; otherwise the output is undefined.
82.Sh ENVIRONMENT
83On systems supporting non-ASCII single-byte character encodings,
84the results of
85.Fn toupper
86and
87.Fn _toupper
88may depend on the
89.Ev LC_CTYPE
90.Xr locale 1 .
91.Sh SEE ALSO
92.Xr isalnum 3 ,
93.Xr isalpha 3 ,
94.Xr isascii 3 ,
95.Xr isblank 3 ,
96.Xr iscntrl 3 ,
97.Xr isdigit 3 ,
98.Xr isgraph 3 ,
99.Xr islower 3 ,
100.Xr isprint 3 ,
101.Xr ispunct 3 ,
102.Xr isspace 3 ,
103.Xr isupper 3 ,
104.Xr isxdigit 3 ,
105.Xr stdio 3 ,
106.Xr toascii 3 ,
107.Xr tolower 3 ,
108.Xr towupper 3 ,
109.Xr ascii 7
110.Sh STANDARDS
111The
112.Fn toupper
113function conforms to
114.St -ansiC ,
115and
116.Fn toupper_l
117to
118.St -p1003.1-2008 .
119.Sh HISTORY
120The
121.Fn toupper
122function first appeared in
123.At v7
124and acquired the current semantics in
125.At III ,
126where
127.Fn _toupper
128first appeared.
129.Pp
130The
131.Fn toupper_l
132function has been available since
133.Ox 6.2 .
134.Sh CAVEATS
135The argument
136.Fa c
137must be
138.Dv EOF
139or representable as an
140.Li unsigned char ;
141otherwise, the result is undefined.
142