xref: /freebsd/lib/libc/locale/ispunct.3 (revision f374ba41f55c1a127303d92d830dd58eef2f5243)
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.\"	@(#)ispunct.3	8.1 (Berkeley) 6/4/93
33.\" $FreeBSD$
34.\"
35.Dd December 19, 2022
36.Dt ISPUNCT 3
37.Os
38.Sh NAME
39.Nm ispunct ,
40.Nm ispunct_l
41.Nd punctuation character test
42.Sh LIBRARY
43.Lb libc
44.Sh SYNOPSIS
45.In ctype.h
46.Ft int
47.Fn ispunct "int c"
48.Ft int
49.Fn ispunct_l "int c" "locale_t loc"
50.Sh DESCRIPTION
51The
52.Fn ispunct
53and
54.Fn ispunct_l
55functions test for any printing character except for space
56.Pq Ql "\ "
57or a
58character for which
59.Xr isalnum 3
60or
61.Xr isalnum_l 3
62is true.
63The value of the argument must be representable as an
64.Vt "unsigned char"
65or the value of
66.Dv EOF .
67.Pp
68In the ASCII character set, this includes the following characters
69(with their numeric values shown in octal):
70.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
71.It "\&041\ ``!''" Ta "042\ ``""''" Ta "043\ ``#''" Ta "044\ ``$''" Ta "045\ ``%''"
72.It "\&046\ ``&''" Ta "047\ ``'''" Ta "050\ ``(''" Ta "051\ ``)''" Ta "052\ ``*''"
73.It "\&053\ ``+''" Ta "054\ ``,''" Ta "055\ ``-''" Ta "056\ ``.''" Ta "057\ ``/''"
74.It "\&072\ ``:''" Ta "073\ ``;''" Ta "074\ ``<''" Ta "075\ ``=''" Ta "076\ ``>''"
75.It "\&077\ ``?''" Ta "100\ ``@''" Ta "133\ ``[''" Ta "134\ ``\e\|''" Ta "135\ ``]''"
76.It "\&136\ ``^''" Ta "137\ ``_''" Ta "140\ ```''" Ta "173\ ``{''" Ta "174\ ``|''"
77.It "\&175\ ``}''" Ta "176\ ``~''" Ta \& Ta \& Ta \&
78.El
79.Pp
80The
81.Fn ispunct_l
82function takes an explicit locale argument, whereas the
83.Fn ispunct
84function uses the current global or per-thread locale.
85.Sh RETURN VALUES
86The
87.Fn ispunct
88and
89.Fn ispunct_l
90functions return zero if the character tests false and
91return non-zero if the character tests true.
92.Sh COMPATIBILITY
93The
94.Bx 4.4
95extension of accepting arguments outside of the range of the
96.Vt "unsigned char"
97type in locales with large character sets is considered obsolete
98and may not be supported in future releases.
99The
100.Fn iswpunct
101or
102.Fn iswpunct_l
103function should be used instead.
104.Sh SEE ALSO
105.Xr ctype 3 ,
106.Xr ctype_l 3 ,
107.Xr iswpunct 3 ,
108.Xr iswpunct_l 3 ,
109.Xr xlocale 3 ,
110.Xr ascii 7
111.Sh STANDARDS
112The
113.Fn ispunct
114function conforms to
115.St -isoC .
116The
117.Fn ispunct_l
118function conforms to
119.St -p1003.1-2008 .
120.Sh HISTORY
121The
122.Fn ispunct
123function first appeared in
124.At v7 .
125