OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / wcwidth.3
1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\" %%%LICENSE_END
9 .\"
10 .\" References consulted:
11 .\"   GNU glibc-2 source code and manual
12 .\"   Dinkumware C library reference http://www.dinkumware.com/
13 .\"   OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
14 .\"
15 .TH WCWIDTH 3  2014-01-22 "GNU" "Linux Programmer's Manual"
16 .SH NAME
17 wcwidth \- determine columns needed for a wide character
18 .SH SYNOPSIS
19 .nf
20 .BR "#define _XOPEN_SOURCE" "       /* See feature_test_macros(7) */"
21 .B #include <wchar.h>
22 .sp
23 .BI "int wcwidth(wchar_t " c );
24 .fi
25 .SH DESCRIPTION
26 The
27 .BR wcwidth ()
28 function returns the number of columns
29 needed to represent the wide character
30 .IR c .
31 If
32 .I c
33 is a printable wide character, the value
34 is at least 0.
35 If
36 .I c
37 is null wide character (L\(aq\\0\(aq), the value is 0.
38 Otherwise, \-1 is returned.
39 .SH RETURN VALUE
40 The
41 .BR wcwidth ()
42 function returns the number of
43 column positions for
44 .IR c .
45 .SH ATTRIBUTES
46 .SS Multithreading (see pthreads(7))
47 The
48 .BR wcwidth ()
49 function is thread-safe with exceptions.
50 It can be safely used in multithreaded applications, as long as
51 .BR setlocale (3)
52 is not called to change the locale during its execution.
53 .SH CONFORMING TO
54 POSIX.1-2001.
55
56 Note that glibc before 2.2.5 used the prototype
57 .br
58 .nf
59 .BI "int wcwidth(wint_t " c );
60 .fi
61 .SH NOTES
62 The behavior of
63 .BR wcwidth ()
64 depends on the
65 .B LC_CTYPE
66 category of the
67 current locale.
68 .SH SEE ALSO
69 .BR iswprint (3),
70 .BR wcswidth (3)
71 .SH COLOPHON
72 This page is part of release 3.79 of the Linux
73 .I man-pages
74 project.
75 A description of the project,
76 information about reporting bugs,
77 and the latest version of this page,
78 can be found at
79 \%http://www.kernel.org/doc/man\-pages/.