diff options
author | Garrett D'Amore <garrett@damore.org> | 2014-05-18 20:08:38 -0700 |
---|---|---|
committer | Garrett D'Amore <garrett@damore.org> | 2014-07-11 20:35:28 -0700 |
commit | 2d08521bd15501c8370ba2153b9cca4f094979d0 (patch) | |
tree | cd843bc37fe795bc7bbdd04b5b13b0310a2d6be1 /usr/src/man/man3c | |
parent | 961519c5bffd5ec670890fc3596d6c4ff1cefea0 (diff) | |
download | illumos-joyent-2d08521bd15501c8370ba2153b9cca4f094979d0.tar.gz |
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/man/man3c')
36 files changed, 2049 insertions, 1052 deletions
diff --git a/usr/src/man/man3c/Makefile b/usr/src/man/man3c/Makefile index f3b6f18a7f..7e6a965ce8 100644 --- a/usr/src/man/man3c/Makefile +++ b/usr/src/man/man3c/Makefile @@ -13,6 +13,7 @@ # Copyright 2011, Richard Lowe # Copyright 2013 Nexenta Systems, Inc. All rights reserved. # Copyright 2013, OmniTI Computer Consulting, Inc. All rights reserved. +# Copyright 2014 Garrett D'Amore <garrett@damore.org> # include $(SRC)/Makefile.master @@ -239,6 +240,7 @@ MANFILES= __fbufsize.3c \ mutex_init.3c \ nanosleep.3c \ ndbm.3c \ + newlocale.3c \ nl_langinfo.3c \ offsetof.3c \ opendir.3c \ @@ -410,6 +412,7 @@ MANFILES= __fbufsize.3c \ str2sig.3c \ strcoll.3c \ strerror.3c \ + strfmon.3c \ strftime.3c \ string.3c \ string_to_decimal.3c \ @@ -461,6 +464,8 @@ MANFILES= __fbufsize.3c \ toascii.3c \ tolower.3c \ toupper.3c \ + towlower.3c \ + towupper.3c \ truncate.3c \ tsearch.3c \ ttyname.3c \ @@ -475,6 +480,7 @@ MANFILES= __fbufsize.3c \ ungetwc.3c \ unlockpt.3c \ unsetenv.3c \ + uselocale.3c \ usleep.3c \ vfwprintf.3c \ vlfmt.3c \ @@ -499,6 +505,7 @@ MANFILES= __fbufsize.3c \ wcsxfrm.3c \ wctob.3c \ wctomb.3c \ + wctrans.3c \ wctype.3c \ wcwidth.3c \ wmemchr.3c \ @@ -654,6 +661,7 @@ MANLINKS= FD_CLR.3c \ bcopy.3c \ bind_textdomain_codeset.3c \ bindtextdomain.3c \ + btowc_l.3c \ bzero.3c \ calloc.3c \ catclose.3c \ @@ -698,6 +706,7 @@ MANLINKS= FD_CLR.3c \ door_unbind.3c \ double_to_decimal.3c \ dup3.3c \ + duplocale.3c \ edata.3c \ endgrent.3c \ endnetgrent.3c \ @@ -725,6 +734,7 @@ MANLINKS= FD_CLR.3c \ fgets.3c \ fgetspent.3c \ fgetspent_r.3c \ + fgetwc_l.3c \ fgetws.3c \ file_to_decimal.3c \ fileno.3c \ @@ -738,6 +748,7 @@ MANLINKS= FD_CLR.3c \ fpsetsticky.3c \ fputs.3c \ free.3c \ + freelocale.3c \ fscanf.3c \ fseeko.3c \ fsetattr.3c \ @@ -784,6 +795,8 @@ MANLINKS= FD_CLR.3c \ getvfsfile.3c \ getvfsspec.3c \ getw.3c \ + getwc_l.3c \ + getwchar_l.3c \ getzoneidbyname.3c \ getzonenamebyid.3c \ globfree.3c \ @@ -796,36 +809,71 @@ MANLINKS= FD_CLR.3c \ initstate.3c \ innetgr.3c \ isalnum.3c \ + isalnum_l.3c \ isalpha.3c \ + isalpha_l.3c \ isascii.3c \ isblank.3c \ + isblank_l.3c \ iscntrl.3c \ + iscntrl_l.3c \ isdigit.3c \ + isdigit_l.3c \ isenglish.3c \ isgraph.3c \ + isgraph_l.3c \ isideogram.3c \ islower.3c \ + islower_l.3c \ isnanf.3c \ isnumber.3c \ isphonogram.3c \ isprint.3c \ + isprint_l.3c \ ispunct.3c \ + ispunct_l.3c \ isspace.3c \ + isspace_l.3c \ isspecial.3c \ isupper.3c \ + isupper_l.3c \ iswalnum.3c \ + iswalnum_l.3c \ + iswalpha_l.3c \ iswascii.3c \ iswblank.3c \ + iswblank_l.3c \ iswcntrl.3c \ + iswcntrl_l.3c \ + iswctype_l.3c \ iswdigit.3c \ + iswdigit_l.3c \ iswgraph.3c \ + iswgraph_l.3c \ + iswideogram.3c \ + iswideogram_l.3c \ + iswhexnumber.3c \ + iswhexnumber_l.3c \ iswlower.3c \ + iswlower_l.3c \ + iswnumber.3c \ + iswnumber_l.3c \ + iswphonogram.3c \ + iswphonogram_l.3c \ iswprint.3c \ + iswprint_l.3c \ iswpunct.3c \ + iswpunct_l.3c \ iswspace.3c \ + iswspace_l.3c \ + iswspecial.3c \ + iswspecial_l.3c \ iswupper.3c \ + iswupper_l.3c \ iswxdigit.3c \ + iswxdigit_l.3c \ isxdigit.3c \ + isxdigit_l.3c \ jrand48.3c \ l64a.3c \ labs.3c \ @@ -840,6 +888,16 @@ MANLINKS= FD_CLR.3c \ longjmp.3c \ lrand48.3c \ major.3c \ + mblen_l.3c \ + mbrlen_l.3c \ + mbrtowc_l.3c \ + mbsinit_l.3c \ + mbsnrtowcs.3c \ + mbsnrtowcs_l.3c \ + mbsrtowcs_l.3c \ + mbstowcs.3c \ + mbstowcs_l.3c \ + mbtowc_l.3c \ memalign.3c \ membar_consumer.3c \ membar_enter.3c \ @@ -868,6 +926,7 @@ MANLINKS= FD_CLR.3c \ mutex_lock.3c \ mutex_trylock.3c \ mutex_unlock.3c \ + nl_langinfo_l.3c \ nftw.3c \ ngettext.3c \ nrand48.3c \ @@ -1057,22 +1116,28 @@ MANLINKS= FD_CLR.3c \ stdin.3c \ stdout.3c \ strcasecmp.3c \ + strcasecmp_l.3c \ strcat.3c \ strchr.3c \ strcmp.3c \ + strcoll_l.3c \ strcpy.3c \ strcspn.3c \ strdup.3c \ strerror_r.3c \ + strfmon_l.3c \ + strftime_l.3c \ strlcat.3c \ strlcpy.3c \ strlen.3c \ strncasecmp.3c \ + strncasecmp_l.3c \ strncat.3c \ strncmp.3c \ strncpy.3c \ strnlen.3c \ strpbrk.3c \ + strptime_l.3c \ strrchr.3c \ strsep.3c \ strspn.3c \ @@ -1084,6 +1149,7 @@ MANLINKS= FD_CLR.3c \ strtoll.3c \ strtoull.3c \ strtoumax.3c \ + strxfrm_l.3c \ swapcontext.3c \ swprintf.3c \ swscanf.3c \ @@ -1104,6 +1170,12 @@ MANLINKS= FD_CLR.3c \ timerisset.3c \ timersub.3c \ tmpnam_r.3c \ + tolower_l.3c \ + toupper_l.3c \ + towctrans.3c \ + towctrans_l.3c \ + towlower_l.3c \ + towupper_l.3c \ ttyname_r.3c \ twalk.3c \ tzset.3c \ @@ -1158,9 +1230,11 @@ MANLINKS= FD_CLR.3c \ watoi.3c \ watol.3c \ watoll.3c \ + wcrtomb_l.3c \ wcscat.3c \ wcschr.3c \ wcscmp.3c \ + wcscoll_l.3c \ wcscpy.3c \ wcscspn.3c \ wcsetno.3c \ @@ -1178,6 +1252,12 @@ MANLINKS= FD_CLR.3c \ wcstoull.3c \ wcstoumax.3c \ wcswcs.3c \ + wcswidth_l.3c \ + wctob_l.3c \ + wctomb_l.3c \ + wctrans_l.3c \ + wctype_l.3c \ + wcwidth_l.3c \ windex.3c \ wordfree.3c \ wprintf.3c \ @@ -1342,6 +1422,8 @@ bcmp.3c := LINKSRC = bstring.3c bcopy.3c := LINKSRC = bstring.3c bzero.3c := LINKSRC = bstring.3c +btowc_l.3c := LINKSRC = btowc.3c + catclose.3c := LINKSRC = catopen.3c cfgetospeed.3c := LINKSRC = cfgetispeed.3c @@ -1377,18 +1459,30 @@ localtime_r.3c := LINKSRC = ctime.3c tzset.3c := LINKSRC = ctime.3c isalnum.3c := LINKSRC = ctype.3c +isalnum_l.3c := LINKSRC = ctype.3c isalpha.3c := LINKSRC = ctype.3c +isalpha_l.3c := LINKSRC = ctype.3c isascii.3c := LINKSRC = ctype.3c isblank.3c := LINKSRC = ctype.3c +isblank_l.3c := LINKSRC = ctype.3c iscntrl.3c := LINKSRC = ctype.3c +iscntrl_l.3c := LINKSRC = ctype.3c isdigit.3c := LINKSRC = ctype.3c +isdigit_l.3c := LINKSRC = ctype.3c isgraph.3c := LINKSRC = ctype.3c +isgraph_l.3c := LINKSRC = ctype.3c islower.3c := LINKSRC = ctype.3c +islower_l.3c := LINKSRC = ctype.3c isprint.3c := LINKSRC = ctype.3c +isprint_l.3c := LINKSRC = ctype.3c ispunct.3c := LINKSRC = ctype.3c +ispunct_l.3c := LINKSRC = ctype.3c isspace.3c := LINKSRC = ctype.3c +isspace_l.3c := LINKSRC = ctype.3c isupper.3c := LINKSRC = ctype.3c +isupper_l.3c := LINKSRC = ctype.3c isxdigit.3c := LINKSRC = ctype.3c +isxdigit_l.3c := LINKSRC = ctype.3c decimal_to_double.3c := LINKSRC = decimal_to_floating.3c decimal_to_extended.3c := LINKSRC = decimal_to_floating.3c @@ -1462,6 +1556,8 @@ getchar.3c := LINKSRC = fgetc.3c getchar_unlocked.3c := LINKSRC = fgetc.3c getw.3c := LINKSRC = fgetc.3c +fgetwc_l.3c := LINKSRC = fgetwc.3c + double_to_decimal.3c := LINKSRC = floating_to_decimal.3c extended_to_decimal.3c := LINKSRC = floating_to_decimal.3c quadruple_to_decimal.3c := LINKSRC = floating_to_decimal.3c @@ -1591,6 +1687,10 @@ getvfsany.3c := LINKSRC = getvfsent.3c getvfsfile.3c := LINKSRC = getvfsent.3c getvfsspec.3c := LINKSRC = getvfsent.3c +getwc_l.3c := LINKSRC = getwc.3c + +getwchar_l.3c := LINKSRC = getwchar.3c + fgetws.3c := LINKSRC = getws.3c getzoneidbyname.3c := LINKSRC = getzoneid.3c @@ -1616,17 +1716,41 @@ isnumber.3c := LINKSRC = iswalpha.3c isphonogram.3c := LINKSRC = iswalpha.3c isspecial.3c := LINKSRC = iswalpha.3c iswalnum.3c := LINKSRC = iswalpha.3c +iswalnum_l.3c := LINKSRC = iswalpha.3c +iswalpha_l.3c := LINKSRC = iswalpha.3c iswascii.3c := LINKSRC = iswalpha.3c iswblank.3c := LINKSRC = iswalpha.3c +iswblank_l.3c := LINKSRC = iswalpha.3c iswcntrl.3c := LINKSRC = iswalpha.3c +iswcntrl_l.3c := LINKSRC = iswalpha.3c iswdigit.3c := LINKSRC = iswalpha.3c +iswdigit_l.3c := LINKSRC = iswalpha.3c iswgraph.3c := LINKSRC = iswalpha.3c +iswgraph_l.3c := LINKSRC = iswalpha.3c +iswhexnumber.3c := LINKSRC = iswalpha.3c +iswhexnumber_l.3c := LINKSRC = iswalpha.3c +iswideogram.3c := LINKSRC = iswalpha.3c +iswideogram_l.3c := LINKSRC = iswalpha.3c iswlower.3c := LINKSRC = iswalpha.3c +iswlower_l.3c := LINKSRC = iswalpha.3c +iswnumber.3c := LINKSRC = iswalpha.3c +iswnumber_l.3c := LINKSRC = iswalpha.3c +iswphonogram.3c := LINKSRC = iswalpha.3c +iswphonogram_l.3c := LINKSRC = iswalpha.3c iswprint.3c := LINKSRC = iswalpha.3c +iswprint_l.3c := LINKSRC = iswalpha.3c iswpunct.3c := LINKSRC = iswalpha.3c +iswpunct_l.3c := LINKSRC = iswalpha.3c iswspace.3c := LINKSRC = iswalpha.3c +iswspace_l.3c := LINKSRC = iswalpha.3c +iswspecial.3c := LINKSRC = iswalpha.3c +iswspecial_l.3c := LINKSRC = iswalpha.3c iswupper.3c := LINKSRC = iswalpha.3c +iswupper_l.3c := LINKSRC = iswalpha.3c iswxdigit.3c := LINKSRC = iswalpha.3c +iswxdigit_l.3c := LINKSRC = iswalpha.3c + +iswctype_l.3c := LINKSRC = iswctype.3c ulckpwdf.3c := LINKSRC = lckpwdf.3c @@ -1644,6 +1768,22 @@ memalign.3c := LINKSRC = malloc.3c realloc.3c := LINKSRC = malloc.3c valloc.3c := LINKSRC = malloc.3c +mblen_l.3c := LINKSRC = mblen.3c + +mbrlen_l.3c := LINKSRC = mbrlen.3c + +mbrtowc_l.3c := LINKSRC = mbrtowc.3c + +mbsinit_l.3c := LINKSRC = mbsinit.3c + +mbsnrtowcs.3c := LINKSRC = mbsrtowcs.3c +mbsnrtowcs_l.3c := LINKSRC = mbsrtowcs.3c +mbsrtowcs_l.3c := LINKSRC = mbsrtowcs.3c +mbstowcs.3c := LINKSRC = mbsrtowcs.3c +mbstowcs_l.3c := LINKSRC = mbsrtowcs.3c + +mbtowc_l.3c := LINKSRC = mbtowc.3c + membar_consumer.3c := LINKSRC = membar_ops.3c membar_enter.3c := LINKSRC = membar_ops.3c membar_exit.3c := LINKSRC = membar_ops.3c @@ -1687,6 +1827,11 @@ dbm_nextkey.3c := LINKSRC = ndbm.3c dbm_open.3c := LINKSRC = ndbm.3c dbm_store.3c := LINKSRC = ndbm.3c +duplocale.3c := LINKSRC = newlocale.3c +freelocale.3c := LINKSRC = newlocale.3c + +nl_langinfo_l.3c := LINKSRC = nl_langinfo.3c + fdopendir.3c := LINKSRC = opendir.3c errno.3c := LINKSRC = perror.3c @@ -1938,12 +2083,18 @@ stdout.3c := LINKSRC = stdio.3c sig2str.3c := LINKSRC = str2sig.3c +strcoll_l.3c := LINKSRC = strcoll.3c + strerror_r.3c := LINKSRC = strerror.3c +strfmon_l.3c := LINKSRC = strfmon.3c + ascftime.3c := LINKSRC = strftime.3c cftime.3c := LINKSRC = strftime.3c +strftime_l.3c := LINKSRC = strftime.3c strcasecmp.3c := LINKSRC = string.3c +strcasecmp_l.3c := LINKSRC = string.3c strcat.3c := LINKSRC = string.3c strchr.3c := LINKSRC = string.3c strcmp.3c := LINKSRC = string.3c @@ -1954,6 +2105,7 @@ strlcat.3c := LINKSRC = string.3c strlcpy.3c := LINKSRC = string.3c strlen.3c := LINKSRC = string.3c strncasecmp.3c := LINKSRC = string.3c +strncasecmp_l.3c := LINKSRC = string.3c strncat.3c := LINKSRC = string.3c strncmp.3c := LINKSRC = string.3c strncpy.3c := LINKSRC = string.3c @@ -1969,6 +2121,8 @@ strtok_r.3c := LINKSRC = string.3c file_to_decimal.3c := LINKSRC = string_to_decimal.3c func_to_decimal.3c := LINKSRC = string_to_decimal.3c +strptime_l.3c := LINKSRC = strptime.3c + atof.3c := LINKSRC = strtod.3c strtof.3c := LINKSRC = strtod.3c strtold.3c := LINKSRC = strtod.3c @@ -1983,8 +2137,11 @@ strtoll.3c := LINKSRC = strtol.3c ulltostr.3c := LINKSRC = strtol.3c strtoull.3c := LINKSRC = strtoul.3c + wstostr.3c := LINKSRC = strtows.3c +strxfrm_l.3c := LINKSRC = strxfrm.3c + closelog.3c := LINKSRC = syslog.3c openlog.3c := LINKSRC = syslog.3c setlogmask.3c := LINKSRC = syslog.3c @@ -2010,6 +2167,14 @@ timersub.3c := LINKSRC = timeradd.3c tempnam.3c := LINKSRC = tmpnam.3c tmpnam_r.3c := LINKSRC = tmpnam.3c +tolower_l.3c := LINKSRC = tolower.3c + +toupper_l.3c := LINKSRC = toupper.3c + +towlower_l.3c := LINKSRC = towlower.3c + +towupper_l.3c := LINKSRC = towupper.3c + ftruncate.3c := LINKSRC = truncate.3c tdelete.3c := LINKSRC = tsearch.3c @@ -2056,6 +2221,9 @@ backtrace_symbols.3c := LINKSRC = walkcontext.3c backtrace_symbols_fd.3c := LINKSRC = walkcontext.3c printstack.3c := LINKSRC = walkcontext.3c +wcrtomb_l.3c := LINKSRC = wcrtomb.3c + +wcscoll_l.3c := LINKSRC = wcscoll.3c wscoll.3c := LINKSRC = wcscoll.3c watof.3c := LINKSRC = wcstod.3c @@ -2102,16 +2270,29 @@ wspbrk.3c := LINKSRC = wcstring.3c wsrchr.3c := LINKSRC = wcstring.3c wsspn.3c := LINKSRC = wcstring.3c wstok.3c := LINKSRC = wcstring.3c - -wsxfrm.3c := LINKSRC = wcsxfrm.3c - -wordfree.3c := LINKSRC = wordexp.3c - wscasecmp.3c := LINKSRC = wstring.3c wscol.3c := LINKSRC = wstring.3c wsdup.3c := LINKSRC = wstring.3c wsncasecmp.3c := LINKSRC = wstring.3c +wcswidth_l.3c := LINKSRC = wcswidth.3c + +wsxfrm.3c := LINKSRC = wcsxfrm.3c + +wctob_l.3c := LINKSRC = wctob.3c + +wctomb_l.3c := LINKSRC = wctomb.3c + +towctrans.3c := LINKSRC = wctrans.3c +towctrans_l.3c := LINKSRC = wctrans.3c +wctrans_l.3c := LINKSRC = wctrans.3c + +wctype_l.3c := LINKSRC = wctype.3c + +wcwidth_l.3c := LINKSRC = wcwidth.3c + +wordfree.3c := LINKSRC = wordexp.3c + .KEEP_STATE: include $(SRC)/man/Makefile.man diff --git a/usr/src/man/man3c/btowc.3c b/usr/src/man/man3c/btowc.3c index ad5c197974..56dc9e19a2 100644 --- a/usr/src/man/man3c/btowc.3c +++ b/usr/src/man/man3c/btowc.3c @@ -1,5 +1,6 @@ '\" te .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved +.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH BTOWC 3C "Jul 24, 2002" +.TH BTOWC 3C "Jun 27, 2014" .SH NAME -btowc \- single-byte to wide-character conversion +btowc, btowc_l \- single-byte to wide-character conversion .SH SYNOPSIS .LP .nf @@ -18,52 +19,55 @@ btowc \- single-byte to wide-character conversion \fBwint_t\fR \fBbtowc\fR(\fBint\fR \fIc\fR); .fi +.LP +.nf +#include <stdio.h> +#include <wchar.h> +#include <xlocale.h> +\fBwint_t\fR \fBbtowc_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP -The \fBbtowc()\fR function determines whether \fIc\fR constitutes a valid -(one-byte) character in the initial shift state. -.sp +The \fBbtowc()\fR and \fBbtowc_l\fR()functions determines whether +\fIc\fR constitutes a valid (one-byte) character in the initial shift +state. .LP -The behavior of this function is affected by the \fBLC_CTYPE\fR category of the -current locale. See \fBenviron\fR(5). +The behavior of \fBbtowc()\fR is affected by the \fBLC_CTYPE\fR category of the +current locale. See \fBenviron\fR(5). The function \fBbtowc_l()\fR does +not use the current locale, and instead operates on the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP The \fBbtowc()\fR function returns \fBWEOF\fR if \fIc\fR has the value \fBEOF\fR or if \fB(unsigned char)\fR\fIc\fR does not constitute a valid (one-byte) character in the initial shift state. Otherwise, it returns the wide-character representation of that character. .SH ERRORS -.sp .LP No errors are defined. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE -.SH SEE ALSO -.sp .LP -\fBsetlocale\fR(3C), \fBwctob\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), -\fBstandards\fR(5) -.SH NOTES +The +.B btowc() +function is Standard. The +.B btowc_l() +function is Uncommitted. +.SH SEE ALSO .sp .LP -The \fBbtowc()\fR function can be used safely in multithreaded applications, as -long as \fBsetlocale\fR(3C) is not being called to change the locale. +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), \fBwctob\fR(3C), +\fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/ctype.3c b/usr/src/man/man3c/ctype.3c index e9849003cc..5d5435f221 100644 --- a/usr/src/man/man3c/ctype.3c +++ b/usr/src/man/man3c/ctype.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright 1989 AT&T. Copyright (c) 1992, X/Open Company Limited All Rights Reserved. Portions Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,10 +8,12 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH CTYPE 3C "Jan 28, 2005" +.TH CTYPE 3C "Jun 27, 2014" .SH NAME -ctype, isalpha, isalnum, isascii, isblank, iscntrl, isdigit, islower, isprint, -isspace, isupper, ispunct, isgraph, isxdigit \- character handling +ctype, isalpha, isalnum, isascii, isblank, iscntrl, isdigit, islower, +isprint, isspace, isupper, ispunct, isgraph, isxdigit, isalpha_l, +isalnum_l, isblank_l, iscntrl_l, isdigit_l, islower_l, isprint_l, +isspace_l, isupper_l, ispunct_l, isgraph_l \- character handling .SH SYNOPSIS .LP .nf @@ -18,106 +21,123 @@ isspace, isupper, ispunct, isgraph, isxdigit \- character handling \fBint\fR \fBisalpha\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisalnum\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisascii\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisblank\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBiscntrl\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisdigit\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisgraph\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBislower\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisprint\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBispunct\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisspace\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisupper\fR(\fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBisxdigit\fR(\fBint\fR \fIc\fR); .fi - +.LP +.nf +\fBint\fR \fBisalpha_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBisalnum_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBisblank_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiscntrl_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBisdigit_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBisgraph_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBislower_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBisprint_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBispunct_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBisspace_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBisupper_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP -These macros classify character-coded integer values. Each is a predicate -returning non-zero for true, \fB0\fR for false. The behavior of these macros, -except \fBisascii()\fR, is affected by the current locale (see -\fBsetlocale\fR(3C)). To modify the behavior, change the \fBLC_TYPE\fR category -in \fBsetlocale()\fR, that is, \fBsetlocale(\fR\fBLC_CTYPE\fR, -\fInewlocale\fR). In the "C" locale, or in a locale where character type -information is not defined, characters are classified according to the rules of -the \fBUS-ASCII\fR 7-bit coded character set. -.sp +These functions classify character-coded integer values. Each is a +predicate returning non-zero for true, \fB0\fR for false. The behavior +of these macros, except \fBisascii()\fR, is affected by the current +locale (see \fBsetlocale\fR(3C) and \fBuselocale\fR(3C)). To modify +the behavior, change the \fBLC_TYPE\fR category in \fBsetlocale()\fR, that is, +\fBsetlocale(\fR\fBLC_CTYPE\fR, \fInewlocale\fR). In the "C" locale, +or in a locale where character type information is not defined, +characters are classified according to the rules of the \fBUS-ASCII\fR +7-bit coded character set. +.LP +The functions \fBisalnum_l()\fR, \fBisalpha_l()\fR, \fBisblank_l()\fR, +\fBiscntrl_l\fR, \fBisdigit_l()\fR, \fBislower_l()\fR, +\fBisprint_l()\fR, \fBispunct_l()\fR, \fBisspace_l()\fR, +\fBisupper_l()\fR, all behave identically to their counterparts without +the '\fB_l\fR' prefix, except that instead of acting on the current +locale, that perform the test on the locale specified in the argument +\fIloc\fR. .LP The \fBisascii()\fR macro is defined on all integer values. The rest are defined only where the argument is an \fBint\fR, the value of which is representable as an \fBunsigned char\fR, or \fBEOF\fR, which is defined by the <\fBstdio.h\fR> header and represents end-of-file. .sp -.LP -Functions exist for all the macros defined below. To get the function form, the -macro name must be undefined (for example, \fB#undef isdigit\fR). -.sp -.LP -For macros described with \fBDefault\fR and \fBStandard conforming\fR versions, -standard-conforming behavior is provided for standard-conforming applications -(see \fBstandards\fR(5)) and for applications that define -\fB__XPG4_CHAR_CLASS__\fR before including <\fBctype.h\fR>. -.SS "Default" -.sp -.ne 2 -.na -\fB\fBisalpha()\fR\fR -.ad -.RS 13n -Tests for any character for which \fBisupper()\fR or \fBislower()\fR is true. -.RE - -.SS "Standard conforming" -.sp .ne 2 .na \fB\fBisalpha()\fR\fR @@ -178,18 +198,6 @@ Tests for any ``control character'' as defined by the character set. Tests for any decimal-digit character. .RE -.SS "Default" -.sp -.ne 2 -.na -\fB\fBisgraph()\fR\fR -.ad -.RS 13n -Tests for any character for which \fBispunct()\fR, \fBisupper()\fR, -\fBislower()\fR, and \fBisdigit()\fR is true. -.RE - -.SS "Standard conforming" .sp .ne 2 .na @@ -214,18 +222,6 @@ In the "C" locale, \fBislower()\fR returns true only for the characters defined as lower-case \fBASCII\fR characters. .RE -.SS "Default" -.sp -.ne 2 -.na -\fB\fBisprint()\fR\fR -.ad -.RS 13n -Tests for any character for which \fBispunct()\fR, \fBisupper()\fR, -\fBislower()\fR, \fBisdigit()\fR, and the space character ("\|") is true. -.RE - -.SS "Standard conforming" .sp .ne 2 .na @@ -272,18 +268,6 @@ In the "C" locale, \fBisupper()\fR returns true only for the characters defined as upper-case \fBASCII\fR characters. .RE -.SS "Default" -.sp -.ne 2 -.na -\fB\fBisxdigit()\fR\fR -.ad -.RS 14n -Tests for any hexadecimal-digit character (\fB[0\(mi9]\fR, \fB[A\(miF]\fR, or -\fB[a\(mif]\fR). -.RE - -.SS "Standard conforming" .sp .ne 2 .na @@ -304,36 +288,30 @@ are included. .RE .SH RETURN VALUES -.sp .LP If the argument to any of the character handling macros is not in the domain of the function, the result is undefined. Otherwise, the macro or function returns non-zero if the classification is \fBTRUE\fR and \fB0\fR if the classification is \fBFALSE\fR. -.SH USAGE -.sp -.LP -These macros or functions can be used safely in multithreaded applications, as -long as \fBsetlocale\fR(3C) is not being called to change the locale. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; -l l -l l . +c | c +l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE +_ CSI Enabled +_ Interface Stability Standard -MT-Level MT-Safe with exceptions +_ +MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP -\fBsetlocale\fR(3C), \fBstdio\fR(3C), \fBascii\fR(5), \fBenviron\fR(5), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBstdio\fR(3C), \fBascii\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/fgetwc.3c b/usr/src/man/man3c/fgetwc.3c index 4e9302bdcf..8b75c6cc55 100644 --- a/usr/src/man/man3c/fgetwc.3c +++ b/usr/src/man/man3c/fgetwc.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 2003, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,32 +8,41 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH FGETWC 3C "Oct 15, 2003" +.TH FGETWC 3C "Jun 24, 2014" .SH NAME -fgetwc \- get a wide-character code from a stream +fgetwc, fgetwc_l \- get a wide-character code from a stream .SH SYNOPSIS .LP .nf #include <stdio.h> #include <wchar.h> -\fBwint_t\fR \fBfgetwc\fR(\fBFILE*\fR\fIstream\fR); +\fBwint_t\fR \fBfgetwc\fR(\fBFILE *\fR\fIstream\fR); +.fi +.LP +.nf +#include <stdio.h> +#include <wchar.h> +#include <xlocale.h> + +\fBwint_t\fR \fBfgetwc_l\fR(\fBFILE *\fR\fIstream\fR, \fBlocale_t\fR, \fIloc\fR); .fi .SH DESCRIPTION .sp .LP -The \fBfgetwc()\fR function obtains the next character (if present) from the -input stream pointed to by \fIstream\fR, converts that to the corresponding -wide-character code and advances the associated file position indicator for the -stream (if defined). -.sp +The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions obtain the next +character (if present) from the input stream pointed to by \fIstream\fR, +convert that to the corresponding wide-character code and advance the +associated file position indicator for the stream (if defined). +Whereas \fBfgetwc()\fR uses the current locale, \fBfgetwc_l()\fR uses the +locale specified by \fIloc\R. .LP If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. -.sp .LP -The \fBfgetwc()\fR function may mark the \fBst_atime\fR field of the file +The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions may mark the \fBst_atime\fR +field of the file associated with \fIstream\fR for update. The \fBst_atime\fR field will be marked for update by the first successful execution of \fBfgetwc()\fR, \fBfgetc\fR(3C), \fBfgets\fR(3C), \fBfgetws\fR(3C), \fBfread\fR(3C), @@ -40,112 +50,62 @@ marked for update by the first successful execution of \fBfgetwc()\fR, \fBscanf\fR(3C) using \fIstream\fR that returns data not supplied by a prior call to \fBungetc\fR(3C) or \fBungetwc\fR(3C). .SH RETURN VALUES -.sp .LP -Upon successful completion the \fBfgetwc()\fR function returns the +Upon successful completion both functions return the wide-character code of the character read from the input stream pointed to by \fIstream\fR converted to a type \fBwint_t\fR. -.sp .LP For standard-conforming (see \fBstandards\fR(5)) applications, if the -end-of-file indicator for the stream is set, \fBfgetwc()\fR returns \fBWEOF\fR -whether or not the stream is at end-of-file. -.sp +end-of-file indicator for the stream is set, \fBfgetwc()\fR and +\fBfgetwc_l()\fR return \fBWEOF\fR whether or not the stream is at +end-of-file. .LP If a read error occurs, the error indicator for the stream is set, -\fBfgetwc()\fR returns \fBWEOF\fR and sets \fBerrno\fR to indicate the error. -.sp +\fBfgetwc()\fR and \fBfgetwc_l()\fR returns \fBWEOF\fR and sets +\fBerrno\fR to indicate the error. .LP If an encoding error occurs, the error indicator for the stream is set, -\fBfgetwc()\fR returns \fBWEOF\fR, and \fBerrno\fR is set to indicate the -error. +\fBfgetwc()\fR and \fBfgetwc_l()\fR return \fBWEOF\fR, and \fBerrno\fR is +set to indicate the error. .SH ERRORS -.sp .LP -The \fBfgetwc()\fR function will fail if data needs to be read and: -.sp -.ne 2 -.na -\fB\fBEAGAIN\fR\fR -.ad -.RS 14n +The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions will fail if data needs to be +read and: +.TP +.B EAGAIN The \fBO_NONBLOCK\fR flag is set for the file descriptor underlying -\fIstream\fR and the process would be delayed in the \fBfgetwc()\fR operation. -.RE - -.sp -.ne 2 -.na -\fB\fBEBADF\fR\fR -.ad -.RS 14n +\fIstream\fR and the process would be delayed in the \fBfgetwc()\fR or +\fBfgetwc_l()\fR operation. +.TP +.B EBADF The file descriptor underlying \fIstream\fR is not a valid file descriptor open for reading. -.RE - -.sp -.ne 2 -.na -\fB\fBEINTR\fR\fR -.ad -.RS 14n +.TP +.B EINTR The read operation was terminated due to the receipt of a signal, and no data was transferred. -.RE - -.sp -.ne 2 -.na -\fB\fBEIO\fR\fR -.ad -.RS 14n +.TP +.B EIO A physical I/O error has occurred, or the process is in a background process group attempting to read from its controlling terminal and either the process is ignoring or blocking the \fBSIGTTIN\fR signal or the process group is orphaned. -.RE - -.sp -.ne 2 -.na -\fB\fBEOVERFLOW\fR \fR -.ad -.RS 14n +.TP +.B EOVERFLOW The file is a regular file and an attempt was made to read at or beyond the offset maximum associated with the corresponding \fIstream\fR. -.RE - -.sp .LP -The \fBfgetwc()\fR function may fail if: -.sp -.ne 2 -.na -\fB\fBENOMEM\fR\fR -.ad -.RS 10n -Insufficient storage space is available. -.RE - -.sp -.ne 2 -.na -\fB\fBENXIO\fR\fR -.ad -.RS 10n +The \fBfgetwc()\fR and \fBfgetwc_l()\fR functions may fail if: +.TP +.B ENOMEM +Insufficient memory is available. +.TP +.B ENXIO A request was made of a non-existent device, or the request was outside the capabilities of the device. -.RE - -.sp -.ne 2 -.na -\fB\fBEILSEQ\fR\fR -.ad -.RS 10n +.TP +.B EILSEQ The data obtained from the input stream does not form a valid character. -.RE - .SH USAGE .sp .LP @@ -155,27 +115,30 @@ between an error condition and an end-of-file condition. .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; -l | l +c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE +.LP +The +.B fgetwc() +function is Standard. The +.B fgetwc_l() +function is Uncommitted. .SH SEE ALSO -.sp .LP \fBfeof\fR(3C), \fBferror\fR(3C), \fBfgetc\fR(3C), \fBfgets\fR(3C), \fBfgetws\fR(3C), \fBfopen\fR(3C), \fBfread\fR(3C), \fBfscanf\fR(3C), \fBgetc\fR(3C), \fBgetchar\fR(3C), \fBgets\fR(3C), \fBscanf\fR(3C), -\fBsetlocale\fR(3C), \fBungetc\fR(3C), \fBungetwc\fR(3C), \fBattributes\fR(5), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBungetc\fR(3C), \fBungetwc\fR(3C), +\fBuselocale\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/getwc.3c b/usr/src/man/man3c/getwc.3c index 132d00f099..900f8e8080 100644 --- a/usr/src/man/man3c/getwc.3c +++ b/usr/src/man/man3c/getwc.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH GETWC 3C "Jul 24, 2002" +.TH GETWC 3C "Jul 11, 2014" .SH NAME -getwc \- get wide character from a stream +getwc, getwc_l \- get wide character from a stream .SH SYNOPSIS .LP .nf @@ -18,6 +19,14 @@ getwc \- get wide character from a stream \fBwint_t\fR \fBgetwc\fR(\fBFILE\fR \fI*stream\fR); .fi +.LP +.nf +#include <stdio.h> +#include <wchar.h> +#include <xlocale.h> + +\fBwint_t\fR \fBgetwc_l\fR(\fBFILE\fR \fI*stream\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION .sp @@ -25,44 +34,46 @@ getwc \- get wide character from a stream The \fBgetwc()\fR function is equivalent to \fBfgetwc\fR(3C), except that if it is implemented as a macro it may evaluate \fIstream\fR more than once, so the argument should never be an expression with side effects. +.LP +The \fBgetwc_l()\fR function is similar to \fBgetwc()\fR, except instead of +acting on the current locale, it uses the locale specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP Refer to \fBfgetwc\fR(3C). .SH ERRORS -.sp .LP Refer to \fBfgetwc\fR(3C). .SH USAGE -.sp .LP This interface is provided to align with some current implementations and with possible future \fBISO\fR standards. -.sp .LP -Because it may be implemented as a macro, \fBgetwc()\fR may treat incorrectly a -\fIstream\fR argument with side effects. In particular, -\fBgetwc\fR(*\fIf\fR\|++) may not work as expected. Therefore, use of this -function is not recommended; \fBfgetwc\fR(3C) should be used instead. +Because they may be implemented as macros, these functions may treat incorrectly +a \fIstream\fR argument with side effects. In particular, +\fBgetwc\fR(*\fIf\fR\|++) may not work as expected. Therefore, use of these +functions is not recommended; \fBfgetwc\fR(3C) and \fBfgetwc_l\fR(3C) +should be used instead. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ MT-Level MT-Safe .TE +.LP +The +.B getwc() +function is Standard. The +.B getwc_l() +function is Uncommitted. .SH SEE ALSO -.sp .LP -\fBfgetwc\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) +\fBfgetwc\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/getwchar.3c b/usr/src/man/man3c/getwchar.3c index 8aa26f269c..2c20fb27b1 100644 --- a/usr/src/man/man3c/getwchar.3c +++ b/usr/src/man/man3c/getwchar.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -17,45 +18,47 @@ getwchar \- get wide character from stdin stream \fBwint_t\fR \fBgetwchar\fR(void) .fi +.LP +.nf +#include <wchar.h> +#include <xlocale.h> +\fBwint_t\fR \fBgetwchar_l\fR(locale_t loc) +.fi .SH DESCRIPTION -.sp .LP -The \fBgetwchar()\fR function is equivalent to \fBgetwc(stdin)\fR. +The \fBgetwchar()\fR function is equivalent to \fBgetwc\fR(\fBstdin\fR). +.LP +The\fBgetwchar_l()\fR function is equivalent to \fBgetwc\fR(\fBstdin\fR, \fIloc\fR). .SH RETURN VALUES -.sp .LP Refer to \fBfgetwc\fR(3C). .SH ERRORS -.sp .LP Refer to \fBfgetwc\fR(3C). .SH USAGE -.sp .LP If the \fBwint_t\fR value returned by \fBgetwchar()\fR is stored into a variable of type \fBwchar_t\fR and then compared against the \fBwint_t\fR macro \fBWEOF\fR, the comparison may never succeed because \fBwchar_t\fR is defined as unsigned. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ MT-Level MT-Safe .TE +.LP +The \fBgetwchar()\fR function is Standard. The \fBgetwchar_l()\fR function +is Uncommitted. .SH SEE ALSO -.sp .LP \fBfgetwc\fR(3C), \fBgetwc\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/iswalpha.3c b/usr/src/man/man3c/iswalpha.3c index e109525594..916aad0ffc 100644 --- a/usr/src/man/man3c/iswalpha.3c +++ b/usr/src/man/man3c/iswalpha.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,11 +8,17 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH ISWALPHA 3C "Apr 19, 2004" +.TH ISWALPHA 3C "Jun 23, 2014" .SH NAME -iswalpha, isenglish, isideogram, isnumber, isphonogram, isspecial, iswalnum, -iswascii, iswblank, iswcntrl, iswdigit, iswgraph, iswlower, iswprint, iswpunct, -iswspace, iswupper, iswxdigit \- wide-character code classification functions +iswalpha, isenglish, isideogram, iswideogram, isnumber, iswnumber, +isphonogram, iswphonogram, isspecial, iswspecial, iswalnum, iswascii, +iswblank, iswcntrl, iswdigit, iswgraph, iswlower, iswprint, iswpunct, +iswspace, iswupper, iswxdigit, iswhexnumber, iswalpha_l, iswideogram_l, +iswnumber_l, iswphonogram_l, iswspecial_l, iswalnum_l, iswascii_l, +iswblank_l, iswcntrl_l, iswdigit_l, iswgraph_l, iswlower_l, iswprint_l, +iswpunct_l, iswspace_l, iswupper_l, iswhexnumber_l \- wide-character +code classification functions + .SH SYNOPSIS .LP .nf @@ -20,99 +27,187 @@ iswspace, iswupper, iswxdigit \- wide-character code classification functions \fBint\fR \fBiswalpha\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBisenglish\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBisideogram\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBisnumber\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBisphonogram\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBisspecial\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswalnum\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswascii\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswblank\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswcntrl\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswdigit\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswgraph\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswlower\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswprint\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswpunct\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswspace\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswupper\fR(\fBwint_t\fR \fIwc\fR); .fi - .LP .nf \fBint\fR \fBiswxdigit\fR(\fBwint_t\fR \fIwc\fR); .fi +.LP +.nf +\fBint\fR \fBiswhexnumber\fR(\fBwint_t\fR \fIwc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswideogram\fR(\fBwint_t\fR \fIwc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswnumber\fR(\fBwint_t\fR \fIwc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswphonogram\fR(\fBwint_t\fR \fIwc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswspecial\fR(\fBwint_t\fR \fIwc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswalpha_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswideogram_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswnumber_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswphonogram_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswspecial_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswalnum_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswascii_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswblank_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswcntrl_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswdigit_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswgraph_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswlower_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswprint_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswpunct_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswspace_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswupper\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBint\fR \fBiswxdigit\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +#include <xlocale.h> + +\fBint\fR \fBiswhexnumber\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP These functions test whether \fIwc\fR is a wide-character code representing a character of a particular class defined in the \fBLC_CTYPE\fR category of the -current locale. -.sp +current locale or the locale specified by \fIloc\fR. +.LP +The functions \fBiswalpha_l()\fR, \fBiswideogram_l()\fR, \fBiswnumber_l()\fR, +\fBiswphonogram_l()\fR, \fBiswspecial_l()\fR, \fBiswalnum_l()\fR, +\fBiswascii_l()\fR, \fBiswblank_l()\fR, \fBiswcntrl_l()\fR, \fBiswdigit_l()\fR, +\fBiswgraph_l()\fR, \fBiswlower_l()\fR, \fBiswprint_l()\fR, \fBiswpunct_l()\fR, +\fBiswspace_l()\fR, \fBiswupper_l()\fR, all behave identically to their +counterparts without the '\fB_l\fR' suffix, but instead of operating on the +current locale, they operate on the locale specified by \fIloc\fR. +.LP +The functions, \fBiswideogram()\fR, \fBiswnumber()\fR, \fBiswphonogram()\fR, +\fBiswspecial()\fR, and \fBiswhexnumber()\fR, are respectively identical to +\fBisideogram()\fR, \fBisnumber()\fR, \fBisphonogram()\fR, \fBisspecial()\fR, +\fBiswxdigit()\fR respectively. They are provided for compatability purposes. .LP In all cases, \fIwc\fR is a \fBwint_t\fR, the value of which must be a wide-character code corresponding to a valid character in the current locale or @@ -303,30 +398,31 @@ class "xdigit" in the program's current locale. .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; -l | l +c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability See below. +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE -.sp .LP The \fBiswalpha()\fR, \fBiswalnum()\fR, \fBiswblank()\fR, \fBiswcntrl()\fR, \fBiswdigit()\fR, \fBiswgraph()\fR, \fBiswlower()\fR, \fBiswprint()\fR, \fBiswpunct()\fR, \fBiswspace()\fR, \fBiswupper()\fR, and \fBiswxdigit()\fR functions are Standard. +.LP +The \fBiswalpha_l()\fR, \fBiswalnum_l()\fR, \fBiswblank_l()\fR, \fBiswcntrl_l()\fR, +\fBiswdigit_l()\fR, \fBiswgraph_l()\fR, \fBiswlower_l()\fR, \fBiswprint_l()\fR, +\fBiswpunct_l()\fR, \fBiswspace_l()\fR, and \fBiswupper_l()\fR +functions are Standard. .SH SEE ALSO -.sp .LP -\fBlocaledef\fR(1), \fBsetlocale\fR(3C), \fBstdio\fR(3C), \fBascii\fR(5), -\fBattributes\fR(5), \fBstandards\fR(5) +\fBlocaledef\fR(1), \fBnewlocale\fR(3C), +\fBsetlocale\fR(3C), \fBstdio\fR(3C), \fBuselocale\fR(3C), +\fBascii\fR(5), \fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/iswctype.3c b/usr/src/man/man3c/iswctype.3c index a925f4b07b..9da9eef82a 100644 --- a/usr/src/man/man3c/iswctype.3c +++ b/usr/src/man/man3c/iswctype.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,7 +8,7 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH ISWCTYPE 3C "Jul 24, 2002" +.TH ISWCTYPE 3C "Jul 26, 2014" .SH NAME iswctype \- test character for specified class .SH SYNOPSIS @@ -17,33 +18,61 @@ iswctype \- test character for specified class \fBint\fR \fBiswctype\fR(\fBwint_t\fR \fIwc\fR, \fBwctype_t\fR \fIcharclass\fR); .fi +.LP +.nf +\fBint\fR \fBiswctype\fR(\fBwint_t\fR \fIwc\fR, \fBwctype_t\fR \fIcharclass\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP -The \fBiswctype()\fR function determines whether the wide-character code -\fIwc\fR has the character class \fIcharclass\fR, returning \fBTRUE\fR or -\fBFALSE\fR. The \fBiswctype()\fR function is defined on \fBWEOF\fR and -wide-character codes corresponding to the valid character encodings in the -current locale. If the \fIwc\fR argument is not in the domain of the function, -the result is undefined. If the value of \fIcharclass\fR is invalid (that is, -not obtained by a call to \fBwctype\fR(3C) or \fIcharclass \fR is invalidated -by a subsequent call to \fBsetlocale\fR(3C) that has affected category -\fBLC_CTYPE\fR), the result is indeterminate. +The +.B iswctype() +and +.B iswctype_l() +functions determine whether the wide-character code +.I wc +is a member of the character class +.IR charclass , +returning +.B TRUE +or +.BR FALSE . +These functions are defined on +.B WEOF +and wide-character codes corresponding to the valid character encodings in the +current locale (or +.I loc +for +.BR iswctype_l() .) +If the +.I wc +argument is not in the domain of the function, +the result is undefined. If the value of +.I charclass +is invalid (that is, +not obtained by a call to +.B wctype (3C) +or obtained from a different locale), the result is indeterminate. +.LP +Whereas +.B iswctype() +operates in the current locale, +.B iswctype_l() +operates in the locale specified with +.IR loc . .SH RETURN VALUES -.sp .LP -The \fBiswctype()\fR function returns \fB0\fR for \fBFALSE\fR and non-zero for -\fBTRUE\fR. +These functions return +.B 0 +for +.B FALSE +and non-zero for +.BR TRUE . .SH USAGE -.sp .LP There are twelve strings that are reserved for the standard character classes: -.sp - -.sp .TS -l | l | l +box; l | l | l . "alnum" "alpha" "blank" _ @@ -54,45 +83,36 @@ _ "space" "upper" "xdigit" .TE -.sp .LP In the table below, the functions in the left column are equivalent to the functions in the right column. -.sp - -.sp .TS -l l -l l . -\fBiswalnum(\fR\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"alnum"\fB))\fR -iswalpha(\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"alpha"\fB))\fR -iswcntrl(\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"cntrl"\fB))\fR -iswdigit(\fI wc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"digit"\fB))\fR -iswgraph(\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"graph"\fB))\fR -iswlower(\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"lower"\fB))\fR -iswprint(\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"print"\fB))\fR -iswpunct(\fIwc\fR\fB)\fR iswctype(\fI wc,\fR\fB wctype(\fR"punct"\fB))\fR -iswspace(\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"space"\fB))\fR -iswupper(\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"upper"\fB))\fR -iswxdigit(\fIwc\fR\fB)\fR iswctype(\fIwc,\fR\fB wctype(\fR"xdigit"\fB))\fR +box; +l | l . +\fBiswalnum\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("alnum")) +\fBiswalpha\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("alpha")) +\fBiswcntrl\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("cntrl")) +\fBiswdigit\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("digit")) +\fBiswgraph\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("graph")) +\fBiswlower\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("lower")) +\fBiswprint\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("print")) +\fBiswpunct\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("punct")) +\fBiswspace\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("space")) +\fBiswupper\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("upper")) +\fBiswxdigit\fR(\fIwc\fR) \fBiswctype\fR(\fIwc\fR, \fBwctype\fR("xdigit")) .TE -.sp .LP The call -.sp .LP -\fBiswctype(\fR\fIwc,\fR\fB wctype(\fR"blank"\fB))\fR -.sp +\fBiswctype\fR(\fIwc\fR, \fBwctype\fR("blank")) .LP -does not have an equivalent \fBisw*(\|)\fR function. +does not have an equivalent \fBisw*(\|)\fR function. .SH ATTRIBUTES -.sp .LP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp +See +.BR attributes (5) +for descriptions of the following attributes: .TS box; c | c @@ -103,11 +123,15 @@ CSI Enabled _ Interface Stability Standard _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP -\fBiswalpha\fR(3C), \fBsetlocale\fR(3C), \fBwctype\fR(3C), \fBattributes\fR(5), -\fBenviron\fR(5), \fBstandards\fR(5) +.BR iswalpha (3C), +.BR newlocale (3C), +.BR setlocale (3C), +.BR uselocale (3C), +.BR wctype (3C), +.BR attributes (5), +.BR standards (5) diff --git a/usr/src/man/man3c/mblen.3c b/usr/src/man/man3c/mblen.3c index 4051e28a52..ef4d8d60cd 100644 --- a/usr/src/man/man3c/mblen.3c +++ b/usr/src/man/man3c/mblen.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright 1989 AT&T Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH MBLEN 3C "Jul 24, 2002" +.TH MBLEN 3C "Jun 24, 2014" .SH NAME -mblen \- get number of bytes in a character +mblen, mblen_l \- get number of bytes in a character .SH SYNOPSIS .LP .nf @@ -17,25 +18,37 @@ mblen \- get number of bytes in a character \fBint\fR \fBmblen\fR(\fBconst char *\fR\fIs\fR, \fBsize_t\fR \fIn\fR); .fi +.LP +.nf +#include <stdlib.h> +#include <xlocale.h> + +\fBint\fR \fBmblen_l\fR(\fBconst char *\fR\fIs\fR, \fBsize_t\fR \fIn\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION .sp .LP -If \fIs\fR is not a null pointer, \fBmblen()\fR determines the number of bytes -constituting the character pointed to by \fIs\fR. It is equivalent to: -.sp +If \fIs\fR is not a null pointer, \fBmblen()\fR and \fBmblen_l()\fR +determine the number of bytes constituting the character pointed to by +\fIs\fR. The call +.IP +\fBmblen(\fIs\fR, \fIn\fR)\fR; .LP -\fBmbtowc((wchar_t *)0, \fR\fIs\fR, \fIn\fR); -.sp +is equivalent to: +.IP +\fBmbtowc\fR((\fBwchar_t\fR *)0, \fIs\fR, \fIn\fR); .LP A call with \fIs\fR as a null pointer causes this function to return \fB0\fR. -The behavior of this function is affected by the \fBLC_CTYPE\fR category of the -current locale. +.LP +Whereas the behavior of the \fBmblen()\fR function is affected by the +\fBLC_CTYPE\fR category of the current locale, the behavior of +\fBmblen_l()\fR is affected by the \fBLC_CTYPE\fR category of the +locale specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP -If \fIs\fR is a null pointer, \fBmblen()\fR returns \fB0\fR. It \fIs\fR is not -a null pointer, \fBmblen()\fR returns \fB0\fR (if \fIs\fR points to the null +If \fIs\fR is a null pointer, \fBmblen()\fR and \fBmblen_l()\fR returns \fB0\fR. It \fIs\fR is not +a null pointer, \fBmblen()\fR and \fBmblen_l()\fR returns \fB0\fR (if \fIs\fR points to the null byte), the number of bytes that constitute the character (if the next \fIn\fR or fewer bytes form a valid character), or \fB\(mi1\fR (if they do not form a valid character) and may set \fBerrno\fR to indicate the error. In no case will @@ -44,7 +57,7 @@ macro. .SH ERRORS .sp .LP -The \fBmblen()\fR function may fail if: +The \fBmblen()\fR and \fBmblen_l()\fR functions may fail if: .sp .ne 2 .na @@ -53,12 +66,6 @@ The \fBmblen()\fR function may fail if: .RS 10n Invalid character sequence is detected. .RE - -.SH USAGE -.sp -.LP -The \fBmblen()\fR function can be used safely in multithreaded applications, as -long as \fBsetlocale\fR(3C) is not being called to change the locale. .SH ATTRIBUTES .sp .LP @@ -74,13 +81,19 @@ ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE +.LP +The +.B mblen() +function is Standard. The +.B mblen_l() +function is Uncommitted. .SH SEE ALSO -.sp .LP -\fBmbstowcs\fR(3C), \fBmbtowc\fR(3C), \fBsetlocale\fR(3C), \fBwcstombs\fR(3C), -\fBwctomb\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) +\fBmbstowcs\fR(3C), \fBmbtowc\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), +\fBwcstombs\fR(3C), \fBwctomb\fR(3C), \fBuselocale\fR(3C) \fBattributes\fR(5), +\fBstandards\fR(5) diff --git a/usr/src/man/man3c/mbrlen.3c b/usr/src/man/man3c/mbrlen.3c index 8570fc53ce..1f55b8edf0 100644 --- a/usr/src/man/man3c/mbrlen.3c +++ b/usr/src/man/man3c/mbrlen.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH MBRLEN 3C "Nov 1, 2003" +.TH MBRLEN 3C "Jun 21, 2014" .SH NAME -mbrlen \- get number of bytes in a character (restartable) +mbrlen, mbrlen_l \- get number of bytes in a character (restartable) .SH SYNOPSIS .LP .nf @@ -17,36 +18,46 @@ mbrlen \- get number of bytes in a character (restartable) \fBsize_t\fR \fBmbrlen\fR(\fBconst char *restrict\fR \fIs\fR, \fBsize_t\fR \fIn\fR, \fBmbstate_t *restrict\fR \fIps\fR); .fi +.LP +.nf +#include <wchar.h> +#include <xlocale.h> +\fBsize_t\fR \fBmbrlen_l\fR(\fBconst char *restrict\fR \fIs\fR, \fBsize_t\fR \fIn\fR, \fBmbstate_t *restrict\fR \fIps\fR, + \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP -If \fIs\fR is not a null pointer, \fBmbrlen()\fR determines the number of -bytes constituting the character pointed to by \fIs\fR. It is equivalent to: -.sp -.in +2 +If \fIs\fR is not a null pointer, \fBmbrlen()\fR and \fBmbrlen_l()\fR determine +the number of bytes constituting the character pointed to by \fIs\fR. +The call .nf +.IP +\fBmbrlen\fR(\fIs\fR, \fIn\fR, \fIps\fR); +.fi +.LP +is equivalent to: +.nf +.IP mbstate_t internal; -mbrtowc(NULL, s, n, ps != NULL ? ps : &internal); +\fBmbrtowc\fR(NULL, \fIs\fR, \fIn\fR, \fIps\fR != NULL ? \fIps\fR : &internal); .fi -.in -2 - -.sp .LP -If \fIps\fR is a null pointer, the \fBmbrlen()\fR function uses its own +If \fIps\fR is a null pointer, the \fBmbrlen()\fR and \fBmbrlen_l()\fR +functions use their own internal \fBmbstate_t\fR object, which is initialized at program startup to the initial conversion state. Otherwise, the \fBmbstate_t\fR object pointed to by \fIps\fR is used to completely describe the current conversion state of the -associated character sequence. Solaris will behave as if no function defined in -the Solaris Reference Manual calls \fBmbrlen()\fR. -.sp +associated character sequence. The implemenation will behave as if no function +defined in the Reference Manual calls \fBmbrlen()\fR. .LP -The behavior of this function is affected by the \fBLC_CTYPE\fR category of the -current locale. See \fBenviron\fR(5). +The behavior of \fBmbrlen()\fR is affected by the \fBLC_CTYPE\fR category of the +current locale. See \fBenviron\fR(5). The behavior of \fBmbrlen_l()\fR does not +use the current enivronment and instead uses the locale specified by \fBloc\fR. .SH RETURN VALUES -.sp .LP -The \fBmbrlen()\fR function returns the first of the following that applies: +The \fBmbrlen()\fR and \fBmbrlen_l()\fR functions return the first of the +following that applies: .sp .ne 2 .na @@ -92,9 +103,8 @@ is stored in \fBerrno\fR and the conversion state is undefined. .RE .SH ERRORS -.sp .LP -The \fBmbrlen()\fR function may fail if: +The \fBmbrlen()\fR and \fBmbrlen_l()\fR functions may fail if: .sp .ne 2 .na @@ -115,27 +125,29 @@ Invalid character sequence is detected. .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level See NOTES below +MT-Level MT-Safe .TE +.LP +The +.B mbrlen() +function is Standard. The +.B mbrlen_l() +function is Uncommitted. .SH SEE ALSO -.sp .LP -\fBmbrtowc\fR(3C), \fBmbsinit\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), +\fBmbrtowc\fR(3C), \fBmbsinit\fR(3C), \fBnewlocale\fR(3C), +\fBsetlocale\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) .SH NOTES .sp @@ -143,6 +155,7 @@ MT-Level See NOTES below If \fIps\fR is not a null pointer, \fBmbrlen()\fR uses the \fBmbstate_t\fR object pointed to by \fIps\fR and the function can be used safely in multithreaded applications, as long as \fBsetlocale\fR(3C) is not being called -to change the locale. If \fIps\fR is a null pointer, \fBmbrlen()\fR uses its -internal \fBmbstate_t\fR object and the function is Unsafe in multithreaded -applications. +to change the locale or a per-thread locale has been installed on the calling +thread with \fBuselocale\fR(3C). If \fIps\fR is a null pointer, \fBmbrlen()\fR +uses its internal \fBmbstate_t\fR object and the function is Unsafe in +multithreaded applications. diff --git a/usr/src/man/man3c/mbrtowc.3c b/usr/src/man/man3c/mbrtowc.3c index 353d216616..55e053570e 100644 --- a/usr/src/man/man3c/mbrtowc.3c +++ b/usr/src/man/man3c/mbrtowc.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH MBRTOWC 3C "Nov 1, 2003" +.TH MBRTOWC 3C "Jun 23, 2014" .SH NAME -mbrtowc \- convert a character to a wide-character code (restartable) +mbrtowc, mbrtowc_l \- convert a character to a wide-character code (restartable) .SH SYNOPSIS .LP .nf @@ -18,146 +19,177 @@ mbrtowc \- convert a character to a wide-character code (restartable) \fBsize_t\fR \fBmbrtowc\fR(\fBwchar_t *restrict\fR \fIpwc\fR, \fBconst char *restrict\fR \fIs\fR, \fBsize_t\fR \fIn\fR, \fBmbstate_t *restrict\fR \fIps\fR); .fi +.LP +.nf +#include <wchar.h> +#include <xlocale.h> +\fBsize_t\fR \fBmbrtowc_l\fR(\fBwchar_t *restrict\fR \fIpwc\fR, \fBconst char *restrict\fR \fIs\fR, \fBsize_t\fR \fIn\fR, + \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP -If \fIs\fR is a null pointer, the \fBmbrtowc()\fR function is equivalent to the -call: +If +.I s +is a null pointer, the +.B mbrtowc() +function is equivalent to the call: .sp .in +2 .nf -mbrtowc(NULL, ``'', 1, ps) +\fBmbrtowc\fR(NULL, "", 1, \fIps\fR) .fi .in -2 - -.sp .LP -In this case, the values of the arguments \fIpwc\fR and \fIn\fR are ignored. +Likewise, if +.I s +is a null pointer, the +.B mbrtowc_l() +function is equivalent to the call: .sp +.in +2 +.nf +\fBmbrtowc_l\fR(NULL, "", 1, \fIps\fR, \fIloc\fR); +.fi +.in -2 +.LP +In these cases, the values of the arguments +.I pwc +and +.I n +are ignored. .LP -If \fIs\fR is not a null pointer, the \fBmbrtowc()\fR function inspects at most -\fIn\fR bytes beginning at the byte pointed to by \fIs\fR to determine the -number of bytes needed to complete the next character (including any shift -sequences). If the function determines that the next character is completed, -it determines the value of the corresponding wide-character and then, if -\fIpwc\fR is not a null pointer, stores that value in the object pointed to by -\fIpwc\fR. If the corresponding wide-character is the null wide-character, the +If +.I s +is not a null pointer, these functions inspect at most +.I n +bytes beginning at the byte pointed to by +.I s +to determine the number of bytes needed to complete the next character +(including any shift sequences). If the functions determine that the next +character is completed, +they determine the value of the corresponding wide-character and then, if +.I pwc +is not a null pointer, stores that value in the object pointed to by +.IR pwc . +If the corresponding wide-character is the null wide-character, the resulting state described is the initial conversion state. -.sp .LP -If \fIps\fR is a null pointer, the \fBmbrtowc()\fR function uses its own -internal \fBmbstate_t\fR object, which is initialized at program startup to the -initial conversion state. Otherwise, the \fBmbstate_t\fR object pointed to -by \fIps\fR is used to completely describe the current conversion state of the -associated character sequence. Solaris will behave as if no function defined in -the Solaris Reference Manual calls \fBmbrtowc()\fR. -.sp +If +.I ps +is a null pointer, these functions use their own +internal +.B mbstate_t +object, which is initialized at program startup to the +initial conversion state. Otherwise, the +.B mbstate_t +object pointed to by +.I ps +is used to completely describe the current conversion state of the +associated character sequence. The system will behave as if no function defined +in the Reference Manual calls +.B mbrtowc() +or +.BR Bmbrtowc_l() . .LP -The behavior of this function is affected by the \fBLC_CTYPE\fR category of the -current locale. See \fBenviron\fR(5). +The behavior of +.B mbrtowc() +is affected by the +.B LC_CTYPE +category of the current locale. The +.B mbrtowc_l() +function is affected by the +.B LC_CTYPE +category of the specified +.I loc +locale object. See +.B environ (5). .SH RETURN VALUES -.sp .LP -The \fBmbrtowc()\fR function returns the first of the following that applies: -.sp -.ne 2 -.na -\fB\fB0\fR\fR -.ad -.RS 17n -If the next \fIn\fR or fewer bytes complete the character that corresponds to +The +.B mbrtowc() +and +.B mbrtowc_l() +functions return the first of the following that applies: +.IP \fB0\fR +If the next +.I n +or fewer bytes complete the character that corresponds to the null wide-character (which is the value stored). -.RE - -.sp -.ne 2 -.na -\fB\fBpositive\fR\fR -.ad -.RS 17n -If the next \fIn\fR or fewer bytes complete a valid character (which is the +.IP \fBpositive\fR +If the next +.I n +or fewer bytes complete a valid character (which is the value stored); the value returned is the number of bytes that complete the character. -.RE - -.sp -.ne 2 -.na -\fB\fB(size_t)\(mi2\fR\fR -.ad -.RS 17n -If the next \fIn\fR bytes contribute to an incomplete but potentially valid -character, and all \fIn\fR bytes have been processed (no value is stored). -When \fIn\fR has at least the value of the \fBMB_CUR_MAX\fR macro, this case -can only occur if \fIs\fR points at a sequence of redundant shift sequences +.IP \fB(size_t)\(mi2\fR +If the next +.I n +bytes contribute to an incomplete but potentially valid +character, and all +.I n +bytes have been processed (no value is stored). +When +.I n +has at least the value of the +.B MB_CUR_MAX +macro, this case can only occur if +.I s +points at a sequence of redundant shift sequences (for implementations with state-dependent encodings). -.RE - -.sp -.ne 2 -.na -\fB\fB(size_t)\(mi1\fR\fR -.ad -.RS 17n +.IP \fB(size_t)\(mi1\fR If an encoding error occurs, in which case the next \fIn\fR or fewer bytes do not contribute to a complete and valid character (no value is stored). In -this case, \fBEILSEQ\fR is stored in \fBerrno\fR and the conversion state is -undefined. -.RE - +this case, +.B EILSEQ +is stored in +.B errno +and the conversion state is undefined. .SH ERRORS -.sp .LP -The \fBmbrtowc()\fR function may fail if: -.sp -.ne 2 -.na -\fB\fBEINVAL\fR\fR -.ad -.RS 10n -The \fIps\fR argument points to an object that contains an invalid conversion +The +.B mbrtowc() +and +.B mbrtowc_l() +functions may fail if: +.IP \fBEINVAL\fR +The +.I ps +argument points to an object that contains an invalid conversion state. -.RE - -.sp -.ne 2 -.na -\fB\fBEILSEQ\fR\fR -.ad -.RS 10n +.IP \fBEILSEQ\fR Invalid character sequence is detected. -.RE - .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level See NOTES below +MT-Level See below. .TE -.SH SEE ALSO -.sp .LP -\fBmbsinit\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), -\fBstandards\fR(5) -.SH NOTES -.sp +The +.B mbrtowc() +function is Standard. The +.B mbrtowc_l() +function is Uncommitted. +.LP +If +.I ps +is a null pointer, these functions are Unsafe for use in +multithreaded applications. Otherwise they are MT-Safe. +.SH SEE ALSO .LP -If \fIps\fR is not a null pointer, \fBmbrtowc()\fR uses the \fBmbstate_t\fR -object pointed to by \fIps\fR and the function can be used safely in -multithreaded applications, as long as \fBsetlocale\fR(3C) is not being called -to change the locale. If \fIps\fR is a null pointer, \fBmbrtowc()\fR uses its -internal \fBmbstate_t\fR object and the function is Unsafe in multithreaded -applications. +.BR mbsinit (3C), +.BR newlocale (3C), +.BR setlocale (3C), +.BR uselocale (3C), +.BR attributes (5), +.BR environ (5), +.BR standards (5) diff --git a/usr/src/man/man3c/mbsinit.3c b/usr/src/man/man3c/mbsinit.3c index b4331cd866..66ebcd5c7a 100644 --- a/usr/src/man/man3c/mbsinit.3c +++ b/usr/src/man/man3c/mbsinit.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH MBSINIT 3C "Jul 24, 2002" +.TH MBSINIT 3C "Jun 23, 2014" .SH NAME -mbsinit \- determine conversion object status +mbsinit,mbsinit_l \- determine conversion object status .SH SYNOPSIS .LP .nf @@ -17,20 +18,25 @@ mbsinit \- determine conversion object status \fBint\fR \fBmbsinit\fR(\fBconst mbstate_t *\fR\fIps\fR); .fi +.LP +.nf +#include <wchar.h> +#include <xlocale.h> +\fBint\fR \fBmbsinit_l\fR(\fBconst mbstate_t *\fR\fIps\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP If \fBps\fR is not a null pointer, the \fBmbsinit()\fR function determines -whether the object pointed to by \fBps\fR describes an initial conversion -state. +whether the object pointed to by \fBps\fR describes an initial conversion state. +.LP +The function \fBmbsinit_l()\fR behaves identically to \fBmbsinit()\fR except the +current locale is ignored and the locale \fIloc\fR is used instead. .SH RETURN VALUES -.sp .LP The \fBmbsinit()\fR function returns non-zero if \fBps\fR is a null pointer, or if the pointed-to object describes an initial conversion state; otherwise, it returns \fB0\fR. -.sp .LP If an \fBmbstate_t\fR object is altered by any of the functions described as "restartable", and is then used with a different character sequence, or in the @@ -38,17 +44,14 @@ other conversion direction, or with a different \fBLC_CTYPE\fR category setting than on earlier function calls, the behavior is undefined. See \fBenviron\fR(5). .SH ERRORS -.sp .LP No errors are defined. .SH USAGE -.sp .LP The \fBmbstate_t\fR object is used to describe the current conversion state from a particular character sequence to a wide-character sequence (or vice versa) under the rules of a particular setting of the \fBLC_CTYPE\fR category of the current locale. -.sp .LP The initial conversion state corresponds, for a conversion in either direction, to the beginning of a new character sequence in the initial shift state. A @@ -57,31 +60,28 @@ conversion state. A zero-valued \fBmbstate_t\fR object can be used to initiate conversion involving any character sequence, in any \fBLC_CTYPE\fR category setting. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE +.LP +The +.B mbsinit() +function is Standard. The +.B mbsinit_l() +function is Uncommitted. .SH SEE ALSO -.sp .LP -\fBmbrlen\fR(3C), \fBmbrtowc\fR(3C), \fBmbsrtowcs\fR(3C), \fBsetlocale\fR(3C), -\fBwcrtomb\fR(3C), \fBwcsrtombs\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), +\fBmbrlen\fR(3C), \fBmbrtowc\fR(3C), \fBmbsrtowcs\fR(3C), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), +\fBwcrtomb\fR(3C), \fBwcsrtombs\fR(3C), \fBuselocale\fR(), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) -.SH NOTES -.sp -.LP -The \fBmbsinit()\fR function can be used safely in multithreaded applications, -as long as \fBsetlocale\fR(3C) is not being called to change the locale. diff --git a/usr/src/man/man3c/mbsrtowcs.3c b/usr/src/man/man3c/mbsrtowcs.3c index f23284f6de..b645fe4942 100644 --- a/usr/src/man/man3c/mbsrtowcs.3c +++ b/usr/src/man/man3c/mbsrtowcs.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,27 +8,43 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH MBSRTOWCS 3C "Nov 1, 2003" +.TH MBSRTOWCS 3C "Jun 28, 2014" .SH NAME -mbsrtowcs \- convert a character string to a wide-character string -(restartable) +mbsnrtwocs, mbsnrtowcs_l, mbsrtowcs, mbsrtowcs_l \- convert a character string +to a wide-character string (restartable) .SH SYNOPSIS .LP .nf #include <wchar.h> +\fBsize_t\fR \fBmbsnrtowcs\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR, + \fBsize_t\fR \fInms\fR, \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR); +.fi +.LP +.nf \fBsize_t\fR \fBmbsrtowcs\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR, \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR); .fi +.LP +.nf +#include <wchar.h> +#include <xlocale.h> +\fBsize_t\fR \fBmbsnrtowcs_l\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR, + \fBsize_t\fR \fInms\fR, \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBsize_t\fR \fBmbsrtowcs_l\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR, + \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP -The \fBmbsrtowcs()\fR function converts a sequence of characters, beginning in +These function converts a sequence of characters, beginning in the conversion state described by the object pointed to by \fIps\fR, from the array indirectly pointed to by \fIsrc\fR into a sequence of corresponding wide-characters. If \fIdst\fR is not a null pointer, the converted characters -are stored into the array pointed to by \fIdst\fR. Conversion continues up to +are stored into the array pointed to by \fIdst\fR. Conversion continues up to and including a terminating null character, which is also stored. Conversion stops early in either of the following cases: .RS +4 @@ -43,10 +60,8 @@ When a sequence of bytes is encountered that does not form a valid character. When \fIlen\fR codes have been stored into the array pointed to by \fIdst\fR (and \fIdst\fR is not a null pointer). .RE -.sp .LP Each conversion takes place as if by a call to the \fBmbrtowc()\fR function. -.sp .LP If \fIdst\fR is not a null pointer, the pointer object pointed to by \fIsrc\fR is assigned either a null pointer (if conversion stopped due to reaching a @@ -54,31 +69,35 @@ terminating null character) or the address just past the last character converted (if any). If conversion stopped due to reaching a terminating null character, and if \fIdst\fR is not a null pointer, the resulting state described is the initial conversion state. -.sp .LP -If \fIps\fR is a null pointer, the \fBmbsrtowcs()\fR function uses its own +If \fIps\fR is a null pointer, these functions uses their own internal \fBmbstate_t\fR object, which is initialized at program startup to the -initial conversion state. Otherwise, the \fBmbstate_t\fR object pointed to by +initial conversion state. Otherwise, the \fBmbstate_t\fR object pointed to by \fIps\fR is used to completely describe the current conversion state of the -associated character sequence. Solaris will behave as if no function defined in -the Solaris Reference Manual calls \fBmbsrtowcs()\fR. -.sp +associated character sequence. The system will behave as if no function defined +in the Reference Manual calls any of these functions. .LP -The behavior of this function is affected by the \fBLC_CTYPE\fR category of the -current locale. See \fBenviron\fR(5). +The function \fBmbsnrtowcs()\fR behaves identically to \fBmbsrtowcs()\fR, +except the conversion stops after reading \fInms\fR bytes from the +buffer pointed to by \fIsrc\fR. +.LP +The behavior of \fBmbnrtowcs()\fR and \fBmbsrtowcs()\fR functions are +affected by the \fBLC_CTYPE\fR category of the +current locale. See \fBenviron\fR(5). The functions \fBmbsrtowcs_l()\fR and +\fBmbsnrtowcs_l()\fR behave identically to \fBmbsrtowcs()\fR and +\fBmbsnrtowcs()\fR, except that instead of using the current locale, they use +the locale specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP If the input conversion encounters a sequence of bytes that do not form a valid -character, an encoding error occurs. In this case, the \fBmbsrtowcs()\fR -function stores the value of the macro \fBEILSEQ\fR in \fBerrno\fR and returns -\fB(size_t)\(mi1\fR; the conversion state is undefined. Otherwise, it returns +character, an encoding error occurs. In this case, these +functions store the value of the macro \fBEILSEQ\fR in \fBerrno\fR and return +\fB(size_t)\(mi1\fR; the conversion state is undefined. Otherwise, they return the number of characters successfully converted, not including the terminating null (if any). .SH ERRORS -.sp .LP -The \fBmbsrtowcs()\fR function may fail if: +Theses functions may fail if: .sp .ne 2 .na @@ -97,36 +116,38 @@ state. .RS 10n Invalid character sequence is detected. .RE - .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level See NOTES below +MT-Level See below. .TE -.SH SEE ALSO -.sp .LP -\fBmbrtowc\fR(3C), \fBmbsinit\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), -\fBenviron\fR(5), \fBstandards\fR(5) -.SH NOTES -.sp +The +.B mbsnrtowcs() +and +.B mbsrtowcs() +functions are Standard. The +.B mbsnrtowcs_l() +and +.B mbsrtowcs_l() +functions are Uncommitted. .LP -If \fIps\fR is not a null pointer, \fBmbsrtowcs()\fR uses the \fBmbstate_t\fR -object pointed to by \fIps\fR and the function can be used safely in -multithreaded applications, as long as \fBsetlocale\fR(3C) is not being called -to change the locale. If \fIps\fR is a null pointer, \fBmbsrtowcs()\fR uses its -internal \fBmbstate_t\fR object and the function is Unsafe in multithreaded +If \fIps\fR is not a null pointer, these functions use the \fBmbstate_t\fR +object pointed to by \fIps\fR and can be used safely in +multithreaded applications, otherwise they use an +internal \fBmbstate_t\fR object and are Unsafe in multithreaded applications. +.SH SEE ALSO +.LP +\fBmbrtowc\fR(3C), \fBmbsinit\fR(3C), \fBnewlocale\fR(3C), +\fBsetlocale\fR(3C), \fBuselocale()\fR, \fBattributes\fR(5), +\fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/mbtowc.3c b/usr/src/man/man3c/mbtowc.3c index 8e2749e0af..c15c7de518 100644 --- a/usr/src/man/man3c/mbtowc.3c +++ b/usr/src/man/man3c/mbtowc.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH MBTOWC 3C "Nov 1, 2003" +.TH MBTOWC 3C "Jun 23, 2014" .SH NAME -mbtowc \- convert a character to a wide-character code +mbtowc, mbtowc_l \- convert a character to a wide-character code .SH SYNOPSIS .LP .nf @@ -17,9 +18,15 @@ mbtowc \- convert a character to a wide-character code \fBint\fR \fBmbtowc\fR(\fBwchar_t *restrict\fR \fIpwc\fR, \fBconst char *restrict\fR \fIs\fR, \fBsize_t\fR \fIn\fR); .fi +.LP +.nf +#include <stdlib.h> +#include <xlocale.h> +\fBint\fR \fBmbtowc_l\fR(\fBwchar_t *restrict\fR \fIpwc\fR, \fBconst char *restrict\fR \fIs\fR, \fBsize_t\fR \fIn\fR, + \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP If \fIs\fR is not a null pointer, \fBmbtowc()\fR determines the number of the bytes that constitute the character pointed to by \fIs\fR. It then determines @@ -28,28 +35,28 @@ that character. (The value of the wide-character code corresponding to the null byte is 0.) If the character is valid and \fIpwc\fR is not a null pointer, \fBmbtowc()\fR stores the wide-character code in the object pointed to by \fIpwc\fR. -.sp .LP A call with \fIs\fR as a null pointer causes this function to return \fB0\fR. The behavior of this function is affected by the \fBLC_CTYPE\fR category of the current locale. At most \fIn\fR bytes of the array pointed to by \fIs\fR will be examined. +.LP +The function \fBmbtowc_l()\fR behaves identically to \fBmbtowc()\fR, except +instead of using the current locale, it uses the locale as specified by +\fIloc\fR. .SH RETURN VALUES -.sp .LP -If \fIs\fR is a null pointer, \fBmbtowc()\fR returns \fB0\fR. If \fIs\fR is not -a null pointer, \fBmbtowc()\fR returns \fB0\fR (if \fIs\fR points to the null +If \fIs\fR is a null pointer, these functions return \fB0\fR. If \fIs\fR is not +a null pointer, they return \fB0\fR (if \fIs\fR points to the null byte), the number of bytes that constitute the converted character (if the next \fIn\fR or fewer bytes form a valid character), or \fB\(mi1\fR and may set \fBerrno\fR to indicate the error (if they do not form a valid character). -.sp .LP In no case will the value returned be greater than \fIn\fR or the value of the \fBMB_CUR_MAX\fR macro. .SH ERRORS -.sp .LP -The \fBmbtowc()\fR function may fail if: +The \fBmbtowc()\fR and \fBmbtowc_l()\fR functions may fail if: .sp .ne 2 .na @@ -58,34 +65,30 @@ The \fBmbtowc()\fR function may fail if: .RS 10n Invalid character sequence is detected. .RE - -.SH USAGE -.sp -.LP -The \fBmbtowc()\fR function can be used safely in multithreaded applications, -as long as \fBsetlocale\fR(3C) is not being called to change the locale. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; -l | l +c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE +.LP +The +.B mbtowc() +function is Standard. The +.B mbtowc_l() +function is Uncommitted. .SH SEE ALSO -.sp .LP -\fBmblen\fR(3C), \fBmbstowcs\fR(3C), \fBsetlocale\fR(3C), \fBwcstombs\fR(3C), -\fBwctomb\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) +\fBmblen\fR(3C), \fBmbstowcs\fR(3C), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBwcstombs\fR(3C), \fBwctomb\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/newlocale.3c b/usr/src/man/man3c/newlocale.3c new file mode 100644 index 0000000000..7fa9048211 --- /dev/null +++ b/usr/src/man/man3c/newlocale.3c @@ -0,0 +1,191 @@ +'\" te +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2014 Joyent, Inc. All rights reserved. +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> +.\" +.TH NEWLOCALE 3C "Jun 23, 2014" +.SH NAME +duplocale, freelocale, newlocale \- create, duplicate, and destroy locale objects +.SH SYNOPSIS +.LP +.nf +#include <locale.h> + +\fBlocale_t\fR \fBnewlocale\fR(\fBint\fR \fIcategory_mask\fR, \fBconst char *\fR \fIlocale\fR, + \fBlocale_t\fR \fIbase\fR); +.fi +.LP +.nf +\fBlocale_t\fR \fBduplocale\fR(\fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBvoid\fR \fBfreelocale\fR(\fBlocale_t\fR \fIloc\fR); +.fi +.SH DESCRIPTION +.LP +These functions manipulate locale objects that can be used +.BR uselocale (3C) +and functions that take arguments of type +.BR locale_t . +.LP +The function +.B newlocale() +can be used to create a new locale object. It can also be used to modify an +existing locale object, the new locale object will be a replacement for the +modified locale object. To create a new locale, the argument +.I base +should be passed the special argument +.RB ( locale_t )0. +This will use a copy of the current global locale as a starting point. To modify +an existing locale object, it should be passed in as the argument +.IR base . +The new locale object is constructed by taking the categories specified in +.I category_mask +from the locale specified by the string +.IR locale , +and filling in the remaining categories from the locale +.IR base . +When +.B newlocale() +returns, callers must no longer use +.IR base +and assume that +.BR freelocale (3C) +has been called on it. In addition to locales defined on the system, the +following three locales may always be passed in as the string +.IR locale : +.TP +"C" +Specifies the traditional UNIX system behavior. +.TP +"POSIX" +An alternate name fo the locale "C". +.TP +"" +Indicates that the locale should be processed based in the values in the +environment. See +.BR setlocale (3C) +and +.BR environ (5) +for more information. +.LP +The value of +.I category_mask +is a bitwise-inclusive or of the following macros which correspond to categories +as defined in +.BR locale (5) +and +.BR environ (5): +.TP +.B LC_CTYPE_MASK +Character classification and case conversion. +.TP +.B LC_NUMERIC_MASK +Numeric formatting. +.TP +.B LC_TIME_MASK +Date and time formatting. +.TP +.B LC_COLLATE_MASK +Collation order. +.TP +.B LC_MONETARY_MASK +Monetary formatting. +.TP +.B LC_MESSAGES_MASK +Formats of informative and diagnostic messages and interactive responses. +.TP +.B LC_ALL_MASK +Mask of all categories. +.LP +The function +.B duplocale() +duplicates the locale object specified by +.IR loc . +If the locale object passed is +.BR LC_GLOBAL_LOCALE , +.B duplocale() +creates a copy of the current global locale as defined through calls to +.BR setlocale (3C). +.LP +The function +.B freelocale() +removes and releases all resources associated with the locale object +.IR loc . +Programs must not call +.B freelocale() +on +.BR LC_GLOBAL_LOCALE . +.SH RETURN VALUES +.LP +On success, the functions +.B newlocale() +and +.B duplocale() +return a new locale object that can be used with functions that take a +.BR locale_t . +Locale objects created this way should be freed with +.BR freelocale() . +On error, the functions +.B newlocale() +and +.B duplocale() +return +.BR (locale_t) 0 +and +.B errno +is set to indicate the error. The +.B freelocale() +function does not set +.B errno. +.SH ERRORS +.LP +The +.B newlocale() +and +.B duplocale() +functions will fail if: +.TP +.B ENOMEM +Insufficient memory was available to create the locale object or to load the +requested locale data. +.LP +The +.B newlocale() +function will fail if: +.TP +.B EINVAL +An unknown bit is specified in +.IR category_mask . +.TP +.B ENOENT +Locale data was not found for a category specified in +.SH ATTRIBUTES +.TS +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE +_ +Interface Stability Standard +_ +MT-Level Safe +.TE + +.SH SEE ALSO +.BR locale (1), +.BR setlocale (3C), +.BR uselocale (3C), +.BR environ (5), +.BR locale (5) diff --git a/usr/src/man/man3c/nl_langinfo.3c b/usr/src/man/man3c/nl_langinfo.3c index b735a034df..d3ac6e961e 100644 --- a/usr/src/man/man3c/nl_langinfo.3c +++ b/usr/src/man/man3c/nl_langinfo.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright 1989 AT&T Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH NL_LANGINFO 3C "Jul 24, 2002" +.TH NL_LANGINFO 3C "Jun 24, 2014" .SH NAME -nl_langinfo \- language information +nl_langinfo, nl_langinfo_l \- language information .SH SYNOPSIS .LP .nf @@ -17,43 +18,36 @@ nl_langinfo \- language information \fBchar *\fR\fBnl_langinfo\fR(\fBnl_item\fR \fIitem\fR); .fi - +.LP +.nf +\fBchar *\fR\fBnl_langinfo_l\fR(\fBnl_item\fR \fIitem\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBnl_langinfo()\fR function returns a pointer to a null-terminated string containing information relevant to a particular language or cultural area defined in the programs locale. The manifest constant names and values of \fIitem\fR are defined by <\fBlanginfo.h\fR>. For example: -.sp -.LP -\fBnl_langinfo (ABDAY_1);\fR -.sp +.IP +\fBnl_langinfo\fR(\fBABDAY_1\fR); .LP would return a pointer to the string "\fBDim\fR" if the identified language was French and a French locale was correctly installed; or "\fBSun\fR" if the identified language was English. +.LP +The function \fBnl_langinfo_l()\fR behaves identically to \fBnl_langinfo()\fR, +except instead of acting in the current locale, it instead acts in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP -If \fBsetlocale\fR(3C) has not been called successfully, or if data for a +If the locale has not been set or is invalid, or if data for a supported language is either not available, or if \fIitem\fR is not defined -therein, then \fBnl_langinfo()\fR returns a pointer to the corresponding string -in the C locale. In all locales, \fBnl_langinfo()\fR returns a pointer to an +therein, then these functions return a pointer to the corresponding string +in the C locale. In all locales, they return a pointer to an empty string if \fIitem\fR contains an invalid setting. -.SH USAGE -.sp -.LP -The \fBnl_langinfo()\fR function can be used safely in multithreaded -applications, as long as \fBsetlocale\fR(3C) is not being called to change the -locale. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -64,16 +58,15 @@ CSI Enabled _ Interface Stability Standard _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP -\fBsetlocale\fR(3C), \fBlanginfo.h\fR(3HEAD), \fBnl_types.h\fR(3HEAD), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBlanginfo.h\fR(3HEAD), \fBnl_types.h\fR(3HEAD), \fBattributes\fR(5), \fBstandards\fR(5) .SH WARNINGS -.sp .LP The array pointed to by the return value should not be modified by the program. -Subsequent calls to \fBnl_langinfo()\fR may overwrite the array. +Subsequent calls to these functions may overwrite the array. diff --git a/usr/src/man/man3c/strcoll.3c b/usr/src/man/man3c/strcoll.3c index b79c41af17..d1a3de385b 100644 --- a/usr/src/man/man3c/strcoll.3c +++ b/usr/src/man/man3c/strcoll.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T .\" Portions Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved. @@ -9,9 +10,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH STRCOLL 3C "Nov 1, 2003" +.TH STRCOLL 3C "Jun 23, 2014" .SH NAME -strcoll \- string collation +strcoll, strcoll_l \- string collation .SH SYNOPSIS .LP .nf @@ -19,40 +20,43 @@ strcoll \- string collation \fBint\fR \fBstrcoll\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi +.LP +.nf +\fBint\fR \fBstrcoll_l\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP Both \fBstrcoll()\fR and \fBstrxfrm\fR(3C) provide for locale-specific string sorting. \fBstrcoll()\fR is intended for applications in which the number of comparisons per string is small. When strings are to be compared a number of times, \fBstrxfrm\fR(3C) is a more appropriate function because the transformation process occurs only once. -.sp +.LP +The \fBstrcoll_l()\fR function behaves +identically to \fBstrcoll()\fR, except instead of operating in the current +locale, it operates in the locale specified by \fIloc\fR. .LP The \fBstrcoll()\fR function does not change the setting of \fBerrno\fR if successful. -.sp .LP Since no return value is reserved to indicate an error, an application wishing to check for error situations should set \fBerrno\fR to 0, then call \fBstrcoll()\fR, then check \fBerrno\fR. .SH RETURN VALUES -.sp .LP Upon successful completion, \fBstrcoll()\fR returns an integer greater than, equal to, or less than zero in direct correlation to whether string \fIs1\fR is greater than, equal to, or less than the string \fIs2\fR. The comparison is -based on strings interpreted as appropriate to the program's locale for +based on strings interpreted as appropriate to the locale category \fBLC_COLLATE\fR (see \fBsetlocale\fR(3C)). -.sp .LP On error, \fBstrcoll()\fR may set \fBerrno\fR, but no return value is reserved to indicate an error. .SH ERRORS .sp .LP -The \fBstrcoll()\fR function may fail if: +The \fBstrcoll()\fR and \fBstrcoll_l()\fR functions may fail if: .sp .ne 2 .na @@ -62,25 +66,14 @@ The \fBstrcoll()\fR function may fail if: The \fIs1\fR or \fIs2\fR arguments contain characters outside the domain of the collating sequence. .RE - .SH FILES -.sp -.ne 2 -.na -\fB\fB/usr/lib/locale/\fIlocale\fR/\fIlocale\fR.so.*\fR\fR -.ad -.sp .6 -.RS 4n -\fBLC_COLLATE\fR database for \fIlocale\fR +.IP \fB/usr/lib/locale/\fR\fIlocale\fR\fB/LC_COLLATE/*\fR +collation database for \fIlocale\fR .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -91,15 +84,12 @@ CSI Enabled _ Interface Stability Standard _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE -.sp -.LP -The \fBstrcoll()\fR function can be used safely in multithreaded applications, -as long as \fBsetlocale\fR(3C) is not being called to change the locale. .SH SEE ALSO .sp .LP -\fBlocaledef\fR(1), \fBsetlocale\fR(3C), \fBstring\fR(3C), \fBstrxfrm\fR(3C), +\fBlocaledef\fR(1), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBstring\fR(3C), +\fBstrxfrm\fR(3C), \fBuselocale\fR(3C), \fBwsxfrm\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/strfmon.3c b/usr/src/man/man3c/strfmon.3c new file mode 100644 index 0000000000..04eb03d384 --- /dev/null +++ b/usr/src/man/man3c/strfmon.3c @@ -0,0 +1,164 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> +.\" +.TH STRFMON 3C "Jun 23, 2014" +.SH NAME +strfmon, strfmon_l \- convert monetary values to string +.SH SYNOPSIS +.LP +.nf +#include <monetary.h> + +\fBssize_t\fR \fBstrfmon\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR, + \fBconst char *restrict\fR \fIformat\fR, ...); +.fi +.LP +.nf +\fBssize_t\fR \fBstrfmon_l\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR, + \fBlocale_t\fR \fIloc\fR, \fBconst char *restrict\fR \fIformat\fR, ...); +.fi +.SH DESCRIPTION +These functions are used to format strings containing numeric quantities using +rules that are specific to a given locale. For example, in the United States, +currencies are formatted using the dollar sign +.RB ( $ ) +and include two decimal digits (cents). +.LP +Each character from the +.I format +is copied to the output buffer supplied by +.IR s . +Furthermore, when a percent +.RB ( % ) +character is encountered, this triggers an expansion, as follows: +.LP +Immediately following the +.B % +character there shall be zero or more flags, as indicated below: +.TP +.BI = f +An equals sign followed by a character +.I f +is the numeric fill +character, which must be a single byte. The default fill character is <space>. +.TP +.B ^ +The carat suppresses the use of grouping characters, even if the +locale indicates their use. +.TP +.B + +The plus sign indicates that positive and negative numbers should use the +locale's positive and negative signs. This may not be used with the open +parenthesis. This behavior is default. +.TP +.B ( +The open parenthesis indicates that negative numbers should be enclosed +within parenthesis, and no special formatting should be applied to positive +values. This may not be supplied with the plus sign flag. +.TP +.B ! +The exclamation point suppresses the output of any currency symbol. +.TP +.B - +The dash specifies that numeric values should be left-justified +within a field width, if a field width is specified. +.LP +Next there may appear an optional minimum field width, specified as a string of +decimal digits, indicating a minimum width in bytes of this fields. +.LP +Next there may appear a left precision, as +.RI # p , +indicating the maximum +number of digits expected to appear left of the radix character. (If a numeric +value does not require this many places, including grouping separators, then +the numeric fill character is used to pad the value to this many places.) +.LP +Next there may appear a right precision, as +.RI . p , +indicating the minimum +number of digits to appear to to the right of the radix character. If the +value of +.I p +is zero, then the radix character is also suppressed. +.LP +Finally there shall appear one of the following conversion specifier +characters: +.TP +.B i +The next available argument (assumed to be +.BR double ) +is formatted, using +the locale's international currency format. For example, in the United States, +the output might look like "USD 1,234.56". +.TP +.B n +The next available argument (assumed to be +.BR double ) +is formatted, using +the locale's national currency format. For example, in the United States, the +output might look like "$1,234.56". +.TP +.B % +A single percent character is emitted. In this case, the entire specifier +shall be +.BR %% . +.LP +Whereas the +.B strfmon() +function uses the current locale, the +.B strfmon_l() +function uses the supplied locale +.IR loc . +.SH RETURN VALUES +.LP +If the conversion was successfully performed, and the entire result (including +the terminating null character) fits in +.I maxsize +bytes, then the number of +bytes placed in the buffer (excluding the terminating null character) is +returned. +.LP +If the result of expansion exceeds +.I maxsize +bytes, then the value \(mi1 is returned, and +.I errno +is set to +.BR E2BIG . +.SH NOTES +The result of formatting a value that is not a rational number (e.g. +NaN) is +unspecified. +.SH ATTRIBUTES +.LP +See +.BR attributes (5) +for descriptions of the following attributes: +.TS +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE +_ +CSI Enabled +_ +Interface Stability Standard +_ +MT-Level MT-Safe +.TE + +.SH SEE ALSO +.BR setlocale (3C), +.BR uselocale (3C), +.BR locale (3HEAD), +.BR attributes (5), +.BR standards (5) + diff --git a/usr/src/man/man3c/strftime.3c b/usr/src/man/man3c/strftime.3c index f2b8eff328..83e1fce77a 100644 --- a/usr/src/man/man3c/strftime.3c +++ b/usr/src/man/man3c/strftime.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 2014 Gary Mills .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T @@ -10,9 +11,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH STRFTIME 3C "Jan 3, 2014" +.TH STRFTIME 3C "Jun 24, 2014" .SH NAME -strftime, cftime, ascftime \- convert date and time to string +strftime, strftime_l cftime, ascftime \- convert date and time to string .SH SYNOPSIS .LP .nf @@ -22,12 +23,16 @@ strftime, cftime, ascftime \- convert date and time to string \fBconst char *restrict\fR \fIformat\fR, \fBconst struct tm *restrict\fR \fItimeptr\fR); .fi - +.LP +.nf +\fBsize_t\fR \fBstrftime_l\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR, + \fBconst char *restrict\fR \fIformat\fR, + \fBconst struct tm *restrict\fR \fItimeptr\fR, \fBlocale_t\fR \fIloc\fR); +.fi .LP .nf \fBint\fR \fBcftime\fR(\fBchar *\fR\fIs\fR, \fBchar *\fR\fIformat\fR, \fBconst time_t *\fR\fIclock\fR); .fi - .LP .nf \fBint\fR \fBascftime\fR(\fBchar *\fR\fIs\fR, \fBconst char *\fR\fIformat\fR, @@ -37,7 +42,8 @@ strftime, cftime, ascftime \- convert date and time to string .SH DESCRIPTION .sp .LP -The \fBstrftime()\fR, \fBascftime()\fR, and \fBcftime()\fR functions place +The \fBstrftime()\fR, \fBstrftime_l()\fR, \fBascftime()\fR, and \fBcftime()\fR +functions place bytes into the array pointed to by \fIs\fR as controlled by the string pointed to by \fIformat\fR. The \fIformat\fR string consists of zero or more conversion specifications and ordinary characters. A conversion specification consists of @@ -46,8 +52,9 @@ characters that determine the conversion specification's behavior. All ordinary characters (including the terminating null byte) are copied unchanged into the array pointed to by \fIs\fR. If copying takes place between objects that overlap, the behavior is undefined. For \fBstrftime()\fR, no more than -\fImaxsize\fR bytes are placed into the array. -.sp +\fImaxsize\fR bytes are placed into the array. The \fBstrftime_l()\fR function +behaves identically to \fBstrftime()\fR function, but instead of operating in +the current locale, it operates in the locale specified by \fIloc\fR. .LP If \fIformat\fR is \fB(char *)0\fR, then the locale's default format is used. For \fBstrftime()\fR the default format is the same as \fB%c\fR; for @@ -55,7 +62,6 @@ For \fBstrftime()\fR the default format is the same as \fB%c\fR; for \fBcftime()\fR and \fBascftime()\fR first try to use the value of the environment variable \fBCFTIME\fR, and if that is undefined or empty, the default format is used. -.sp .LP Each conversion specification is replaced by appropriate characters as described in the following list. The appropriate characters are determined by @@ -465,12 +471,10 @@ Time zone name or abbreviation, or no bytes if no time zone information exists. Locale's date and time representation as produced by \fBdate\fR(1). .RE -.sp .LP If a conversion specification does not correspond to any of the above or to any of the modified conversion specifications listed below, the behavior is undefined and \fB0\fR is returned. -.sp .LP The difference between \fB%U\fR and \fB%W\fR (and also between modified conversion specifications \fB%OU\fR and \fB%OW\fR) lies in which day is counted @@ -479,7 +483,6 @@ with a Sunday for \fB%U\fR or a Monday for \fB%W\fR. Week number 0 contains those days before the first Sunday or Monday in January for \fB%U\fR and \fB%W\fR, respectively. .SS "Modified Conversion Specifications" -.sp .LP Some conversion specifications can be modified by the \fBE\fR and \fBO\fR modifiers to indicate that an alternate format or specification should be used @@ -681,20 +684,16 @@ the locale's alternate numeric symbols. .RE .SS "Selecting the Output Language" -.sp .LP -By default, the output of \fBstrftime()\fR, \fBcftime()\fR, and -\fBascftime()\fR appear in U.S. English. The user can request that the output -of \fBstrftime()\fR, \fBcftime()\fR, or \fBascftime()\fR be in a specific -language by setting the \fBLC_TIME\fR category using \fBsetlocale()\fR. +These routines produce output that is formatted according to the \fBLC_TIME\fR +locale category. They use either the current locale, or in the case of +\fBstrftime_l()\fR, the locale supplied by \fIloc\fR. .SS "Time Zone" -.sp .LP Local time zone information is used as though \fBtzset\fR(3C) were called. .SH RETURN VALUES -.sp .LP -The \fBstrftime()\fR, \fBcftime()\fR, and \fBascftime()\fR functions return the +These functions return the number of characters placed into the array pointed to by \fIs\fR, not including the terminating null character. If the total number of resulting characters including the terminating null character is more than \fImaxsize\fR, @@ -703,31 +702,20 @@ indeterminate. .SH EXAMPLES .LP \fBExample 1 \fRAn example of the \fBstrftime()\fR function. -.sp .LP The following example illustrates the use of \fBstrftime()\fR for the \fBPOSIX\fR locale. It shows what the string in \fIstr\fR would look like if the structure pointed to by \fItmptr\fR contains the values corresponding to Thursday, August 28, 1986 at 12:44:36. - -.sp -.in +2 .nf -\fBstrftime (str, strsize, "%A %b %d %j", tmptr)\fR +.IP +\fBstrftime\fR(\fIstr\fR, \fIstrsize\fR, "%A %b %d %j", \fItmptr\fR); .fi -.in -2 - -.sp .LP This results in \fIstr\fR containing "Thursday Aug 28 240". - .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -736,24 +724,25 @@ ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability Committed +Interface Stability See below. _ MT-Level MT-Safe _ Standard See below. .TE -.sp .LP -For \fBstrftime()\fR, see \fBstandards\fR(5). +The \fBstrftime()\fR and \fBstrftime_l()\fR functions are Standard. +\fBcftime()\fR and \fBascftime()\fR functions are Committed. +.LP +For \fBstrftime()\fR and \fBstrftime_l()\fR, see \fBstandards\fR(5). .SH SEE ALSO -.sp .LP -\fBdate\fR(1), \fBctime\fR(3C), \fBmktime\fR(3C), \fBsetlocale\fR(3C), -\fBstrptime\fR(3C), \fBtzset\fR(3C), \fBTIMEZONE\fR(4), \fBzoneinfo\fR(4), +\fBdate\fR(1), \fBctime\fR(3C), \fBmktime\fR(3C), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBstrptime\fR(3C), \fBtzset\fR(3C), +\fBuselocale\fR(3C), \fBTIMEZONE\fR(4), \fBzoneinfo\fR(4), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) .SH NOTES -.sp .LP The conversion specification for \fB%V\fR was changed in the Solaris 7 release. This change was based on the public review draft of the ISO C9x standard at @@ -761,24 +750,19 @@ that time. Previously, the specification stated that if the week containing 1 January had fewer than four days in the new year, it became week 53 of the previous year. The ISO C9x standard committee subsequently recognized that that specification had been incorrect. -.sp .LP The conversion specifications for \fB%g\fR, \fB%G\fR, \fB%Eg\fR, \fB%EG\fR, and \fB%Og\fR were added in the Solaris 7 release. This change was based on the -public review draft of the ISO C9x standard at that time. These specifications -are evolving. If the ISO C9x standard is finalized with a different -conclusion, these specifications will change to conform to the ISO C9x standard -decision. -.sp +public review draft of the ISO C9x standard at that time. The \fB%g\fR and +\fB%G\fR specifications were adopted in the formal standard. The other two +were not, and should not be used in portable applications. .LP The conversion specification for \fB%u\fR was changed in the Solaris 8 release. This change was based on the XPG4 specification. -.sp .LP If using the \fB%Z\fR specifier and \fBzoneinfo\fR timezones and if the input date is outside the range 20:45:52 UTC, December 13, 1901 to 03:14:07 UTC, January 19, 2038, the timezone name may not be correct. -.sp .LP The conversion specification for \fB%+\fR was added in illumos. It is not part of any standard, although it is available on a number diff --git a/usr/src/man/man3c/string.3c b/usr/src/man/man3c/string.3c index 9bc9e4f3bf..cd2dacbedf 100644 --- a/usr/src/man/man3c/string.3c +++ b/usr/src/man/man3c/string.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T .\" Portions Copyright (c) 1994 Man-cgi 1.15, Panagiotis Christias (christia@softlab.ntua.gr) @@ -11,9 +12,10 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH STRING 3C "Jun 19, 2013" +.TH STRING 3C "Jun 21, 2013" .SH NAME -string, strcasecmp, strncasecmp, strcat, strncat, strlcat, strchr, strrchr, +string, strcasecmp, strcasecmp_l, strncasecmp, strncasecmp_l, strcat, strncat, +strlcat, strchr, strrchr, strcmp, strncmp, strcpy, strncpy, strlcpy, strcspn, strspn, strdup, strlen, strnlen, strpbrk, strsep, strstr, strtok, strtok_r \- string operations .SH SYNOPSIS @@ -23,115 +25,101 @@ strnlen, strpbrk, strsep, strstr, strtok, strtok_r \- string operations \fBint\fR \fBstrcasecmp\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - +.LP +.nf +\fBint\fR \fBstrcasecmp_l\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR, \fBlocale_t\fR \fIloc\fR); +.fi .LP .nf \fBint\fR \fBstrncasecmp\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR, \fBsize_t\fR \fIn\fR); .fi - +.LP +.nf +\fBint\fR \fBstrncasecmp_l\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR, \fBsize_t\fR \fIn\fR, \fBlocale_t\fR \fIloc\fR); +.fi .LP .nf #include <string.h> \fBchar *\fR\fBstrcat\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR); .fi - .LP .nf \fBchar *\fR\fBstrncat\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR); .fi - .LP .nf \fBsize_t\fR \fBstrlcat\fR(\fBchar *\fR\fIdst\fR, \fBconst char *\fR\fIsrc\fR, \fBsize_t\fR \fIdstsize\fR); .fi - .LP .nf \fBchar *\fR\fBstrchr\fR(\fBconst char *\fR\fIs\fR, \fBint\fR \fIc\fR); .fi - .LP .nf \fBchar *\fR\fBstrrchr\fR(\fBconst char *\fR\fIs\fR, \fBint\fR \fIc\fR); .fi - .LP .nf \fBint\fR \fBstrcmp\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .LP .nf \fBint\fR \fBstrncmp\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR, \fBsize_t\fR \fIn\fR); .fi - .LP .nf \fBchar *\fR\fBstrcpy\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR); .fi - .LP .nf \fBchar *\fR\fBstrncpy\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR); .fi - .LP .nf \fBsize_t\fR \fBstrlcpy\fR(\fBchar *\fR\fIdst\fR, \fBconst char *\fR\fIsrc\fR, \fBsize_t\fR \fIdstsize\fR); .fi - .LP .nf \fBsize_t\fR \fBstrcspn\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .LP .nf \fBsize_t\fR \fBstrspn\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .LP .nf \fBchar *\fR\fBstrdup\fR(\fBconst char *\fR\fIs1\fR); .fi - .LP .nf \fBsize_t\fR \fBstrlen\fR(\fBconst char *\fR\fIs\fR); .fi - .LP .nf \fBsize_t\fR \fBstrnlen\fR(\fBconst char *\fR\fIs\fR, \fBsize_t\fR \fIn\fR); .fi - .LP .nf \fBchar *\fR\fBstrpbrk\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .LP .nf \fBchar *\fR\fBstrsep\fR(\fBchar **\fR\fIstringp\fR, \fBconst char *\fR\fIdelim\fR); .fi - .LP .nf \fBchar *\fR\fBstrstr\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .LP .nf \fBchar *\fR\fBstrtok\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR); .fi - .LP .nf \fBchar *\fR\fBstrtok_r\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBchar **restrict\fR \fIlasts\fR); .fi - .SS "ISO C++" .LP .nf @@ -139,46 +127,37 @@ strnlen, strpbrk, strsep, strstr, strtok, strtok_r \- string operations \fBconst char *\fR\fBstrchr\fR(\fBconst char *\fR\fIs\fR, \fBint\fR \fIc\fR); .fi - .LP .nf \fBconst char *\fR\fBstrpbrk\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .LP .nf \fBconst char *\fR\fBstrrchr\fR(\fBconst char *\fR\fIs\fR, \fBint\fR \fIc\fR); .fi - .LP .nf \fBconst char *\fR\fBstrstr\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .LP .nf #include <cstring> \fBchar *std::\fR\fBstrchr\fR(\fBchar *\fR\fIs\fR, \fBint\fR \fIc\fR); .fi - .LP .nf \fBchar *std::\fR\fBstrpbrk\fR(\fBchar *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .LP .nf \fBchar *std::\fR\fBstrrchr\fR(\fBchar *\fR\fIs\fR, \fBint\fR \fIc\fR); .fi - .LP .nf \fBchar *std::\fR\fBstrstr\fR(\fBchar *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR); .fi - .SH DESCRIPTION -.sp .LP The arguments \fIs\fR, \fIs1\fR, and \fIs2\fR point to strings (arrays of characters terminated by a null character). The \fBstrcat()\fR, @@ -191,10 +170,27 @@ all alter their first argument. Additionally, the \fBstrcat()\fR and .LP The \fBstrcasecmp()\fR and \fBstrncasecmp()\fR functions are case-insensitive versions of \fBstrcmp()\fR and \fBstrncmp()\fR respectively, described below. -They assume the \fBASCII\fR character set and ignore differences in case when -comparing lower and upper case characters. +.LP +The \fBstrcasecmp()\fR and \fBstrncasecmp()\fR functions compare two strings +byte-by-byte, after +converting each upper-case character to lower-case (as determined by the +\fBLC_CTYPE\fR category of the current locale). Note that neither the contents +pointed to by \fIs1\fR nor \fIs2\fR are modified. +.LP +The functions return an integer +greater than, equal to, or less than 0, if the string pointed to by \fIs1\fR +is greater than, equal to, or less than the string pointed to by \fIs2\fR +respectively. The sign of a non-zero return value is determined by the sign of +the difference between the values of the first pair of bytes that differ in the +.LP +The \fBstrncasecmp()\fR function examines at most \fIn\fR bytes from each +string. +.SS "\fBstrcasecmp_l()\fR, \fBstrncasecmp_l()\fR" +.LP +The \fBstrcasecmp_l()\fR and \fBstrncasecmp_l()\fR functions behave identically +to \fBstrcasecmp()\fR and \fBstrncasecmp()\fR, except instead of operating in +the current locale, they instead operate in the locale specified by \fIloc\fR. .SS "\fBstrcat()\fR, \fBstrncat()\fR, \fBstrlcat()\fR" -.sp .LP The \fBstrcat()\fR function appends a copy of string \fIs2\fR, including the terminating null character, to the end of string \fIs1\fR. The \fBstrncat()\fR @@ -203,7 +199,6 @@ null-terminated result. The initial character of \fIs2\fR overrides the null character at the end of \fIs1\fR. If copying takes place between objects that overlap, the behavior of \fBstrcat()\fR, \fBstrncat()\fR, and \fBstrlcat()\fR is undefined. -.sp .LP The \fBstrlcat()\fR function appends at most (\fIdstsize\fR-\fBstrlen\fR(\fIdst\fR)-1) characters of \fIsrc\fR to \fIdst\fR @@ -225,9 +220,7 @@ if (strlcat(dst, src, dstsize) >= dstsize) return \(mi1; .fi .in -2 - .SS "\fBstrchr()\fR, \fBstrrchr()\fR" -.sp .LP The \fBstrchr()\fR function returns a pointer to the first occurrence of \fIc\fR (converted to a \fBchar\fR) in string \fIs\fR, or a null pointer if @@ -235,7 +228,6 @@ The \fBstrchr()\fR function returns a pointer to the first occurrence of pointer to the last occurrence of \fIc\fR. The null character terminating a string is considered to be part of the string. .SS "\fBstrcmp()\fR, \fBstrncmp()\fR" -.sp .LP The \fBstrcmp()\fR function compares two strings byte-by-byte, according to the ordering of your machine's character set. The function returns an integer @@ -247,7 +239,6 @@ strings being compared. The \fBstrncmp()\fR function makes the same comparison but looks at a maximum of \fIn\fR bytes. Bytes following a null byte are not compared. .SS "\fBstrcpy()\fR, \fBstrncpy()\fR, \fBstrlcpy()\fR" -.sp .LP The \fBstrcpy()\fR function copies string \fIs2\fR to \fIs1\fR, including the terminating null character, stopping after the null character has been copied. @@ -256,7 +247,6 @@ or adding null characters to \fIs1\fR if necessary. The result will not be null-terminated if the length of \fIs2\fR is \fIn\fR or more. Each function returns \fIs1\fR. If copying takes place between objects that overlap, the behavior of \fBstrcpy()\fR, \fBstrncpy()\fR, and \fBstrlcpy()\fR is undefined. -.sp .LP The \fBstrlcpy()\fR function copies at most \fIdstsize\fR\(mi1 characters (\fIdstsize\fR being the size of the string buffer \fIdst\fR) from \fIsrc\fR @@ -272,14 +262,12 @@ if (strlcpy(dst, src, dstsize) >= dstsize) .in -2 .SS "\fBstrcspn()\fR, \fBstrspn()\fR" -.sp .LP The \fBstrcspn()\fR function returns the length of the initial segment of string \fIs1\fR that consists entirely of characters not from string \fIs2\fR. The \fBstrspn()\fR function returns the length of the initial segment of string \fIs1\fR that consists entirely of characters from string \fIs2\fR. .SS "\fBstrdup()\fR" -.sp .LP The \fBstrdup()\fR function returns a pointer to a new string that is a duplicate of the string pointed to by \fIs1\fR. The returned pointer can be @@ -289,23 +277,19 @@ returned and \fBerrno\fR may be set to \fBENOMEM\fR to indicate that the storage space available is insufficient. .SS "\fBstrlen()\fR, \fBstrnlen()\fR" .sp -.LP The \fBstrlen()\fR function returns the number of bytes in \fIs\fR, not including the terminating null character. -.sp .LP The \fBstrnlen()\fR function returns the smaller of \fIn\fR or the number of bytes in \fIs\fR, not including the terminating null character. The \fBstrnlen()\fR function never examines more than \fIn\fR bytes of the string pointed to by \fIs\fR. .SS "\fBstrpbrk()\fR" -.sp .LP The \fBstrpbrk()\fR function returns a pointer to the first occurrence in string \fIs1\fR of any character from string \fIs2\fR, or a null pointer if no character from \fIs2\fR exists in \fIs1\fR. .SS "\fBstrsep()\fR" -.sp .LP The \fBstrsep()\fR function locates, in the null-terminated string referenced by *\fIstringp\fR, the first occurrence of any character in the string @@ -313,16 +297,13 @@ by *\fIstringp\fR, the first occurrence of any character in the string The location of the next character after the delimiter character (or \fINULL\fR, if the end of the string was reached) is stored in *\fIstringp\fR. The original value of *\fIstringp\fR is returned. -.sp .LP An ``empty'' field (one caused by two adjacent delimiter characters) can be detected by comparing the location referenced by the pointer returned by \fBstrsep()\fR to `\e0'. -.sp .LP If *\fIstringp\fR is initially \fINULL\fR, \fBstrsep()\fR returns \fINULL\fR. .SS "\fBstrstr()\fR" -.sp .LP The \fBstrstr()\fR function locates the first occurrence of the string \fIs2\fR (excluding the terminating null character) in string \fIs1\fR and returns a @@ -330,7 +311,6 @@ pointer to the located string, or a null pointer if the string is not found. If \fIs2\fR points to a string with zero length (that is, the string \fB""\fR), the function returns \fIs1\fR. .SS "\fBstrtok()\fR" -.sp .LP A sequence of calls to \fBstrtok()\fR breaks the string pointed to by \fIs1\fR into a sequence of tokens, each of which is delimited by a byte from the string @@ -338,14 +318,12 @@ pointed to by \fIs2\fR. The first call in the sequence has \fIs1\fR as its first argument, and is followed by calls with a null pointer as their first argument. The separator string pointed to by \fIs2\fR can be different from call to call. -.sp .LP The first call in the sequence searches the string pointed to by \fIs1\fR for the first byte that is not contained in the current separator string pointed to by \fIs2\fR. If no such byte is found, then there are no tokens in the string pointed to by \fIs1\fR and \fBstrtok()\fR returns a null pointer. If such a byte is found, it is the start of the first token. -.sp .LP The \fBstrtok()\fR function then searches from there for a byte that is contained in the current separator string. If no such byte is found, the @@ -354,23 +332,19 @@ subsequent searches for a token return a null pointer. If such a byte is found, it is overwritten by a null byte that terminates the current token. The \fBstrtok()\fR function saves a pointer to the following byte in thread-specific data, from which the next search for a token starts. -.sp .LP Each subsequent call, with a null pointer as the value of the first argument, starts searching from the saved pointer and behaves as described above. -.sp .LP See Example 1, 2, and 3 in the \fBEXAMPLES\fR section for examples of \fBstrtok()\fR usage and the explanation in \fBNOTES\fR. .SS "\fBstrtok_r()\fR" -.sp .LP The \fBstrtok_r()\fR function considers the null-terminated string \fIs1\fR as a sequence of zero or more text tokens separated by spans of one or more characters from the separator string \fIs2\fR. The argument \fIlasts\fR points to a user-provided pointer which points to stored information necessary for \fBstrtok_r()\fR to continue scanning the same string. -.sp .LP In the first call to \fBstrtok_r()\fR, \fIs1\fR points to a null-terminated string, \fIs2\fR to a null-terminated string of separator characters, and the @@ -378,21 +352,18 @@ value pointed to by \fIlasts\fR is ignored. The \fBstrtok_r()\fR function returns a pointer to the first character of the first token, writes a null character into \fIs1\fR immediately following the returned token, and updates the pointer to which \fIlasts\fR points. -.sp .LP In subsequent calls, \fIs1\fR is a null pointer and \fIlasts\fR is unchanged from the previous call so that subsequent calls move through the string \fIs1\fR, returning successive tokens until no tokens remain. The separator string \fIs2\fR can be different from call to call. When no token remains in \fIs1\fR, a null pointer is returned. -.sp .LP See Example 3 in the \fBEXAMPLES\fR section for an example of \fBstrtok_r()\fR usage and the explanation in \fBNOTES\fR. .SH EXAMPLES .LP \fBExample 1 \fRSearch for word separators. -.sp .LP The following example searches for tokens separated by space characters. @@ -415,7 +386,6 @@ token = strtok(NULL, search); .LP \fBExample 2 \fRBreak a Line. -.sp .LP The following example uses strtok to break a line into two character strings separated by any combination of SPACEs, TABs, or NEWLINEs. @@ -440,7 +410,6 @@ data = strtok(NULL, " \en"); .LP \fBExample 3 \fRSearch for tokens. -.sp .LP The following example uses both \fBstrtok()\fR and \fBstrtok_r()\fR to search for tokens separated by one or more characters from the string pointed to by @@ -479,7 +448,6 @@ main() { .fi .in -2 -.sp .LP When compiled and run, this example produces the following output: @@ -499,61 +467,55 @@ token = "45" .in -2 .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Committed +Interface Stability See below. _ MT-Level See below. _ Standard See below. .TE -.sp +.LP +The +\fBstrlcat()\fR, \fBstrlcpy()\fR, and \fBstrsep()\fR functions are Committed. +All the rest are Standard. .LP The \fBstrtok()\fR and \fBstrdup()\fR functions are MT-Safe. The remaining functions are Async-Signal-Safe. -.sp .LP For all except \fBstrlcat()\fR, \fBstrlcpy()\fR, and \fBstrsep()\fR, see \fBstandards\fR(5). .SH SEE ALSO -.sp .LP -\fBmalloc\fR(3C), \fBsetlocale\fR(3C), \fBstrxfrm\fR(3C), \fBattributes\fR(5), -\fBstandards\fR(5) +\fBmalloc\fR(3C), +\fBnewlocale(3C), \fBsetlocale\fR(3C), \fBstrxfrm\fR(3C), \fBuselocale\fR(3C), +\fBattributes\fR(5), \fBstandards\fR(5) .SH NOTES -.sp .LP When compiling multithreaded applications, the \fB_REENTRANT\fR flag must be defined on the compile line. This flag should only be used in multithreaded applications. -.sp .LP A single-threaded application can gain access to \fBstrtok_r()\fR only by defining \fB__EXTENSIONS__\fR or by defining \fB_POSIX_C_SOURCE\fR to a value greater than or equal to 199506L. -.sp .LP -All of these functions assume the default locale ``C.'' For some locales, +Except where noted otherwise, all of these functions assume the default +locale ``C.'' For some locales, \fBstrxfrm\fR(3C) should be applied to the strings before they are passed to the functions. -.sp .LP The \fBstrtok()\fR function is safe to use in multithreaded applications because it saves its internal state in a thread-specific data area. However, its use is discouraged, even for single-threaded applications. The \fBstrtok_r()\fR function should be used instead. -.sp .LP Do not pass the address of a character string literal as the argument \fIs1\fR to either \fBstrtok()\fR or \fBstrtok_r()\fR. Similarly, do not pass a pointer diff --git a/usr/src/man/man3c/strptime.3c b/usr/src/man/man3c/strptime.3c index e9c77c9d1f..64a8a43a94 100644 --- a/usr/src/man/man3c/strptime.3c +++ b/usr/src/man/man3c/strptime.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at @@ -8,9 +9,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH STRPTIME 3C "Aug 27, 2007" +.TH STRPTIME 3C "Jun 27, 2014" .SH NAME -strptime \- date and time conversion +strptime, strptime_l \- date and time conversion .SH SYNOPSIS .LP .nf @@ -19,7 +20,15 @@ strptime \- date and time conversion \fBchar *\fR\fBstrptime\fR(\fBconst char *restrict\fR \fIbuf\fR, \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR); .fi +.LP +.nf +#include <time.h> +#include <xlocale.h> +\fBchar *\fR\fBstrptime_l\fR(\fBconst char *restrict\fR \fIbuf\fR, + \fBconst char *restrict\fR \fIformat\fR, \fBstruct tm *restrict\fR \fItm\fR, + \fBlocale_t\fR \fIloc\fR); +.fi .SS "Non-zeroing Behavior" .LP .nf @@ -31,12 +40,12 @@ strptime \- date and time conversion .fi .SH DESCRIPTION -.sp .LP The \fBstrptime()\fR function converts the character string pointed to by \fIbuf\fR to values which are stored in the \fBtm\fR structure pointed to by -\fItm\fR, using the format specified by \fIformat\fR. -.sp +\fItm\fR, using the format specified by \fIformat\fR. The \fBstrptime_l()\fR +function is identical to \fBstrptime()\fR except instead of acting in the +current locale, it acts in the locale specified by the argument \fIloc\fR. .LP The \fIformat\fR argument is composed of zero or more conversion specifications. Each conversion specification is composed of a "%" (percent) @@ -45,12 +54,10 @@ replacement required. One or more white space characters (as specified by \fBisspace\fR(3C)) may precede or follow a conversion specification. There must be white-space or other non-alphanumeric characters between any two conversion specifications. -.sp .LP A non-zeroing version of \fBstrptime()\fR, described below under \fBNon-zeroing Behavior\fR, is provided if \fB_STRPTIME_DONTZERO\fR is defined. .SS "Conversion Specifications" -.sp .LP The following conversion specifications are supported: .sp @@ -360,7 +367,6 @@ Time zone name or no characters if no time zone exists. .RE .SS "Modified Conversion Specifications" -.sp .LP Some conversion specifications can be modified by the \fBE\fR and \fBO\fR modifier characters to indicate that an alternate format or specification @@ -525,7 +531,6 @@ the locale's alternate numeric symbols. .RE .SS "General Specifications" -.sp .LP A conversion specification that is an ordinary character is executed by scanning the next character from the buffer. If the character scanned from the @@ -537,7 +542,6 @@ A series of specifications composed of \fB%n\fR, \fB%t\fR, white-space characters or any combination is executed by scanning up to the first character that is not white space (which remains unscanned), or until no more characters can be scanned. White space is defined by \fBisspace\fR(3C). -.sp .LP Any other conversion specification is executed by scanning characters until a character matching the next specification is scanned, or until no more @@ -554,7 +558,6 @@ consist of any combination of upper and lower case letters. The user can request that the input date or time specification be in a specific language by setting the \fBLC_TIME\fR category using \fBsetlocale\fR(3C). .SS "Non-zeroing Behavior" -.sp .LP In addition to the behavior described above by various standards, the Solaris implementation of \fBstrptime()\fR provides the following extensions. These may @@ -577,7 +580,6 @@ If \fB_STRPTIME_DONTZERO\fR is defined, \fBstrptime()\fR does not zero the will use some values in the input \fBtm struct\fR to recalculate the date and re-assign the appropriate members of the \fBtm struct\fR. .RE -.sp .LP The following describes extended features regardless of whether \fB_STRPTIME_DONTZERO\fR is defined or not defined: @@ -597,7 +599,6 @@ If \fB%U\fR or \fB%W\fR is specified and if weekday and year are given and month and day of month are not given, \fBstrptime()\fR calculates and sets \fBtm_mon\fR, \fBtm_mday\fR, \fBtm_wday\fR, and \fBtm_year\fR. .RE -.sp .LP The following describes extended features when \fB_STRPTIME_DONTZERO\fR is not defined: @@ -608,7 +609,6 @@ defined: If \fB%C\fR is specified and \fB%y\fR is not specified, \fBstrptime()\fRassumes 0 as the year offset, then calculates the year, and assigns \fBtm_year\fR. .RE -.sp .LP The following describes extended features when \fB_STRPTIME_DONTZERO\fR is defined: @@ -654,17 +654,14 @@ input is p.m. and the input \fBtm_hour\fR value is between 0 - 11, \fBstrptime()\fR will subtract 12 hours and update \fBtm_hour\fR. .RE .SH RETURN VALUES -.sp .LP Upon successful completion, \fBstrptime()\fR returns a pointer to the character following the last character parsed. Otherwise, a null pointer is returned. .SH USAGE -.sp .LP Several "same as" formats, and the special processing of white-space characters are provided in order to ease the use of identical \fIformat\fR strings for \fBstrftime\fR(3C) and \fBstrptime()\fR. -.sp .LP The \fBstrptime()\fR function tries to calculate \fBtm_year\fR, \fBtm_mon\fR, and \fBtm_mday\fR when given incomplete input. This allows the \fBstruct tm\fR @@ -675,12 +672,8 @@ created by \fBstrptime()\fR to be passed to \fBmktime\fR(3C) to produce a in \fBtm_yday\fR when \fB%j\fR is specified without otherwise specifying a month and day within month. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -689,16 +682,20 @@ ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability Committed +Interface Stability See below. _ MT-Level MT-Safe _ -Standard See \fBstandards\fR(5). +Standard See \fBstandards\fR(5) for \fBstrptime()\fR. .TE +.LP +The \fBstrptime()\fR function is Standard. The \fBstrptime_l()\fR function +is Uncommitted. .SH SEE ALSO -.sp .LP \fBctime\fR(3C), \fBgetdate\fR(3C), \fBisspace\fR(3C), \fBmktime\fR(3C), -\fBsetlocale\fR(3C), \fBstrftime\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), +\fBnewlocale\fR(3C), +\fBsetlocale\fR(3C), \fBstrftime\fR(3C), \fBuselocale\fR(3C), +\fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/strxfrm.3c b/usr/src/man/man3c/strxfrm.3c index 3a1cc8da90..3781a9164f 100644 --- a/usr/src/man/man3c/strxfrm.3c +++ b/usr/src/man/man3c/strxfrm.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright 1989 AT&T. Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH STRXFRM 3C "Dec 10, 2003" +.TH STRXFRM 3C "Jun 21, 2014" .SH NAME -strxfrm \- string transformation +strxfrm, strxfrm_l \- string transformation .SH SYNOPSIS .LP .nf @@ -17,9 +18,12 @@ strxfrm \- string transformation \fBsize_t\fR \fBstrxfrm\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR); .fi - +.LP +.nf +\fBsize_t\fR \fBstrxfrm_l\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR, + \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBstrxfrm()\fR function transforms the string pointed to by \fIs2\fR and places the resulting string into the array pointed to by \fIs1\fR. The @@ -30,33 +34,31 @@ original strings. No more than \fIn\fR bytes are placed into the resulting array pointed to by \fIs1\fR, including the terminating null byte. If \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null pointer. If copying takes place between objects that overlap, the behavior is undefined. -.sp .LP The \fBstrxfrm()\fR function does not change the setting of \fBerrno\fR if successful. -.sp .LP Since no return value is reserved to indicate an error, an application wishing to check for error situations should set \fBerrno\fR to 0, then call \fBstrxfrm()\fR, then check \fBerrno\fR. +.LP +The \fBstrxfrm_l()\fR functions behaves identically to the function +\fBstrxfrm()\fR, except instead of operating in the current locale it +operates in the locale specified by the argument \fIloc\fR. .SH RETURN VALUES -.sp .LP Upon successful completion, \fBstrxfrm()\fR returns the length of the transformed string (not including the terminating null byte). If the value returned is \fIn\fR or more, the contents of the array pointed to by \fIs1\fR are indeterminate. -.sp .LP On error, \fBstrxfrm()\fR may set \fBerrno\fR but no return value is reserved to indicate the error. .SH USAGE -.sp .LP The transformation function is such that two transformed strings can be ordered by \fBstrcmp\fR(3C) as appropriate to collating sequence information in the -program's locale (category \fBLC_COLLATE\fR). -.sp +locale (category \fBLC_COLLATE\fR). .LP The fact that when \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null pointer, is useful to determine the size of the \fIs1\fR array prior to making @@ -64,7 +66,6 @@ the transformation. .SH EXAMPLES .LP \fBExample 1 \fRA sample of using the \fBstrxfm()\fR function. -.sp .LP The value of the following expression is the size of the array needed to hold the transformation of the string pointed to by \fIs\fR. @@ -77,23 +78,11 @@ the transformation of the string pointed to by \fIs\fR. .in -2 .SH FILES -.sp -.ne 2 -.na -\fB\fB/usr/lib/locale/\fIlocale\fR/\fIlocale\fR.so.*\fR\fR -.ad -.sp .6 -.RS 4n -\fBLC_COLLATE\fR database for \fIlocale\fR -.RE - +.IP \fB/usr/lib/locale/\fR\fIlocale\fR\fB/LC_COLLATE/* +collation database for \fIlocale\fR .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -104,15 +93,11 @@ CSI Enabled _ Interface Stability Standard _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE -.sp -.LP -The \fBstrxfrm()\fR function can be used safely in a multithreaded application, -as long as \fBsetlocale\fR(3C) is not being called to change the locale. .SH SEE ALSO -.sp .LP -\fBlocaledef\fR(1), \fBsetlocale\fR(3C), \fBstrcmp\fR(3C), \fBstrcoll\fR(3C), +\fBlocaledef\fR(1), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBstrcmp\fR(3C), +\fBstrcoll\fR(3C), \fBuselocale\fR(3C), \fBwscoll\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/tolower.3c b/usr/src/man/man3c/tolower.3c index 727e6f3ebd..2a06d7bbfa 100644 --- a/usr/src/man/man3c/tolower.3c +++ b/usr/src/man/man3c/tolower.3c @@ -1,11 +1,12 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH TOLOWER 3C "Aug 14, 2002" +.TH TOLOWER 3C "Jun 21, 2014" .SH NAME -tolower \- transliterate upper-case characters to lower-case +tolower, tolower_l \- transliterate upper-case characters to lower-case .SH SYNOPSIS .LP .nf @@ -13,35 +14,36 @@ tolower \- transliterate upper-case characters to lower-case \fBint\fR \fBtolower\fR(\fBint\fR \fIc\fR); .fi +.LP +.nf +\fBint\fR \fBtolower_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBtolower()\fR function has as a domain a type \fBint\fR, the value of which is representable as an \fBunsigned char\fR or the value of \fBEOF\fR. If the argument has any other value, the argument is returned unchanged. If the argument of \fBtolower()\fR represents an upper-case letter, and there exists a corresponding lower-case letter (as defined by character type information in -the program locale category \fB\fR\fBLC_CTYPE\fR\fB), \fR the result is the +the locale category \fB\fR\fBLC_CTYPE\fR\fB), \fR the result is the corresponding lower-case letter. All other arguments in the domain are returned unchanged. +.LP +The function \fBtolower_l()\fR behaves identically to \fBtolower()\fR, except +instead of operating in the current locale, it operates in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP On successful completion, \fBtolower()\fR returns the lower-case letter corresponding to the argument passed. Otherwise, it returns the argument unchanged. .SH ERRORS -.sp .LP No errors are defined. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -56,7 +58,6 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP -\fB_tolower\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), -\fBstandards\fR(5) +\fB_tolower\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), +\fBuselocale\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/toupper.3c b/usr/src/man/man3c/toupper.3c index 99c782cd6d..3885d28925 100644 --- a/usr/src/man/man3c/toupper.3c +++ b/usr/src/man/man3c/toupper.3c @@ -1,11 +1,12 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH TOUPPER 3C "Aug 14, 2002" +.TH TOUPPER 3C "Jun 21, 2014" .SH NAME -toupper \- transliterate lower-case characters to upper-case +toupper, toupper_l \- transliterate lower-case characters to upper-case .SH SYNOPSIS .LP .nf @@ -13,33 +14,34 @@ toupper \- transliterate lower-case characters to upper-case \fBint\fR \fBtoupper\fR(\fBint\fR \fIc\fR); .fi +.LP +.nf +\fBint\fR \fBtoupper_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBtoupper()\fR function has as a domain a type \fBint\fR, the value of which is representable as an \fBunsigned char\fR or the value of \fBEOF\fR. If the argument has any other value, the argument is returned unchanged. If the argument of \fBtoupper()\fR represents a lower-case letter, and there exists a corresponding upper-case letter (as defined by character type information in -the program locale category \fBLC_CTYPE\fR), the result is the corresponding +the locale category \fBLC_CTYPE\fR), the result is the corresponding upper-case letter. All other arguments in the domain are returned unchanged. +.LP +The function \fBtoupper_l()\fR behaves identically to \fBtoupper()\fR, except +instead of operating in the current locale, it operates in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP On successful completion, \fBtoupper()\fR returns the upper-case letter corresponding to the argument passed. .SH ERRORS -.sp .LP No errors are defined. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -54,7 +56,7 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP -\fB_toupper\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), -\fBstandards\fR(5) +\fB_toupper\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), +\fBuselocale\fR(3C), +\fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/towlower.3c b/usr/src/man/man3c/towlower.3c new file mode 100644 index 0000000000..e0024720b4 --- /dev/null +++ b/usr/src/man/man3c/towlower.3c @@ -0,0 +1,75 @@ +'\" te +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2014 Joyent, Inc. All rights reserved. +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> +.\" +.TH TOWLOWER 3C "Jun 21, 2014" +.SH NAME +towlower, towlower_l \- transliterate upper-case wide characters to lower-case +.SH SYNOPSIS +.LP +.nf +#include <wctype.h> + +\fBwint_t\fR \fBtowlower\fR(\fBwint_t\fR \fIwc\fR); +.fi +.LP +.nf +\fBwint_t\fR \fBtowlower_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.nf +.SH DESCRIPTION +The function +.BR towlower() +is the wide character equivalent of the function +.BR tolower (3C). +It converts the upper-case wide character +.I wc +to the equivalent lower-case +wide character, if one exists. If one does not exist, it returns +.I wc +unchanged. +.LP +The function +.B towlower_l() +is equivalent to the function +.BR towlower() , +but instead of operating in the current locale, operates in the +locale specified by +.IR loc . +.SH RETURN VALUES +On successful completion, +.B towlower() +and +.B towlower_l() +return the lower-case character that corresponds to the argument passed. +Otherwise, they return the argument unchanged. +.SH ERRORS +No errors are defined. +.SH ATTRIBUTES +.TS +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE +_ +Interface Stability Standard +_ +MT-Level MT-Safe +.TE + +.SH SEE ALSO +.BR newlocale (3C), +.BR setlocale (3C), +.BR towupper (3C), +.BR uselocale (3C), +.BR locale (5) diff --git a/usr/src/man/man3c/towupper.3c b/usr/src/man/man3c/towupper.3c new file mode 100644 index 0000000000..c8c86eef72 --- /dev/null +++ b/usr/src/man/man3c/towupper.3c @@ -0,0 +1,75 @@ +'\" te +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2014 Joyent, Inc. All rights reserved. +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> +.\" +.TH TOWUPPER 3C "Jun 21, 2014" +.SH NAME +towupper, towupper_l \- transliterate lower-case wide characters to upper-case +.SH SYNOPSIS +.LP +.nf +#include <wctype.h> + +\fBwint_t\fR \fBtowupper\fR(\fBwint_t\fR \fIwc\fR); +.fi +.LP +.nf +\fBwint_t\fR \fBtowupper_l\fR(\fBwint_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.SH DESCRIPTION +The function +.BR towupper() +is the wide character equivalent of the function +.BR toupper (3C). +It converts the lower-case wide character +.I wc +to the equivalent upper-case +wide character, if one exists. If one does not exist, it returns +.I wc +unchanged. +.LP +The function +.B towupper_l() +is equivalent to the function +.BR towupper() , +but instead of operating in the current locale, operates in the +locale specified by +.IR loc . +.SH RETURN VALUES +On successful completion, +.B towupper() +and +.B towupper_l() +return the upper-case character that corresponds to the argument passed. +Otherwise, they return the argument unchanged. +.SH ERRORS +No errors are defined. +.SH ATTRIBUTES +.TS +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE +_ +Interface Stability Standard +_ +MT-Level MT-Safe +.TE + +.SH SEE ALSO +.BR newlocale (3C), +.BR setlocale (3C), +.BR toupper(3C), +.BR uselocale (3C), +.BR locale (5) diff --git a/usr/src/man/man3c/uselocale.3c b/usr/src/man/man3c/uselocale.3c new file mode 100644 index 0000000000..ca2d034c6e --- /dev/null +++ b/usr/src/man/man3c/uselocale.3c @@ -0,0 +1,95 @@ +'\" te +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2014 Joyent, Inc. All rights reserved. +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> +.\" +.TH USELOCALE 3C "Jun 24, 2014" + +.SH NAME +uselocale \- get and set the locale for an individual thread +.SH SYNOPSIS +.LP +.nf +#include <locale.h> + +\fBlocale_t\fR \fBuselocale\fR(\fBlocale_t\fR \fIloc\fR); +.fi +.SH DESCRIPTION +.LP +The +.B uselocale() +function is used to obtain and set the current locale for a thread. When +a thread is created, it uses the global locale as specified by calls to +.BR setlocale() . +.LP +If +.BR (locale_t) 0 +is supplied for +.IR loc , +then no change is made to the thread's locale setting. This can be used +to query the thread's locale without making any change. +.LP +If +.B LC_GLOBAL_LOCALE +is supplied for +.IR loc , +then the thread will use the global locale, undoing the effect of any +prior call to establish a thread-specific locale. +.LP +Otherwise the thread will use the supplied +.I loc +locale object as a thread-specific locale. Changes to the global +locale, or to the locale of any other thread, will not affect this thread. +.LP +Locale objects for use with +.B uselocale() +can be created with the functions +.BR duplocale (3C) +and +.BR newlocale (3C). +.SH RETURN VALUES +Upon successful completion, the +.B uselocale() +function always returns the previous locale that was set. If no locale +was previously set, the global locale, +.BR LC_GLOBAL_LOCALE , +is returned. On failure, the +.B uselocale() +function returns +.BR (locale_t) 0, +and sets +.B errno +to indicate the error. +.SH ERRORS +.TP +.B EINVAL +An invalid locale was encountered or an internal error occurred that +caused the system to be unable to update the locale. +.SH ATTRIBUTES +.TS +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE +_ +Interface Stability Standard +_ +MT-Level MT-Safe +.TE + +.SH SEE ALSO +.BR locale (1), +.BR duplocale (3C), +.BR newlocale (3C), +.BR setlocale (3C), +.BR locale (5) diff --git a/usr/src/man/man3c/wcrtomb.3c b/usr/src/man/man3c/wcrtomb.3c index da302b25d1..f245b23146 100644 --- a/usr/src/man/man3c/wcrtomb.3c +++ b/usr/src/man/man3c/wcrtomb.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WCRTOMB 3C "Nov 1, 2003" +.TH WCRTOMB 3C "Jun 24, 2014" .SH NAME -wcrtomb \- convert a wide-character code to a character (restartable) +wcrtomb, wcrtomb_l \- convert a wide-character code to a character (restartable) .SH SYNOPSIS .LP .nf @@ -17,19 +18,22 @@ wcrtomb \- convert a wide-character code to a character (restartable) \fBsize_t\fR \fBwcrtomb\fR(\fBchar *restrict\fR \fIs\fR, \fBwchar_t\fR \fIwc\fR, \fBmbstate_t *restrict\fR \fIps\fR); .fi +.LP +.nf +#include <stdio.h> +#include <xlocale.h> +\fBsize_t\fR \fBwcrtomb_l\fR(\fBchar *restrict\fR \fIs\fR, \fBwchar_t\fR \fIwc\fR, \fBmbstate_t *restrict\fR \fIps\fR, + \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP If \fIs\fR is a null pointer, the \fBwcrtomb()\fR function is equivalent to the call: -.sp -.LP -wcrtomb(buf, L'\e0', ps) -.sp +.IP +\fBwcrtomb\fR(\fIbuf\fR, L'\e0', \fIps\fR); .LP where \fIbuf\fR is an internal buffer. -.sp .LP If \fIs\fR is not a null pointer, the \fBwcrtomb()\fR function determines the number of bytes needed to represent the character that corresponds to the @@ -39,20 +43,19 @@ At most \fBMB_CUR_MAX\fR bytes are stored. If \fIwc\fR is a null wide-character, a null byte is stored, preceded by any shift sequence needed to restore the initial shift state. The resulting state described is the initial conversion state. -.sp .LP If \fIps\fR is a null pointer, the \fBwcrtomb()\fR function uses its own internal \fBmbstate_t\fR object, which is initialized at program startup to the initial conversion state. Otherwise, the \fBmbstate_t\fR object pointed to by \fIps\fR is used to completely describe the current conversion state of the -associated character sequence. Solaris will behave as if no function defined in -the Solaris Reference Manual calls \fBwcrtomb()\fR. -.sp +associated character sequence. The system will behave as if no function +defined in the Reference Manual calls \fBwcrtomb()\fR. .LP -The behavior of this function is affected by the \fBLC_CTYPE\fR category of the -current locale. See \fBenviron\fR(5). +The behavior of \fBwcrtomb()\fR is affected by the \fBLC_CTYPE\fR category of the +current locale. See \fBenviron\fR(5). The function \fBwcrtomb_l()\fR behaves +identically to \fBwcrtomb()\fR, except instead of operating in the current +locale, it operates in the locale specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP The \fBwcrtomb()\fR function returns the number of bytes stored in the array object (including any shift sequences). When \fIwc\fR is not a valid @@ -60,7 +63,6 @@ wide-character, an encoding error occurs. In this case, the function stores the value of the macros \fBEILSEQ\fR in \fBerrno\fR and returns \fB(size_t)\(mi1\fR; the conversion state is undefined. .SH ERRORS -.sp .LP The \fBwcrtomb()\fR function may fail if: .sp @@ -81,36 +83,28 @@ state. .RS 10n Invalid wide-character code is detected. .RE - -.SH USAGE -.sp -.LP -If \fIps\fR is not a null pointer, \fBwcrtomb()\fR uses the \fBmbstate_t\fR -object pointed to by \fIps\fR and the function can be used safely in -multithreaded applications, as long as \fBsetlocale\fR(3C) is not being called -to change the locale. If \fIps\fR is a null pointer, \fBwcrtomb()\fR uses its -internal \fBmbstate_t\fR object and the function is Unsafe in multithreaded -applications. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level See NOTES below +MT-Level See below. .TE +.LP +The \fBwcrtomb()\fR function is Standard. The +\fBwcrtomb_l()\fR function is Uncommitted. +.LP +If \fIps\fR is a null pointer, these functions should be considered Unsafe +for use in multithreaded applications. Otherwise, they are MT-Safe. .SH SEE ALSO -.sp .LP -\fBmbsinit\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), +\fBmbsinit\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), +\fBuselocale\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5), \fBenviron\fR(5) diff --git a/usr/src/man/man3c/wcscoll.3c b/usr/src/man/man3c/wcscoll.3c index 364ce08054..f7d88a7519 100644 --- a/usr/src/man/man3c/wcscoll.3c +++ b/usr/src/man/man3c/wcscoll.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WCSCOLL 3C "Aug 14, 2002" +.TH WCSCOLL 3C "Jun 25, 2014" .SH NAME -wcscoll, wscoll \- wide character string comparison using collating information +wcscoll, wcscoll_l wscoll \- wide character string comparison using collating information .SH SYNOPSIS .LP .nf @@ -17,42 +18,43 @@ wcscoll, wscoll \- wide character string comparison using collating information \fBint\fR \fBwcscoll\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR); .fi - +.LP +.nf +\fBint\fR \fBwcscoll_l\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR, \fBlocale_t\fR \fIloc\fR); +.fi .LP .nf \fBint\fR \fBwscoll\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR); .fi - .SH DESCRIPTION -.sp .LP -The \fBwcscoll()\fR and \fBwscoll()\fR functions compare the wide character +The \fBwcscoll()\fR, \fBwcscoll_l()\fR, and \fBwscoll()\fR functions compare +the wide character string pointed to by \fIws1\fR to the wide character string pointed to by -\fIws2\fR, both interpreted as appropriate to the \fBLC_COLLATE\fR category of -the current locale. -.sp +\fIws2\fR, both interpreted as appropriate to the \fBLC_COLLATE\fR locale +category. .LP -The \fBwcscoll()\fR and \fBwscoll()\fR functions do not change the setting of -\fBerrno\fR if successful. -.sp +These functions do not change the setting of \fBerrno\fR if successful. .LP An application wanting to check for error situations should set \fBerrno\fR to -0 before calling \fBwcscoll()\fR or \fBwscoll()\fR. If \fBerrno\fR is non-zero +0 before calling these functions. If \fBerrno\fR is non-zero on return, an error has occurred. +.LP +The function \fBwcsoll_l()\fR behaves identically to \fBwcsoll\fR(), except +instead of operating in the current locale, it operates in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP -Upon successful completion, \fBwcscoll()\fR and \fBwscoll()\fR return an +Upon successful completion, these functions return an integer greater than, equal to, or less than 0, depending upon whether the wide character string pointed to by \fIws1\fR is greater than, equal to, or less than the wide character string pointed to by \fIws2\fR, when both are -interpreted as appropriate to the current locale. On error, \fBwcscoll()\fR and -\fBwscoll()\fR may set \fBerrno\fR, but no return value is reserved to indicate -an error. +interpreted as appropriate to the the current locale, or the locale +specified by \fIloc\fR. On error, +they set \fBerrno\fR, but no return value is reserved to indicate an error. .SH ERRORS -.sp .LP -The \fBwcscoll()\fR and \fBwscoll()\fR functions may fail if: +The \fBwcscoll()\fR, \fBwcscoll_l()\fR and \fBwscoll()\fR functions may fail if: .sp .ne 2 .na @@ -62,39 +64,32 @@ The \fBwcscoll()\fR and \fBwscoll()\fR functions may fail if: The \fIws1\fR or \fIws2\fR arguments contain wide character codes outside the domain of the collating sequence. .RE - .SH USAGE .sp .LP The \fBwcsxfrm\fR(3C) and \fBwcscmp\fR(3C) functions should be used for sorting -large lists. +large lists, or when performing many comparisions on the same strings. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; -l | l +c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability \fBwcscoll()\fR is Standard +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE -.sp .LP -The \fBwcscoll()\fR and \fBwscoll()\fR functions can be used safely in -multithreaded applications as long as \fBsetlocale\fR(3C) is not being called -to change the locale. +The \fBwcscoll()\fR and \fBwcscoll_l()\fR functions are Standard. +The \fBwscoll()\fR function is Committed. .SH SEE ALSO -.sp .LP -\fBsetlocale\fR(3C), \fBwcscmp\fR(3C), \fBwcsxfrm\fR(3C), \fBattributes\fR(5), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBwcscmp\fR(3C), \fBwcsxfrm\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/wcsrtombs.3c b/usr/src/man/man3c/wcsrtombs.3c index 053d27cb49..860f83b913 100644 --- a/usr/src/man/man3c/wcsrtombs.3c +++ b/usr/src/man/man3c/wcsrtombs.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WCSRTOMBS 3C "Nov 1, 2003" +.TH WCSRTOMBS 3C "Jun 25, 2014" .SH NAME -wcsrtombs \- convert a wide-character string to a character string +wcsrtombs, wcsrtombs_l \- convert a wide-character string to a character string (restartable) .SH SYNOPSIS .LP @@ -20,9 +21,16 @@ wcsrtombs \- convert a wide-character string to a character string \fBconst wchar_t **restrict\fR \fIsrc\fR, \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR); .fi +.LP +.nf +#include <wchar.h> +#include <xlocale.h> +\fBsize_t\fR \fBwcsrtombs_l\fR(\fBchar *restrict\fR \fIdst\fR, + \fBconst wchar_t **restrict\fR \fIsrc\fR, \fBsize_t\fR \fIlen\fR, + \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBwcsrtombs()\fR function converts a sequence of wide-characters from the array indirectly pointed to by \fIsrc\fR into a sequence of corresponding @@ -45,10 +53,8 @@ When the next character would exceed the limit of \fIlen\fR total bytes to be stored in the array pointed to by \fIdst\fR (and \fIdst\fR is not a null pointer). .RE -.sp .LP Each conversion takes place as if by a call to the \fBwcrtomb()\fR function. -.sp .LP If \fIdst\fR is not a null pointer, the pointer object pointed to by \fIsrc\fR is assigned either a null pointer (if conversion stopped due to reaching a @@ -56,31 +62,31 @@ terminating null wide-character) or the address just past the last wide-character converted (if any). If conversion stopped due to reaching a terminating null wide-character, the resulting state described is the initial conversion state. -.sp .LP If \fIps\fR is a null pointer, the \fBwcsrtombs()\fR function uses its own internal \fBmbstate_t\fR object, which is initialized at program startup to the initial conversion state. Otherwise, the \fBmbstate_t\fR object pointed to by \fIps\fR is used to completely describe the current conversion state of the -associated character sequence. Solaris will behave as if no function defined in -the Solaris Reference Manual calls \fBwcsrtombs()\fR. -.sp +associated character sequence. The system will behave as if no function defined +in the Reference Manual calls any of these functions. +.LP +The behavior of \fBwcsrtombs()\fR is affected by the \fBLC_CTYPE\fR category of +the current locale. See \fBenviron\fR(5). .LP -The behavior of this function is affected by the \fBLC_CTYPE\fR category of the -current locale. See \fBenviron\fR(5). +The function \fBwcsrtombs_l()\fR behaves identically to \fBwcsrtombs\fR, except +instead of operating in the current locale, it operates in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP If conversion stops because a code is reached that does not correspond to a -valid character, an encoding error occurs. In this case, the \fBwcsrtombs()\fR -function stores the value of the macro \fBEILSEQ\fR in \fBerrno\fR and returns -\fB(size_t)\(mi1\fR; the conversion state is undefined. Otherwise, it returns +valid character, an encoding error occurs. In this case, these +functions store the value of the macro \fBEILSEQ\fR in \fBerrno\fR and return +\fB(size_t)\(mi1\fR; the conversion state is undefined. Otherwise, they return the number of bytes in the resulting character sequence, not including the terminating null (if any). .SH ERRORS -.sp .LP -The \fBwcsrtombs()\fR function may fail if: +The \fBwcsrtombs()\fR and \fBwcsrtombs_l()\fR functions may fail if: .sp .ne 2 .na @@ -99,36 +105,28 @@ state. .RS 10n A wide-character code does not correspond to a valid character. .RE - -.SH USAGE -.sp -.LP -If \fIps\fR is not a null pointer, \fBwcsrtombs()\fR uses the \fBmbstate_t\fR -object pointed to by \fIps\fR and the function can be used safely in -multithreaded applications, as long as \fBsetlocale\fR(3C) is not being called -to change the locale. If \fIps\fR is a null pointer, \fBwcsrtombs()\fR uses its -internal \fBmbstate_t\fR object and the function is Unsafe in multithreaded -applications. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level See NOTES below +MT-Level See below. .TE +.LP +The \fBwcsrtombs()\fR function is Standard. The \fBwcsrtombs_l()\fR +function is Uncommitted. +.LP +If \fIps\fR is a null pointer, these functions should be considered Unsafe +for use in multithreaded applications. Otherwise, they are MT-Safe. .SH SEE ALSO -.sp .LP -\fBmbsinit\fR(3C), \fBsetlocale\fR(3C), \fBwcrtomb\fR(3C), \fBattributes\fR(5), +\fBmbsinit\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBwcrtomb\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/wcswidth.3c b/usr/src/man/man3c/wcswidth.3c index 0a3b7d1d08..4fc2e56a20 100644 --- a/usr/src/man/man3c/wcswidth.3c +++ b/usr/src/man/man3c/wcswidth.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at @@ -8,9 +9,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WCSWIDTH 3C "Aug 14, 2002" +.TH WCSWIDTH 3C "Jul 11, 2014" .SH NAME -wcswidth \- number of column positions of a wide-character string +wcswidth, wcswidth_l \- number of column positions of a wide-character string .SH SYNOPSIS .LP .nf @@ -18,6 +19,13 @@ wcswidth \- number of column positions of a wide-character string \fBint\fR \fBwcswidth\fR(\fBconst wchar_t *\fR\fIpwcs\fR, \fBsize_t\fR \fIn\fR); .fi +.LP +.nf +#include <wchar.h> +#include <xlocale.h> + +\fBint\fR \fBwcswidth_l\fR(\fBconst wchar_t *\fR\fIpwcs\fR, \fBsize_t\fR \fIn\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION .sp @@ -27,7 +35,6 @@ required for \fIn\fR wide-character codes (or fewer than \fIn\fR wide-character codes if a null wide-character code is encountered before \fIn\fR wide-character codes are exhausted) in the string pointed to by \fIpwcs\fR. .SH RETURN VALUES -.sp .LP The \fBwcswidth()\fR function either returns \fB0\fR (if \fIpwcs\fR points to a null wide-character code), or returns the number of column positions to be @@ -35,17 +42,16 @@ occupied by the wide-character string pointed to by \fIpwcs\fR, or returns \fB\(mi1\fR (if any of the first \fIn\fR wide-character codes in the wide-character string pointed to by \fIpwcs\fR is not a printing wide-character code). +.LP +The function \fBwcwidth_l()\fR behaves identically to \fBwcwidth()\fR, except +instead of operating in the current environemtn, it operates in the environment +specified by \fIloc\fR. .SH ERRORS -.sp .LP No errors are defined. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -60,6 +66,6 @@ MT-Level MT-Safe with exceptions .TE .SH SEE ALSO -.sp .LP -\fBsetlocale\fR(3C), \fBwcwidth\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBwcwidth\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/wctob.3c b/usr/src/man/man3c/wctob.3c index 4d004097d2..ddeb81fc5e 100644 --- a/usr/src/man/man3c/wctob.3c +++ b/usr/src/man/man3c/wctob.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WCTOB 3C "Aug 14, 2002" +.TH WCTOB 3C "Jun 25, 2014" .SH NAME -wctob \- wide-character to single-byte conversion +wctob, wctob_l \- wide-character to single-byte conversion .SH SYNOPSIS .LP .nf @@ -18,52 +19,52 @@ wctob \- wide-character to single-byte conversion \fBint\fR \fBwctob\fR(\fBwint_t\fR \fIc\fR); .fi +.LP +.nf +#include <stdio.h> +#include <wchar.h> +#include <xlocale.h> +\fBint\fR \fBwctob_l\fR(\fBwint_t\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBwctob()\fR function determines whether \fIc\fR corresponds to a member of the extended character set whose character representation is a single byte when in the initial shift state. -.sp .LP -The behavior of this function is affected by the \fBLC_CTYPE\fR category of the +The behavior of \fBwctob()\fR is affected by the \fBLC_CTYPE\fR category of the current locale. See \fBenviron\fR(5) +.LP +The function \fBwctob_l()\fR behaves identically to \fBwctob()\fR, except +instead of operating in the current locale, it operates in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP -The \fBwctob()\fR function returns \fBEOF\fR if \fIc\fR does not correspond to -a character with length one in the initial shift state. Otherwise, it returns +These functions return \fBEOF\fR if \fIc\fR does not correspond to +a character with length one in the initial shift state. Otherwise, they return the single-byte representation of that character. .SH ERRORS -.sp .LP No errors are defined. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface Stability Standard +Interface Stability See below _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE -.SH SEE ALSO -.sp .LP -\fBbtowc\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), -\fBstandards\fR(5) -.SH NOTES -.sp +The \fBwctob()\fR function is Standard. The \fBwctob_l()\fR function +is Uncommitted. +.SH SEE ALSO .LP -The \fBwctob()\fR function can be used safely in multithreaded applications, as -long as \fBsetlocale\fR(3C) is not being called to change the locale. +\fBbtowc\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/wctomb.3c b/usr/src/man/man3c/wctomb.3c index 813907e9f5..f499f80fdb 100644 --- a/usr/src/man/man3c/wctomb.3c +++ b/usr/src/man/man3c/wctomb.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WCTOMB 3C "Aug 14, 2002" +.TH WCTOMB 3C "Jun 25, 2014" .SH NAME -wctomb \- convert a wide-character code to a character +wctomb, wctomb_l \- convert a wide-character code to a character .SH SYNOPSIS .LP .nf @@ -17,47 +18,43 @@ wctomb \- convert a wide-character code to a character \fBint\fR \fBwctomb\fR(\fBchar *\fR\fIs\fR, \fBwchar_t\fR \fIwchar\fR); .fi +.LP +.nf +#include <stdlib.h> +#include <xlocale.h> +\fBint\fR \fBwctomb_l\fR(\fBchar *\fR\fIs\fR, \fBwchar_t\fR \fIwchar\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBwctomb()\fR function determines the number of bytes needed to represent the character corresponding to the wide-character code whose value is \fIwchar\fR. It stores the character representation (possibly multiple bytes) in the array object pointed to by \fIs\fR (if \fIs\fR is not a null pointer). At most \fBMB_CUR_MAX\fR bytes are stored. -.sp .LP A call with \fIs\fR as a null pointer causes this function to return \fB0\fR. The behavior of this function is affected by the \fBLC_CTYPE\fR category of the current locale. +.LP +The function \fBwctomb_l()\fR behaves identically to \fBwctomb()\fR, except +instead of operating in the current locale, it operates in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP If \fIs\fR is a null pointer, \fBwctomb()\fR returns \fB0\fR value. If \fIs\fR is not a null pointer, \fBwctomb()\fR returns \fB\(mi1\fR if the value of \fIwchar\fR does not correspond to a valid character, or returns the number of bytes that constitute the character corresponding to the value of \fIwchar\fR. -.sp .LP In no case will the value returned be greater than the value of the \fBMB_CUR_MAX\fR macro. .SH ERRORS -.sp .LP No errors are defined. -.SH USAGE -.sp -.LP -The \fBwctomb()\fR function can be used safely in a multithreaded application, -as long as \fBsetlocale\fR(3C) is not being called to change the locale. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -66,13 +63,16 @@ ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE +.LP +The \fBwctomb()\fR function is Standard. The \fBwctomb_l()\fR function +is Uncommitted. .SH SEE ALSO -.sp .LP -\fBmblen\fR(3C), \fBmbstowcs\fR(3C), \fBmbtowc\fR(3C), \fBsetlocale\fR(3C), +\fBmblen\fR(3C), \fBmbstowcs\fR(3C), \fBmbtowc\fR(3C), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), \fBwcstombs\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/wctrans.3c b/usr/src/man/man3c/wctrans.3c new file mode 100644 index 0000000000..64b9c7b390 --- /dev/null +++ b/usr/src/man/man3c/wctrans.3c @@ -0,0 +1,140 @@ +'\" te +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2014 Joyent, Inc. All rights reserved. +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> +.\" +.TH WCTRANS 3C "Jun 25, 2014" + +.SH NAME +towctrans, towctrans_l, wctrans, wctrans_l \- define and perform transliteration mappings +.SH SYNOPSIS +.LP +.nf +#include <wctype.h> + +\fBwint_t\fR \fBtowctrans\fR(\fBwint_t\fR \fIwc\fR, \fBwctrans_t\fR \fIdesc\fR); +.fi +.LP +.nf +\fBwint_t\fR \fBtowctrans_l\fR(\fBwint_t\fR \fIwc\fR, \fBwctrans_t\fR \fIdesc\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.LP +.nf +\fBwctrans_t\fR \fBwctrans\fR(\fBconst char *\fR \fItranclass\fR); +.fi +.LP +.nf +\fBwctrans_t\fR \fBwctrans_l\fR(\fBconst char *\fR \fItranclass\fR, \fBlocale_t\fR \fIloc\fR); +.fi +.SH DESCRIPTION +.LP +The functions +.B wctrans() +and +.B wctrans_l() +are used to obtain a handle to a table that maps one set of wide +characters to another. They return an object of type +.I wctrans_t +which can be used with the functions +.B towctrans() +and +.BR towctrans_l() . +The valid set of classes that are available depends on the locale. +The following names are valid in all locales: +.TP +"tolower" +Conversion from upper case to lower case characters. +.TP +"toupper" +Conversion from lower case to upper case characters. +.LP +The +.B towctrans() +and +.B towctrans_l() +functions convert the wide character +.IR wc +based on the conversion table specified by +.IR desc . +.LP +The functions +.B towctrans_l() +and +.B wctrans_l() +are equivalent to the functions +.B towctrans() +and +.BR wctrans() , +but instead of operating in the current locale, they operate on the +locale specified by +.IR loc . +.SH RETURN VALUES +On successful completion, +.B towctrans() +and +.B towctrans_l() +functions return the character that corresponds to the argument passed +through the mapping table described by +.IR desc . +Otherwise, they return the character unchanged and set +.BR errno . +On successful completion, +.B wctrans() +and +.B wctrans_l() +functions return a non-zero identifier for +.IR tranclass . +On failure, they return zero and set +.BR errno . +.SH ERRORS +.LP +The +.B wctrans() +and +.B wctrans_l() +functions will fail if: +.TP +.B EINVAL +The mapping class specified by +.I tranclass +does not exist or is invalid. +.LP +The +.B towctrans() +and +.B towctrans_l() +functions will fail if: +.TP +.B EINVAL +The mapping class specified by +.I desc +is invalid. +.SH ATTRIBUTES +.TS +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE +_ +Interface Stability Standard +_ +MT-Level MT-Safe +.TE + +.SH SEE ALSO +.BR newlocale (3C), +.BR setlocale (3C), +.BR towlower (3C), +.BR towupper (3C), +.BR environ (5), +.BR locale (5) diff --git a/usr/src/man/man3c/wctype.3c b/usr/src/man/man3c/wctype.3c index ef49f2b1d2..7dd303e548 100644 --- a/usr/src/man/man3c/wctype.3c +++ b/usr/src/man/man3c/wctype.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. @@ -7,9 +8,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WCTYPE 3C "Aug 14, 2002" +.TH WCTYPE 3C "Jun 25, 2014" .SH NAME -wctype \- define character class +wctype, wctype_l \- define character class .SH SYNOPSIS .LP .nf @@ -17,52 +18,50 @@ wctype \- define character class \fBwctype_t\fR \fBwctype\fR(\fBconst char *\fR\fIcharclass\fR); .fi +.LP +.nf +\fBwctype_t\fR \fBwctype_l\fR(\fBconst char *\fR\fIcharclass\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBwctype()\fR function is defined for valid character class names as defined in the current locale. The \fIcharclass\fR is a string identifying a generic character class for which codeset-specific type information is required. The following character class names are defined in all locales: -.sp - -.sp +.IP .TS l l l l l l . -alnum alpha blank -cntrl digit graph -lower print punct -space upper xdigit +"alnum" "alpha" "blank" +"cntrl" "digit" "graph" +"lower" "print" "punct" +"space" "upper" "xdigit" .TE -.sp .LP Additional character class names defined in the locale definition file (category \fBLC_CTYPE\fR) can also be specified. -.sp .LP The function returns a value of type \fBwctype_t\fR, which can be used as the -second argument to subsequent calls of \fBiswctype\fR(3C). \fBwctype()\fR -determines values of \fBwctype_t\fR according to the rules of the coded -character set defined by character type information in the program's locale +second argument to subsequent calls of \fBiswctype\fR(3C). The \fBwctype()\fR +function determines values of \fBwctype_t\fR according to the rules of the coded +character set defined by character type information in the current locale (category \fBLC_CTYPE\fR). The values returned by \fBwctype()\fR are valid -until a call to \fBsetlocale\fR(3C) that modifies the category \fBLC_CTYPE\fR. +only in the locale, or locales with the same \fBLC_CTYPE\fR category. +.LP +The function \fBwctype_l()\fR behaves identically to \fBwctype()\fR, except +instead of operating in the current locale, it operates in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP -The \fBwctype()\fR function returns \fB0\fR if the given character class name -is not valid for the current locale (category \fBLC_CTYPE\fR); otherwise it +These functions return \fB0\fR if the given character class name +is not valid for the locale (category \fBLC_CTYPE\fR); otherwise it returns an object of type \fBwctype_t\fR that can be used in calls to -\fBiswctype()\fR. +\fBiswctype\fR(3C). .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -73,11 +72,12 @@ CSI Enabled _ Interface Stability Standard _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP -\fBiswctype\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), +\fBiswctype\fR(3C), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), +\fBuselocale\fR(3C), +\fBattributes\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/wcwidth.3c b/usr/src/man/man3c/wcwidth.3c index 01dd8c59b6..b11934cf54 100644 --- a/usr/src/man/man3c/wcwidth.3c +++ b/usr/src/man/man3c/wcwidth.3c @@ -1,4 +1,5 @@ '\" te +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org> .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at @@ -8,9 +9,9 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH WCWIDTH 3C "Aug 14, 2002" +.TH WCWIDTH 3C "Jun 25, 2014" .SH NAME -wcwidth \- number of column positions of a wide-character code +wcwidth, wcwidth_l \- number of column positions of a wide-character code .SH SYNOPSIS .LP .nf @@ -18,32 +19,35 @@ wcwidth \- number of column positions of a wide-character code \fBint\fR \fBwcwidth\fR(\fBwchar_t\fR \fIwc\fR); .fi +.LP +.nf +#include <wchar.h> +#include <xlocale.h> +\fBint\fR \fBwcwidth_l\fR(\fBwchar_t\fR \fIwc\fR, \fBlocale_t\fR \fIloc\fR); +.fi .SH DESCRIPTION -.sp .LP The \fBwcwidth()\fR function determines the number of column positions required for the wide character \fIwc\fR. The value of \fIwc\fR must be a character representable as a \fBwchar_t\fR, and must be a wide-character code corresponding to a valid character in the current locale. +.LP +The function \fBwcwidth_l()\fR behaves identically to \fBwcwidth()\fR, except +instead of operating in the current locale, it operates in the locale +specified by \fIloc\fR. .SH RETURN VALUES -.sp .LP -The \fBwcwidth()\fR function either returns \fB0\fR (if \fIwc\fR is a null -wide-character code), or returns the number of column positions to be occupied -by the wide-character code \fIwc\fR, or returns \fB\(mi1\fR (if \fIwc\fR does +These functions either return \fB0\fR (if \fIwc\fR is a null +wide-character code), or the number of column positions to be occupied +by the wide-character code \fIwc\fR, or \fB\(mi1\fR (if \fIwc\fR does not correspond to a printing wide-character code). .SH ERRORS -.sp .LP No errors are defined. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp .TS box; c | c @@ -52,13 +56,16 @@ ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ -Interface Stability Standard +Interface Stability See below. _ -MT-Level MT-Safe with exceptions +MT-Level MT-Safe .TE +.LP +The \fBwcwidth()\fR function is Standard. The \fBwcwidth_l()\fR function +is Uncommitted. .SH SEE ALSO -.sp .LP -\fBsetlocale\fR(3C), \fBwcswidth\fR(3C), \fBattributes\fR(5), +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C), +\fBwcswidth\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) |