Penguin
Annotated edit history of mbsinit(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 MBSINIT
2 !!!MBSINIT
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 CONFORMING TO
8 SEE ALSO
9 NOTES
10 ----
11 !!NAME
12
13
14 mbsinit - test for initial shift state
15 !!SYNOPSIS
16
17
18 __#include
19 __''ps''__);
20 __
21 !!DESCRIPTION
22
23
24 Character conversion between the multibyte representation
25 and the wide character representation uses conversion state,
26 of type __mbstate_t__. Conversion of a string uses a
27 finite-state machine; when it is interrupted after the
28 complete conversion of a number of characters, it may need
29 to save a state for processing the remaining characters.
30 Such a conversion state is needed for the sake of encodings
31 such as ISO-2022 and UTF-7.
32
33
34 The initial state is the state at the beginning of
35 conversion of a string. There are two kinds of state: The
36 one used by multibyte to wide character conversion
37 functions, such as __mbsrtowcs__, and the one used by
38 wide character to multibyte conversion functions, such as
39 __wcsrtombs__, but they both fit in a __mbstate_t__,
40 and they both have the same representation for an initial
41 state.
42
43
44 For 8-bit encodings, all states are equivalent to the
45 initial state. For multibyte encodings like UTF-8, EUC-*,
46 BIG5 or SJIS, the wide character to multibyte conversion
47 functions never produce non-initial states, but the
48 multibyte to wide character conversion functions like
49 __mbrtowc__ do produce non-initial states when
50 interrupted in the middle of a character.
51
52
53 One possible way to create an mbstate_t in initial state is
54 to set it to zero:
55
56
57 mbstate_t state;
58 memset(
59 On Linux, the following works as well, but might generate compiler warnings:
60
61
62 mbstate_t state = { 0 };
63 The function __mbsinit__ tests whether ''*ps'' corresponds to an initial state.
64 !!RETURN VALUE
65
66
67 __mbsinit__ returns non-zero if ''*ps'' is an initial
68 state, or if ''ps'' is a null pointer. Otherwise it
69 returns 0.
70 !!CONFORMING TO
71
72
73 ISO/ANSI C, UNIX98
74 !!SEE ALSO
75
76
77 mbsrtowcs(3), wcsrtombs(3)
78 !!NOTES
79
80
81 The behaviour of __mbsinit__ depends on the LC_CTYPE
82 category of the current locale.
83 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.