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
|
.\" Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
.\" at Electronni Visti IA, Kiev, Ukraine.
.\" 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 ``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 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.
.\"
.\" $FreeBSD$
.\"
.Dd January, 27 1995
.Dt COLLDEF 1
.Os
.Sh NAME
.Nm colldef
.Nd convert collation sequence source definition
.Sh SYNOPSIS
.Nm colldef
.Op Fl I Ar map_dir
.Op Fl o Ar out_file
.Op Ar filename
.Sh DESCRIPTION
.Nm Colldef
converts a collation sequence source definition
into a format usable by the
.Fn strxfrm
and
.Fn strcoll
functions. It is used to define the many ways in which
strings can be ordered and collated.
.Fn strxfrm
transforms
its first argument and places the result in its second
argument. The transformed string is such that it can be
correctly ordered with other transformed strings by using
.Fn strcmp ,
.Fn strncmp ,
or
.Fn memcmp .
.Fn strcoll
transforms its arguments and does a
comparison.
.Pp
.Nm Colldef
reads the collation sequence source definition
from the standard input and stores the converted definition in filename.
The output file produced contains the
database with collating sequence information in a form
usable by system commands and routines.
.Pp
Options list:
.Bl -tag -width 4n
.It Cm Fl I Ar map_dir
This option set directory name where
.Ar charmap
files can be found, current directory by default.
.It Cm Fl o Ar out_file
This option set output file name,
.Ar LC_COLLATE
by default.
.El
.Pp
The collation sequence definition specifies a set of collating elements and
the rules defining how strings containing these should be ordered.
This is most useful for different language definitions.
.Pp
The specification file can consist of three statements:
.Ar charmap ,
.Ar substitute
and
.Ar order .
.Pp
Of these, only the
.Ar order
statement is required. When
.Ar charmap
or
.Ar substitute
is
supplied, these statements must be ordered as above. Any
statements after the order statement are ignored.
.Pp
Lines in the specification file beginning with a
.Ar #
are
treated as comments and are ignored. Blank lines are also
ignored.
.Pp
.Ar charmap charmapfile
.Pp
.Ar charmap
defines where a mapping of the character
and collating element symbols to the actual
character encoding can be found.
.Pp
The format of
.Ar charmapfile
is shown below. Symbol
names are separated from their values by TAB or
SPACE characters. symbol-value can be specified in
a hexadecimal (\ex\fI??\fR) or octal (\e\fI???\fR)
representation, and can be only one character in length.
.Pp
.Ar symbol-name1 symbol-value1
.br
.Ar symbol-name2 symbol-value2
.br
.Ar ...
.Pp
The
.Ar charmap
statement is optional.
.Pp
.Ar substitute
\fIsymbol\fR
.Ar with
"\fIrepl_string\fR"
.Pp
The
.Ar substitute
statement substitutes the character
.Ar symbol
with the string
.Ar repl_string .
Symbol names cannot be specified in
.Ar repl_string
field.
The
.Ar substitute
statement is optional.
.Pp
.Ar order order_list
.Pp
.Ar order_list
is a list of symbols, separated by semi colons, that defines the
collating sequence. The
special symbol
.Ar ...
specifies, in a short-hand
form, symbols that are sequential in machine code
order.
.Pp
An order list element
can be represented in any one of the following
ways:
.Bl -bullet
.It
The symbol itself (for example,
.Ar a
for the lower-case letter
.Ar a )
.It
The symbol chain (for example,
.Ar abc )
.It
In octal representation (for example,
.Ar \e141
for the letter
.Ar a )
.It
In hexadecimal representation (for example,
.Ar \ex61
for the letter
.Ar a )
.It
The symbol name as defined in the
.Ar charmap
file (for example,
.Ar <abc>
for
.Ar abc \e023
record in
.Ar charmapfile ) .
If character map name have
.Ar >
character, it must be escaped as
.Ar /> ,
single
.Ar /
must be escaped as
.Ar // .
.It
Symbols
.Ar \ea ,
.Ar \eb ,
.Ar \ef ,
.Ar \en ,
.Ar \er ,
.Ar \ev
are permitted in its usual C-language meaning
.It
The symbol range (for example,
.Ar a;...;z )
.It
Comma-separated symbols, ranges and chains enclosed in parenthesis (for example
.Ar \&(
.Ar sym1 ,
.Ar sym2 ,
.Ar ...
.Ar \&) )
are assigned the
same primary ordering but different secondary
ordering.
.It
Comma-separated symbols, ranges and chains enclosed in curly brackets (for example
.Ar \&{
.Ar sym1 ,
.Ar sym2 ,
.Ar ...
.Ar \&} )
are assigned the same primary ordering only.
.El
.Pp
The backslash character
.Ar \e
is used for continuation. In this case, no characters are permitted
after the backslash character.
.Sh EXIT STATUS
.Nm Colldef
exits with the following values:
.Ar 0
No errors were found and the output was successfully created.
.Ar !=0
Errors were found.
.Sh FILES
.Ar /usr/share/locale/<language>/LC_COLLATE
standard shared location for collation orders
under the locale locale
.Sh SEE ALSO
.Xr mklocale 1 ,
.Xr setlocale 3 ,
.Xr strcoll 3 ,
.Xr strxfrm 3
|