summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2011-04-03 20:21:38 +0000
committerstsp <stsp@openbsd.org>2011-04-03 20:21:38 +0000
commit9c4f879fef265bdbab79acdf972dea7353adf7d4 (patch)
treebbb68b326295d63ff90c3d16d1486678087c4468
parentRemove the `skip splraise/splx for IPL_NONE mutexes' optimizations. It is not (diff)
downloadwireguard-openbsd-9c4f879fef265bdbab79acdf972dea7353adf7d4.tar.xz
wireguard-openbsd-9c4f879fef265bdbab79acdf972dea7353adf7d4.zip
Add wcwidth(3) man page. ok nicm
-rw-r--r--lib/libc/locale/Makefile.inc4
-rw-r--r--lib/libc/locale/wcwidth.361
2 files changed, 63 insertions, 2 deletions
diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc
index 987996b7269..752395bdad3 100644
--- a/lib/libc/locale/Makefile.inc
+++ b/lib/libc/locale/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.16 2010/07/27 16:59:03 stsp Exp $
+# $OpenBSD: Makefile.inc,v 1.17 2011/04/03 20:21:38 stsp Exp $
# locale sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/locale ${LIBCSRCDIR}/locale
@@ -15,7 +15,7 @@ MAN+= nl_langinfo.3 setlocale.3 iswalnum.3 towlower.3 \
btowc.3 mblen.3 mbrlen.3 mbrtowc.3 mbsinit.3 mbsrtowcs.3 \
mbstowcs.3 mbtowc.3 wcrtomb.3 wcsrtombs.3 wcstod.3 wcstol.3 \
wcstombs.3 wctob.3 wctomb.3 \
- wctype.3 iswctype.3 wctrans.3 towctrans.3
+ wctype.3 iswctype.3 wctrans.3 towctrans.3 wcwidth.3
MLINKS+=setlocale.3 localeconv.3 \
iswalnum.3 iswalpha.3 \
iswalnum.3 iswblank.3 \
diff --git a/lib/libc/locale/wcwidth.3 b/lib/libc/locale/wcwidth.3
new file mode 100644
index 00000000000..83c4e15f61f
--- /dev/null
+++ b/lib/libc/locale/wcwidth.3
@@ -0,0 +1,61 @@
+.\" $OpenBSD: wcwidth.3,v 1.1 2011/04/03 20:21:38 stsp Exp $
+.\" Copyright (c) 2002 Tim J. Robbins
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"
+.Dd $Mdocdate: April 3 2011 $
+.Dt WCWIDTH 3
+.Os
+.Sh NAME
+.Nm wcwidth
+.Nd number of column positions of a wide-character code
+.Sh SYNOPSIS
+.In wchar.h
+.Ft int
+.Fn wcwidth "wchar_t wc"
+.Sh DESCRIPTION
+The
+.Fn wcwidth
+function determines the number of column positions required to
+display the wide character
+.Fa wc .
+.Sh RETURN VALUES
+The
+.Fn wcwidth
+function returns 0 if the
+.Fa wc
+argument is a null wide character (L'\e0'),
+\-1 if
+.Fa wc
+is not printable,
+otherwise it returns the number of column positions the
+character occupies.
+.Sh SEE ALSO
+.Xr iswprint 3 ,
+.Xr wcswidth 3
+.Sh STANDARDS
+The
+.Fn wcwidth
+function conforms to
+.St -p1003.1-2001 .