diff options
author | 2017-09-05 03:16:13 +0000 | |
---|---|---|
committer | 2017-09-05 03:16:13 +0000 | |
commit | 3a628b46e7aaa520a6215eccabf31d313c2e7de0 (patch) | |
tree | c6543ac3a194244f09c381abe688fa69e6c8d49a /lib/libc/gen | |
parent | Add additional errno values required by POSIX. (diff) | |
download | wireguard-openbsd-3a628b46e7aaa520a6215eccabf31d313c2e7de0.tar.xz wireguard-openbsd-3a628b46e7aaa520a6215eccabf31d313c2e7de0.zip |
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')
-rw-r--r-- | lib/libc/gen/isalnum.3 | 55 | ||||
-rw-r--r-- | lib/libc/gen/isalpha.3 | 73 | ||||
-rw-r--r-- | lib/libc/gen/isblank.3 | 58 | ||||
-rw-r--r-- | lib/libc/gen/iscntrl.3 | 52 | ||||
-rw-r--r-- | lib/libc/gen/isdigit.3 | 47 | ||||
-rw-r--r-- | lib/libc/gen/isgraph.3 | 60 | ||||
-rw-r--r-- | lib/libc/gen/islower.3 | 65 | ||||
-rw-r--r-- | lib/libc/gen/isprint.3 | 57 | ||||
-rw-r--r-- | lib/libc/gen/ispunct.3 | 61 | ||||
-rw-r--r-- | lib/libc/gen/isspace.3 | 61 | ||||
-rw-r--r-- | lib/libc/gen/isupper.3 | 63 | ||||
-rw-r--r-- | lib/libc/gen/isxdigit.3 | 56 | ||||
-rw-r--r-- | lib/libc/gen/tolower.3 | 66 | ||||
-rw-r--r-- | lib/libc/gen/toupper.3 | 66 |
14 files changed, 623 insertions, 217 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 diff --git a/lib/libc/gen/isalpha.3 b/lib/libc/gen/isalpha.3 index 041c69dd532..db12e59ae8b 100644 --- a/lib/libc/gen/isalpha.3 +++ b/lib/libc/gen/isalpha.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: isalpha.3,v 1.12 2013/07/18 10:14:48 schwarze Exp $ +.\" $OpenBSD: isalpha.3,v 1.13 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,44 +32,53 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: July 18 2013 $ +.Dd $Mdocdate: September 5 2017 $ .Dt ISALPHA 3 .Os .Sh NAME -.Nm isalpha -.Nd alphabetic character test +.Nm isalpha , +.Nm isalpha_l +.Nd alphabetic single-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn isalpha "int c" +.Ft int +.Fn isalpha_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn isalpha -function tests for any character for which -.Xr isupper 3 -or -.Xr islower 3 -is true and -.\" , or any of an implementation-defined set of characters -for which none of +and +.Fn isalpha_l +functions test whether +.Fa c +represents a letter. +.Pp +In the C locale, the complete list of alphabetic characters +is A\(enZ and a\(enz. +.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 +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 , +but they never return non-zero for any character for which .Xr iscntrl 3 , .Xr isdigit 3 , .Xr ispunct 3 , or .Xr isspace 3 is true. -In the C locale, -.Fn isalpha -returns true only for the characters for which -.Xr isupper 3 -or -.Xr islower 3 -is true. -.Sh RETURN VALUES -The -.Fn isalpha -function returns zero if the character tests false or -non-zero if the character tests true. .Sh SEE ALSO .Xr isalnum 3 , .Xr isascii 3 , @@ -81,6 +91,7 @@ non-zero if the character tests true. .Xr ispunct 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswalpha 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -91,15 +102,23 @@ non-zero if the character tests true. The .Fn isalpha function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn isalpha_l +to +.St -p1003.1-2008 . .Sh HISTORY The .Fn isalpha function first appeared in -.At v7 . +.At v7 , +and +.Fn isalpha_l +has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Fn isalpha +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/isblank.3 b/lib/libc/gen/isblank.3 index 553fbe79f90..1402b9a96e0 100644 --- a/lib/libc/gen/isblank.3 +++ b/lib/libc/gen/isblank.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: isblank.3,v 1.12 2015/06/23 15:31:02 bentley Exp $ +.\" $OpenBSD: isblank.3,v 1.13 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,21 +32,26 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: June 23 2015 $ +.Dd $Mdocdate: September 5 2017 $ .Dt ISBLANK 3 .Os .Sh NAME -.Nm isblank -.Nd blank-space character test +.Nm isblank , +.Nm isblank_l +.Nd blank-space single-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn isblank "int c" +.Ft int +.Fn isblank_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn isblank -function tests for the standard blank-space characters. -The standard blank-space characters are the following: +and +.Fn isblank_l +functions test for blank-space characters. +In the C locale, the complete list of blank-space characters is: .Pp .Bl -tag -width xxxxx -offset indent -compact .It Sq \0 @@ -54,14 +60,22 @@ Space character. Horizontal tab. .El .Pp -In the C locale, -.Fn isblank -returns true only for the standard blank-space characters. +.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 isblank -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 isblank +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -74,6 +88,7 @@ non-zero if the character tests true. .Xr ispunct 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswblank 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -84,10 +99,23 @@ non-zero if the character tests true. The .Fn isblank function conforms to -.St -isoC-99 . -.Sh CAVEATS -The argument to +.St -isoC-99 , +and +.Fn isblank_l +to +.St -p1003.1-2008 . +.Sh HISTORY +The .Fn isblank +function has been available since +.Bx 4.4 , +and +.Fn isblank_l +since +.Ox 6.2 . +.Sh CAVEATS +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/iscntrl.3 b/lib/libc/gen/iscntrl.3 index 53f261850f4..191c9cc24b6 100644 --- a/lib/libc/gen/iscntrl.3 +++ b/lib/libc/gen/iscntrl.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: iscntrl.3,v 1.11 2013/07/17 05:42:11 schwarze Exp $ +.\" $OpenBSD: iscntrl.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,25 +32,43 @@ .\" 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 ISCNTRL 3 .Os .Sh NAME -.Nm iscntrl -.Nd control character test +.Nm iscntrl , +.Nm iscntrl_l +.Nd control single-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn iscntrl "int c" +.Ft int +.Fn iscntrl_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn iscntrl -function tests for any control character. +and +.Fn iscntrl_l +functions tests for any control character. +.Pp +In the C locale, the complete list of control characters +consists of the characters numbered 0x01\(en0x1f and 0x7f. +.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 iscntrl -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, +results of these functions may differ, and the results of +.Fn iscntrl +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -62,6 +81,7 @@ non-zero if the character tests true. .Xr ispunct 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswcntrl 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -72,15 +92,23 @@ non-zero if the character tests true. The .Fn iscntrl function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn iscntrl_l +to +.St -p1003.1-2008 . .Sh HISTORY The .Fn iscntrl function first appeared in -.At v7 . +.At v7 , +and +.Fn iscntrl_l +has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Fn iscntrl +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/isdigit.3 b/lib/libc/gen/isdigit.3 index d7cfa1712df..0a3c278e1a6 100644 --- a/lib/libc/gen/isdigit.3 +++ b/lib/libc/gen/isdigit.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: isdigit.3,v 1.11 2013/07/17 05:42:11 schwarze Exp $ +.\" $OpenBSD: isdigit.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,25 +32,38 @@ .\" 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 ISDIGIT 3 .Os .Sh NAME -.Nm isdigit -.Nd decimal-digit character test +.Nm isdigit , +.Nm isdigit_l +.Nd decimal-digit single-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn isdigit "int c" +.Ft int +.Fn isdigit_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn isdigit -function tests for any decimal-digit character. +and +.Fn isdigit_l +functions test for any decimal-digit character. +The complete list of decimal digits is 0 and 1\(en9, in any locale. .Sh RETURN VALUES -The -.Fn isdigit -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, +different +.Fa c +arguments may correspond to the digits, and the results of +.Fn isdigit +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -62,6 +76,7 @@ non-zero if the character tests true. .Xr ispunct 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswdigit 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -72,15 +87,23 @@ non-zero if the character tests true. The .Fn isdigit function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn isdigit_l +to +.St -p1003.1-2008 . .Sh HISTORY The .Fn isdigit function first appeared in -.At v7 . +.At v7 , +and +.Fn isdigit_l +has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Fn isdigit +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/isgraph.3 b/lib/libc/gen/isgraph.3 index fab5db54ccc..e27a6257d05 100644 --- a/lib/libc/gen/isgraph.3 +++ b/lib/libc/gen/isgraph.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: isgraph.3,v 1.11 2013/07/06 17:31:20 jmc Exp $ +.\" $OpenBSD: isgraph.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,26 +32,49 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: July 6 2013 $ +.Dd $Mdocdate: September 5 2017 $ .Dt ISGRAPH 3 .Os .Sh NAME -.Nm isgraph -.Nd printing character test (space character exclusive) +.Nm isgraph , +.Nm isgraph_l +.Nd printing single-byte character test (space character exclusive) .Sh SYNOPSIS .In ctype.h .Ft int .Fn isgraph "int c" +.Ft int +.Fn isgraph_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn isgraph -function tests for any printing character except space +and +.Fn isgraph_l +functions tests for any printing character except space .Pq Sq \ \& . +.Pp +In the C locale, the complete list of printing characters +consists of the characters numbered 0x21\(en0x7e, which is +the union of the characters for which +.Xr isalnum 3 +or +.Xr ispunct 3 +is true. +.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 isgraph -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, +results of these functions may differ, and the results of +.Fn isgraph +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -63,6 +87,7 @@ non-zero if the character tests true. .Xr ispunct 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswgraph 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -73,10 +98,23 @@ non-zero if the character tests true. The .Fn isgraph function conforms to -.St -ansiC . -.Sh CAVEATS -The argument to +.St -ansiC , +and +.Fn isgraph_l +to +.St -p1003.1-2008 . +.Sh HISTORY +The .Fn isgraph +function first appeared in +.At III , +and +.Fn isgraph_l +has been available since +.Ox 6.2 . +.Sh CAVEATS +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/islower.3 b/lib/libc/gen/islower.3 index c5194f0d55c..59338613edc 100644 --- a/lib/libc/gen/islower.3 +++ b/lib/libc/gen/islower.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: islower.3,v 1.12 2013/07/17 05:42:11 schwarze Exp $ +.\" $OpenBSD: islower.3,v 1.13 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,37 +32,52 @@ .\" 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 ISLOWER 3 .Os .Sh NAME -.Nm islower -.Nd lower-case character test +.Nm islower , +.Nm islower_l +.Nd lower-case single-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn islower "int c" +.Ft int +.Fn islower_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn islower -function tests for any lower-case letter -.\" or any of an -.\" implementation-defined set of characters -for which none of +and +.Fn islower_l +functions test whether +.Fa c +represents a lower-case letter. +.Pp +In the C locale, the complete list of lower-case letters is a\(enz. +.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 +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 islower +may depend on the +.Ev LC_CTYPE +.Xr locale 1 , +but they never return non-zero for any character for which .Xr iscntrl 3 , .Xr isdigit 3 , .Xr ispunct 3 , or .Xr isspace 3 is true. -In the C locale, -.Fn islower -returns true only for the characters defined as lower-case letters. -.Sh RETURN VALUES -The -.Fn islower -function returns zero if the character tests false or -non-zero if the character tests true. .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -74,6 +90,7 @@ non-zero if the character tests true. .Xr ispunct 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswlower 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -84,15 +101,23 @@ non-zero if the character tests true. The .Fn islower function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn islower_l +to +.St -p1003.1-2008 . .Sh HISTORY The .Fn islower function first appeared in -.At v7 . +.At v7 , +AND +.Fn islower_l +has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Fn islower +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/isprint.3 b/lib/libc/gen/isprint.3 index 46f0b1fb4c1..78562fd99de 100644 --- a/lib/libc/gen/isprint.3 +++ b/lib/libc/gen/isprint.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: isprint.3,v 1.11 2013/07/17 05:42:11 schwarze Exp $ +.\" $OpenBSD: isprint.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,26 +32,49 @@ .\" 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 ISPRINT 3 .Os .Sh NAME -.Nm isprint -.Nd printing character test (space character inclusive) +.Nm isprint , +.Nm isprint_l +.Nd printing single-byte character test (space character inclusive) .Sh SYNOPSIS .In ctype.h .Ft int .Fn isprint "int c" +.Ft int +.Fn isprint_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn isprint -function tests for any printing character including space +and +.Fn isprint_l +functions test for any printing character including space .Pq Sq \ \& . +.Pp +In the C locale, the complete list of printing characters +consists of the characters numbered 0x20\(en0x7e, which is +the union of the characters for which +.Xr isalnum 3 +or +.Xr ispunct 3 +is true, and the space character. +.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 isprint -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, +results of these functions may differ, and the results of +.Fn isprint +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -63,6 +87,7 @@ non-zero if the character tests true. .Xr ispunct 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswprint 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -73,15 +98,23 @@ non-zero if the character tests true. The .Fn isprint function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn isprint_l +to +.St -p1003.1-2008 . .Sh HISTORY The .Fn isprint function first appeared in -.At v7 . +.At v7 , +and +.Fn isprint_l +has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Fn isprint +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/ispunct.3 b/lib/libc/gen/ispunct.3 index e41059c21c7..16c3af0a253 100644 --- a/lib/libc/gen/ispunct.3 +++ b/lib/libc/gen/ispunct.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: ispunct.3,v 1.11 2013/07/17 05:42:11 schwarze Exp $ +.\" $OpenBSD: ispunct.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,29 +32,50 @@ .\" 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 ISPUNCT 3 .Os .Sh NAME -.Nm ispunct -.Nd punctuation character test +.Nm ispunct , +.Nm ispunct_l +.Nd punctuation single-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn ispunct "int c" +.Ft int +.Fn ispunct_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn ispunct -function tests for any printing character except space -.Pq Sq \ \& -or a character for which +and +.Fn ispunct_l +test for any punctuation characters. +.Pp +In the C locale, the complete list of punctuation characters is: +.Pp +.Dl !\(dq#$%&\(aq()*+,\-./:;<=>?@[\e]\(ha_\(ga{|}\(ti +.Pp +These are all characters for which +.Xr isgraph 3 +is true but .Xr isalnum 3 -is true. +is not. +.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 ispunct -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, +results of these functions may differ, and the results of +.Fn ispunct +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -66,6 +88,7 @@ non-zero if the character tests true. .Xr isprint 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswpunct 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -76,15 +99,23 @@ non-zero if the character tests true. The .Fn ispunct function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn ispunct_l +to +.St -p1003.1-2008 . .Sh HISTORY The .Fn ispunct function first appeared in -.At v7 . +.At v7 , +and +.Fn ispunct_l +has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Fn ispunct +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/isspace.3 b/lib/libc/gen/isspace.3 index a2e2fa2dba1..1cd7b67eed8 100644 --- a/lib/libc/gen/isspace.3 +++ b/lib/libc/gen/isspace.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: isspace.3,v 1.13 2013/07/17 05:42:11 schwarze Exp $ +.\" $OpenBSD: isspace.3,v 1.14 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,26 +32,27 @@ .\" 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 ISSPACE 3 .Os .Sh NAME -.Nm isspace -.Nd whitespace character test +.Nm isspace , +.Nm isspace_l +.Nd whitespace single-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn isspace "int c" +.Ft int +.Fn isspace_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn isspace -function tests for the standard whitespace characters -.\" or for any -.\" of an implementation-defined set of characters -for which -.Xr isalnum 3 -is false. -The standard whitespace characters are the following: +and +.Fn isspace_l +functions test for whitespace characters. +.Pp +In the C locale, the complete list of whitespace characters is: .Pp .Bl -tag -width xxxxx -offset indent -compact .It Sq \0 @@ -67,14 +69,22 @@ Horizontal tab. And vertical tab. .El .Pp -In the C locale, -.Fn isspace -returns true only for the standard whitespace characters. +.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 isspace -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 isspace +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -87,6 +97,7 @@ non-zero if the character tests true. .Xr isprint 3 , .Xr ispunct 3 , .Xr isupper 3 , +.Xr iswspace 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -97,15 +108,23 @@ non-zero if the character tests true. The .Fn isspace function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn isspace_l +to +.St -p1003.1-2008 . .Sh HISTORY The .Fn isspace function first appeared in -.At v7 . +.At v7 , +and +.Fn isspace_l +has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Fn isspace +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/isupper.3 b/lib/libc/gen/isupper.3 index 364d62eb3fa..d519568ef1f 100644 --- a/lib/libc/gen/isupper.3 +++ b/lib/libc/gen/isupper.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: isupper.3,v 1.13 2013/07/17 05:42:11 schwarze Exp $ +.\" $OpenBSD: isupper.3,v 1.14 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,35 +32,52 @@ .\" 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 ISUPPER 3 .Os .Sh NAME -.Nm isupper -.Nd upper-case character test +.Nm isupper , +.Nm isupper_l +.Nd upper-case singly-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn isupper "int c" +.Ft int +.Fn isupper_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn isupper -function tests for any upper-case letter or any of an -implementation-defined set of characters for which none of +and +.Fn isupper_l +functions test whether +.Fa c +represents an upper-case letter. +.Pp +In the C locale, the complete list of upper-case letters is A\(enZ. +.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 +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 isupper +may depend on the +.Ev LC_CTYPE +.Xr locale 1 , +but they never return non-zero for any character for which .Xr iscntrl 3 , .Xr isdigit 3 , .Xr ispunct 3 , or .Xr isspace 3 is true. -In the C locale, -.Fn isupper -returns true only for the characters defined as upper-case letters. -.Sh RETURN VALUES -The -.Fn isupper -function returns zero if the character tests false or -non-zero if the character tests true. .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -72,6 +90,7 @@ non-zero if the character tests true. .Xr isprint 3 , .Xr ispunct 3 , .Xr isspace 3 , +.Xr iswupper 3 , .Xr isxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , @@ -82,15 +101,23 @@ non-zero if the character tests true. The .Fn isupper function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn isupper_l +to +.St -p1003.1-2008 . .Sh HISTORY The .Fn isupper function first appeared in -.At v7 . +.At v7 , +and +.Fn isupper_l +has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Fn isupper +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/isxdigit.3 b/lib/libc/gen/isxdigit.3 index d40385efa5c..e4775dae606 100644 --- a/lib/libc/gen/isxdigit.3 +++ b/lib/libc/gen/isxdigit.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: isxdigit.3,v 1.10 2013/07/06 17:31:20 jmc Exp $ +.\" $OpenBSD: isxdigit.3,v 1.11 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,25 +32,44 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: July 6 2013 $ +.Dd $Mdocdate: September 5 2017 $ .Dt ISXDIGIT 3 .Os .Sh NAME -.Nm isxdigit -.Nd hexadecimal-digit character test +.Nm isxdigit , +.Nm isxdigit_l +.Nd hexadecimal-digit single-byte character test .Sh SYNOPSIS .In ctype.h .Ft int .Fn isxdigit "int c" +.Ft int +.Fn isxdigit_l "int c" "locale_t locale" .Sh DESCRIPTION The .Fn isxdigit -function tests for any hexadecimal-digit character. +and +.Fn isxdigit_l +functions test for any hexadecimal-digit character. +.Pp +In the C locale, the complete list of hexadecimal digits +is 0, 1\(en9, A\(enF, and a\(enf. +.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 isxdigit -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 isxdigit +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -63,6 +83,7 @@ non-zero if the character tests true. .Xr ispunct 3 , .Xr isspace 3 , .Xr isupper 3 , +.Xr iswxdigit 3 , .Xr stdio 3 , .Xr toascii 3 , .Xr tolower 3 , @@ -72,10 +93,23 @@ non-zero if the character tests true. The .Fn isxdigit function conforms to -.St -ansiC . -.Sh CAVEATS -The argument to +.St -ansiC , +and +.Fn isxdigit_l +to +.St -p1003.1-2008 . +.Sh HISTORY +The .Fn isxdigit +function first appeared in +.At v7 , +and +.Fn isdigit_l +has been available since +.Ox 6.2 . +.Sh CAVEATS +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/tolower.3 b/lib/libc/gen/tolower.3 index a02d395dce5..2f6088b7177 100644 --- a/lib/libc/gen/tolower.3 +++ b/lib/libc/gen/tolower.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: tolower.3,v 1.13 2013/06/05 03:39:22 tedu Exp $ +.\" $OpenBSD: tolower.3,v 1.14 2017/09/05 03:16:13 schwarze Exp $ .\" .\" Copyright (c) 1989, 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,11 +32,12 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: June 5 2013 $ +.Dd $Mdocdate: September 5 2017 $ .Dt TOLOWER 3 .Os .Sh NAME .Nm tolower , +.Nm tolower_l , .Nm _tolower .Nd upper case to lower case letter conversion .Sh SYNOPSIS @@ -43,37 +45,49 @@ .Ft int .Fn tolower "int c" .Ft int +.Fn tolower_l "int c" "locale_t locale" +.Ft int .Fn _tolower "int c" .Sh DESCRIPTION The .Fn tolower -function converts an upper-case letter to the corresponding lower-case +and +.Fn tolower_l +functions convert an upper-case letter to the corresponding lower-case letter. The .Fn _tolower function is identical to .Fn tolower except that -.Ar c +.Fa c must be an upper-case letter. +.Pp +.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 If the argument to the .Fn tolower +or +.Fn tolower_l function is an upper-case letter, the corresponding lower-case letter is returned if there is one; otherwise the argument is returned unchanged. If the argument to the .Fn _tolower function is an upper-case letter, the corresponding lower-case letter is returned; otherwise the output is undefined. -.\" In the -.\" .Em ``C'' -.\" locale, -.\" .Fn tolower -.\" maps only the characters for which -.\" .Xr isupper -.\" is true to the corresponding characters for which -.\" .Xr islower -.\" is true. +.Sh ENVIRONMENT +On systems supporting non-ASCII single-byte character encodings, +the results of +.Fn tolower +and +.Fn _tolower +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -91,6 +105,7 @@ is returned; otherwise the output is undefined. .Xr stdio 3 , .Xr toascii 3 , .Xr toupper 3 , +.Xr towlower 3 , .Xr ascii 7 .Sh STANDARDS The @@ -98,10 +113,29 @@ The and .Fn _tolower functions conform to -.St -ansiC . +.St -ansiC , +and +.Fn tolower_l +to +.St -p1003.1-2008 . +.Sh HISTORY +The +.Fn tolower +function first appeared in +.At v7 +and acquired the current semantics in +.At III , +where +.Fn _tolower +first appeared. +.Pp +The +.Fn tolower_l +function has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Nm +The argument +.Fa c must be .Dv EOF or representable as an diff --git a/lib/libc/gen/toupper.3 b/lib/libc/gen/toupper.3 index a2aee335926..6d5c16f39d6 100644 --- a/lib/libc/gen/toupper.3 +++ b/lib/libc/gen/toupper.3 @@ -1,6 +1,7 @@ -.\" $OpenBSD: toupper.3,v 1.15 2013/06/05 03:39:22 tedu Exp $ +.\" $OpenBSD: toupper.3,v 1.16 2017/09/05 03:16:13 schwarze Exp $ .\" .\" Copyright (c) 1989, 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,11 +32,12 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: June 5 2013 $ +.Dd $Mdocdate: September 5 2017 $ .Dt TOUPPER 3 .Os .Sh NAME .Nm toupper , +.Nm toupper_l , .Nm _toupper .Nd lower case to upper case letter conversion .Sh SYNOPSIS @@ -43,37 +45,49 @@ .Ft int .Fn toupper "int c" .Ft int +.Fn toupper_l "int c" "locale_t locale" +.Ft int .Fn _toupper "int c" .Sh DESCRIPTION The .Fn toupper -function converts a lower-case letter to the corresponding +and +.Fn toupper_l +functions convert a lower-case letter to the corresponding upper-case letter. The .Fn _toupper function is identical to .Fn toupper except that -.Ar c +.Fa c must be a lower-case letter. +.Pp +.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 If the argument to the .Fn toupper +or +.Fn toupper_l function is a lower-case letter, the corresponding upper-case letter is returned if there is one; otherwise the argument is returned unchanged. If the argument to the .Fn _toupper function is a lower-case letter, the corresponding upper-case letter is returned; otherwise the output is undefined. -.\" In the -.\" .Em ``C'' -.\" locale, -.\" .Fn toupper -.\" maps only the characters for which -.\" .Xr islower -.\" is true to the corresponding characters for which -.\" .Xr isupper -.\" is true. +.Sh ENVIRONMENT +On systems supporting non-ASCII single-byte character encodings, +the results of +.Fn toupper +and +.Fn _toupper +may depend on the +.Ev LC_CTYPE +.Xr locale 1 . .Sh SEE ALSO .Xr isalnum 3 , .Xr isalpha 3 , @@ -91,15 +105,35 @@ is returned; otherwise the output is undefined. .Xr stdio 3 , .Xr toascii 3 , .Xr tolower 3 , +.Xr towupper 3 , .Xr ascii 7 .Sh STANDARDS The .Fn toupper function conforms to -.St -ansiC . +.St -ansiC , +and +.Fn toupper_l +to +.St -p1003.1-2008 . +.Sh HISTORY +The +.Fn toupper +function first appeared in +.At v7 +and acquired the current semantics in +.At III , +where +.Fn _toupper +first appeared. +.Pp +The +.Fn toupper_l +function has been available since +.Ox 6.2 . .Sh CAVEATS -The argument to -.Nm +The argument +.Fa c must be .Dv EOF or representable as an |