xref: /freebsd/lib/libc/locale/ispunct.3 (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
1.\" Copyright (c) 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the American National Standards Committee X3, on Information
6.\" Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.Dd December 19, 2022
33.Dt ISPUNCT 3
34.Os
35.Sh NAME
36.Nm ispunct ,
37.Nm ispunct_l
38.Nd punctuation character test
39.Sh LIBRARY
40.Lb libc
41.Sh SYNOPSIS
42.In ctype.h
43.Ft int
44.Fn ispunct "int c"
45.Ft int
46.Fn ispunct_l "int c" "locale_t loc"
47.Sh DESCRIPTION
48The
49.Fn ispunct
50and
51.Fn ispunct_l
52functions test for any printing character except for space
53.Pq Ql "\ "
54or a
55character for which
56.Xr isalnum 3
57or
58.Xr isalnum_l 3
59is true.
60The value of the argument must be representable as an
61.Vt "unsigned char"
62or the value of
63.Dv EOF .
64.Pp
65In the ASCII character set, this includes the following characters
66(with their numeric values shown in octal):
67.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
68.It "\&041\ ``!''" Ta "042\ ``""''" Ta "043\ ``#''" Ta "044\ ``$''" Ta "045\ ``%''"
69.It "\&046\ ``&''" Ta "047\ ``'''" Ta "050\ ``(''" Ta "051\ ``)''" Ta "052\ ``*''"
70.It "\&053\ ``+''" Ta "054\ ``,''" Ta "055\ ``-''" Ta "056\ ``.''" Ta "057\ ``/''"
71.It "\&072\ ``:''" Ta "073\ ``;''" Ta "074\ ``<''" Ta "075\ ``=''" Ta "076\ ``>''"
72.It "\&077\ ``?''" Ta "100\ ``@''" Ta "133\ ``[''" Ta "134\ ``\e\|''" Ta "135\ ``]''"
73.It "\&136\ ``^''" Ta "137\ ``_''" Ta "140\ ```''" Ta "173\ ``{''" Ta "174\ ``|''"
74.It "\&175\ ``}''" Ta "176\ ``~''" Ta \& Ta \& Ta \&
75.El
76.Pp
77The
78.Fn ispunct_l
79function takes an explicit locale argument, whereas the
80.Fn ispunct
81function uses the current global or per-thread locale.
82.Sh RETURN VALUES
83The
84.Fn ispunct
85and
86.Fn ispunct_l
87functions return zero if the character tests false and
88return non-zero if the character tests true.
89.Sh COMPATIBILITY
90The
91.Bx 4.4
92extension of accepting arguments outside of the range of the
93.Vt "unsigned char"
94type in locales with large character sets is considered obsolete
95and may not be supported in future releases.
96The
97.Fn iswpunct
98or
99.Fn iswpunct_l
100function should be used instead.
101.Sh SEE ALSO
102.Xr ctype 3 ,
103.Xr ctype_l 3 ,
104.Xr iswpunct 3 ,
105.Xr iswpunct_l 3 ,
106.Xr xlocale 3 ,
107.Xr ascii 7
108.Sh STANDARDS
109The
110.Fn ispunct
111function conforms to
112.St -isoC .
113The
114.Fn ispunct_l
115function conforms to
116.St -p1003.1-2008 .
117.Sh HISTORY
118The
119.Fn ispunct
120function first appeared in
121.At v7 .
122