summaryrefslogtreecommitdiff
path: root/lib/libc/gen/isalnum.3
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-09-05 03:16:15 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-09-05 03:16:15 +0000
commit9a429b0d2263bff179436e11aedd8607a30e445d (patch)
tree2e10dcca448d30a69a66b85e910591c02281a79d /lib/libc/gen/isalnum.3
parent5fa20654190f944a2de98b5be63bb85423ae44b2 (diff)
New POSIX xlocale implementation written from scratch.
Complete in the sense that all POSIX *locale(3) and *_l(3) functions are included, but in OpenBSD, we of course only really care about LC_CTYPE and we only support ASCII and UTF-8. With important help from kettenis@, guenther@, and jca@. Repeated testing in ports bulk builds by naddy@. Additional testing by jca@, sebastia@, dcoppa@, and others. OK kettenis@ dcoppa@, and guenther@ on an earlier version. Riding guenther@'s libc/librthread major bump.
Diffstat (limited to 'lib/libc/gen/isalnum.3')
-rw-r--r--lib/libc/gen/isalnum.355
1 files changed, 44 insertions, 11 deletions
diff --git a/lib/libc/gen/isalnum.3 b/lib/libc/gen/isalnum.3
index d272be2d229..436cdafd2c1 100644
--- a/lib/libc/gen/isalnum.3
+++ b/lib/libc/gen/isalnum.3
@@ -1,6 +1,7 @@
-.\" $OpenBSD: isalnum.3,v 1.11 2013/07/17 05:42:11 schwarze Exp $
+.\" $OpenBSD: isalnum.3,v 1.12 2017/09/05 03:16:13 schwarze Exp $
.\"
.\" Copyright (c) 1991 The Regents of the University of California.
+.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
@@ -31,16 +32,19 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: July 17 2013 $
+.Dd $Mdocdate: September 5 2017 $
.Dt ISALNUM 3
.Os
.Sh NAME
-.Nm isalnum
-.Nd alphanumeric character test
+.Nm isalnum ,
+.Nm isalnum_l
+.Nd alphanumeric single-byte character test
.Sh SYNOPSIS
.In ctype.h
.Ft int
.Fn isalnum "int c"
+.Ft int
+.Fn isalnum_l "int c" "locale_t locale"
.Sh DESCRIPTION
The
.Fn isalnum
@@ -48,12 +52,32 @@ function tests for any character for which
.Xr isalpha 3
or
.Xr isdigit 3
+is true, and
+.Fn isalnum_l
+tests for any character for which
+.Xr isalpha_l 3
+or
+.Xr isdigit_l 3
is true.
+.Pp
+In the C locale, the complete list of alphanumeric characters
+is A\(enZ, a\(enz, 0, and 1\(en9.
+.Ox
+always uses the C locale for these functions,
+ignoring the global locale, the thread-specific locale, and the
+.Fa locale
+argument.
.Sh RETURN VALUES
-The
-.Fn isalnum
-function returns zero if the character tests false or
+These functions return zero if the character tests false or
non-zero if the character tests true.
+.Sh ENVIRONMENT
+On systems supporting non-ASCII single-byte character encodings,
+these functions may return non-zero for additional characters,
+and the results of
+.Fn isalnum
+may depend on the
+.Ev LC_CTYPE
+.Xr locale 1 .
.Sh SEE ALSO
.Xr isalpha 3 ,
.Xr isascii 3 ,
@@ -66,6 +90,7 @@ non-zero if the character tests true.
.Xr ispunct 3 ,
.Xr isspace 3 ,
.Xr isupper 3 ,
+.Xr iswalnum 3 ,
.Xr isxdigit 3 ,
.Xr stdio 3 ,
.Xr toascii 3 ,
@@ -76,15 +101,23 @@ non-zero if the character tests true.
The
.Fn isalnum
function conforms to
-.St -ansiC .
+.St -ansiC ,
+and
+.Fn isalnum_l
+to
+.St -p1003.1-2008 .
.Sh HISTORY
The
.Fn isalnum
function first appeared in
-.At v7 .
+.At v7 ,
+and
+.Fn isalnum_l
+has been available since
+.Ox 6.2 .
.Sh CAVEATS
-The argument to
-.Fn isalnum
+The argument
+.Fa c
must be
.Dv EOF
or representable as an