1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
.\" $OpenBSD: mklocale.1,v 1.6 2016/05/29 01:02:21 millert Exp $
.\"
.\" $NetBSD: mklocale.1,v 1.13 2004/01/24 17:03:26 wiz Exp $
.\" FreeBSD: src/usr.bin/mklocale/mklocale.1,v 1.6 1999/09/20 09:15:21 phantom Exp
.\"
.\" Copyright (c) 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Paul Borman at Krystal Technologies.
.\"
.\" 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.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
.\"
.\" @(#)mklocale.1 8.2 (Berkeley) 4/18/94
.\"
.Dd $Mdocdate: May 29 2016 $
.Dt MKLOCALE 1
.Os
.Sh NAME
.Nm mklocale
.Nd make LC_CTYPE locale files
.Sh SYNOPSIS
.Nm mklocale
.Op Fl d
.Op Ar src-file
.Ar language/LC_CTYPE
.Nm mklocale
.Op Fl d
.Fl o
.Ar language/LC_CTYPE
.Ar src-file
.Sh DESCRIPTION
The
.Nm mklocale
utility reads an
.Dv LC_CTYPE
source file from standard input and produces an
.Dv LC_CTYPE
binary file on standard output suitable for placement in
.Pa /usr/share/locale/\*(Ltlanguage\*(Gt/LC_CTYPE .
.Pp
The format of
.Ar src-file
is quite simple:
it consists of a series of lines which start with a keyword and have
associated data following.
C-style comments are used
to place comments in the file.
.Pp
The following options are available:
.Bl -tag -width Ds
.It Fl d
Turns on debugging messages.
.It Fl o
Specify an output file.
.El
.Pp
Besides the keywords which will be listed below,
the following are valid tokens in
.Ar src-file :
.Bl -tag -width literal
.It Dv RUNE
A
.Dv RUNE
may be any of the following:
.Bl -tag -width 0x[0-9a-z]*
.It Ar 'x'
The ASCII character
.Ar x .
.It Ar '\ex'
The ANSI C character
.Ar \ex
where
.Ar \ex
is one of
.Dv \ea ,
.Dv \eb ,
.Dv \ef ,
.Dv \en ,
.Dv \er ,
.Dv \et ,
or
.Dv \ev .
.It Ar 0x[0-9a-z]*
A hexadecimal number representing a rune code.
.It Ar 0[0-7]*
An octal number representing a rune code.
.It Ar [1-9][0-9]*
A decimal number representing a rune code.
.El
.It Dv STRING
A string enclosed in double quotes (").
.It Dv THRU
Either
.Sq ...
or
.Sq - .
Used to indicate ranges.
.It Ar literal
The follow characters are taken literally:
.Pp
.Bl -tag -width XXXXXXXXXX -compact
.It Dv "\*(Lt \*(Ba ( \*(Ba ["
Used to start a mapping.
All are equivalent.
.It Dv "\*(Gt \*(Ba ) \*(Ba ]"
Used to end a mapping.
All are equivalent.
.It Dv \&:
Used as a delimiter in mappings.
.El
.El
.Pp
Key words which should only appear once are:
.Bl -tag -width PHONOGRAM
.It Dv ENCODING
Followed by a
.Dv STRING
which indicates the encoding mechanism to be used for this locale.
The current encodings are:
.Bl -tag -width NONE
.It Dv NONE
No translation and the default.
.It Dv UTF2
.Dv "Universal character set Transformation Format"
adopted from Plan 9 from Bell Labs.
.It Dv EUC
.Dv EUC
encoding as used by several
vendors of
.Ux
systems.
.El
.It Dv VARIABLE
This keyword must be followed by one or more tab or space characters,
after which encoding specific data is placed.
Currently only the
.Dv "EUC"
encoding requires variable data.
.\" See
.\" .Xr euc 4
.\" for further details.
.It Dv INVALID
A single
.Dv RUNE
follows and is used as the invalid rune for this locale.
.El
.Pp
The following keywords may appear multiple times and have the following
format for data:
.Bl -tag -width "XXRUNE1 THRU RUNEn : RUNE2XX" -offset indent
.It Aq Dv RUNE1 RUNE2
.Dv RUNE1
is mapped to
.Dv RUNE2 .
.It Aq Dv RUNE1 THRU RUNEn : RUNE2
Runes
.Dv RUNE1
through
.Dv RUNEn
are mapped to
.Dv RUNE2
through
.Dv RUNE2
.El
.Bl -tag -width PHONOGRAM
.It Dv MAPLOWER
Defines the tolower mappings.
.Dv RUNE2
is the lower case representation of
.Dv RUNE1 .
.It Dv MAPUPPER
Defines the toupper mappings.
.Dv RUNE2
is the upper case representation of
.Dv RUNE1 .
.It Dv TODIGIT
Defines a map from runes to their digit value.
.Dv RUNE2
is the integer value represented by
.Dv RUNE1 .
For example, the ASCII character
.Sq 0
would map to the decimal value 0.
On
.Ox ,
this information is ignored and not put into the binary output file.
.El
.Pp
The following keywords may appear multiple times and have the following
format for data:
.Bl -tag -width "RUNE1 THRU RUNEn"
.It Dv RUNE
This rune has the property defined by the keyword.
.It Dv "RUNE1 THRU RUNEn"
All the runes between and including
.Dv RUNE1
and
.Dv RUNEn
have the property defined by the keyword.
.El
.Bl -tag -width PHONOGRAM
.It Dv ALPHA
Defines runes which are alphabetic, printable, and graphic.
.It Dv CONTROL
Defines runes which are control characters.
.It Dv DIGIT
Defines runes which are decimal digits, printable, and graphic.
.It Dv GRAPH
Defines runes which are graphic and printable.
.It Dv LOWER
Defines runes which are lower case, printable, and graphic.
.It Dv PUNCT
Defines runes which are punctuation, printable, and graphic.
.It Dv SPACE
Defines runes which are spaces.
.It Dv UPPER
Defines runes which are upper case, printable, and graphic.
.It Dv XDIGIT
Defines runes which are hexadecimal digits, printable, and graphic.
.It Dv BLANK
Defines runes which are blank.
.It Dv PRINT
Defines runes which are printable.
.It Dv IDEOGRAM
Defines runes which are ideograms, printable, and graphic.
.It Dv SPECIAL
Defines runes which are special characters, printable, and graphic.
.It Dv PHONOGRAM
Defines runes which are phonograms, printable, and graphic.
.It Dv SWIDTHn
Defines runes with specific glyph width.
.Ar n
takes 0 to 3.
.It Dv CHARSET
Controls character set for subsequent runes.
.\" To support
.\" .Xr iso2022 4
.\" locale definitions.
.El
.Sh SEE ALSO
.\"Xr colldef 1 ,
.Xr setlocale 3
.\" .Xr euc 4 ,
.\" .Xr utf8 4
.\" .Xr nls 7
.Sh HISTORY
The
.Nm mklocale
utility first appeared in
.Bx 4.4 .
.Sh BUGS
The
.Nm mklocale
utility is overly simplistic.
.Pp
We should switch to
.Nm localedef
and its file format, which is more standard.
|