xref: /minix3/usr.bin/gencat/gencat.1 (revision 36dcc4a4a93f782ada76dce3d52fbeab0e063cf1)
1*36dcc4a4SLionel Sambuc.\" $NetBSD: gencat.1,v 1.13 2011/12/29 16:41:38 christos Exp $
2*36dcc4a4SLionel Sambuc.\"
3*36dcc4a4SLionel Sambuc.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
4*36dcc4a4SLionel Sambuc.\" All rights reserved.
5*36dcc4a4SLionel Sambuc.\"
6*36dcc4a4SLionel Sambuc.\" This code is derived from software contributed to The NetBSD Foundation
7*36dcc4a4SLionel Sambuc.\" by Kee Hinckley and Brian Ginsbach.
8*36dcc4a4SLionel Sambuc.\"
9*36dcc4a4SLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
10*36dcc4a4SLionel Sambuc.\" modification, are permitted provided that the following conditions
11*36dcc4a4SLionel Sambuc.\" are met:
12*36dcc4a4SLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
13*36dcc4a4SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
14*36dcc4a4SLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
15*36dcc4a4SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
16*36dcc4a4SLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
17*36dcc4a4SLionel Sambuc.\"
18*36dcc4a4SLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19*36dcc4a4SLionel Sambuc.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20*36dcc4a4SLionel Sambuc.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21*36dcc4a4SLionel Sambuc.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22*36dcc4a4SLionel Sambuc.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*36dcc4a4SLionel Sambuc.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*36dcc4a4SLionel Sambuc.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*36dcc4a4SLionel Sambuc.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*36dcc4a4SLionel Sambuc.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*36dcc4a4SLionel Sambuc.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*36dcc4a4SLionel Sambuc.\" POSSIBILITY OF SUCH DAMAGE.
29*36dcc4a4SLionel Sambuc.\"
30*36dcc4a4SLionel Sambuc.\" Written by Kee Hinckley <nazgul@somewhere.com>
31*36dcc4a4SLionel Sambuc.\"
32*36dcc4a4SLionel Sambuc.Dd December 29, 2011
33*36dcc4a4SLionel Sambuc.Dt GENCAT 1
34*36dcc4a4SLionel Sambuc.Os
35*36dcc4a4SLionel Sambuc.Sh NAME
36*36dcc4a4SLionel Sambuc.Nm gencat
37*36dcc4a4SLionel Sambuc.Nd generates a Native Language Support (NLS) message catalog file
38*36dcc4a4SLionel Sambuc.Sh SYNOPSIS
39*36dcc4a4SLionel Sambuc.Nm
40*36dcc4a4SLionel Sambuc.Ar catfile
41*36dcc4a4SLionel Sambuc.Op Ar msgfile|- ...
42*36dcc4a4SLionel Sambuc.Sh DESCRIPTION
43*36dcc4a4SLionel SambucThe
44*36dcc4a4SLionel Sambuc.Nm
45*36dcc4a4SLionel Sambucutility generates a formatted message catalog
46*36dcc4a4SLionel Sambuc.Ar catfile
47*36dcc4a4SLionel Sambucfrom stdin or one or more message source text files
48*36dcc4a4SLionel Sambuc.Ar msgfile .
49*36dcc4a4SLionel SambucThe file
50*36dcc4a4SLionel Sambuc.Ar catfile
51*36dcc4a4SLionel Sambucis created if it does not already exist.
52*36dcc4a4SLionel SambucIf
53*36dcc4a4SLionel Sambuc.Ar catfile
54*36dcc4a4SLionel Sambucdoes exist, its messages are included in the new
55*36dcc4a4SLionel Sambuc.Ar catfile .
56*36dcc4a4SLionel SambucThe new message text defined in
57*36dcc4a4SLionel Sambuc.Ar msgfile
58*36dcc4a4SLionel Sambucreplaces the old message text currently in
59*36dcc4a4SLionel Sambuc.Ar catfile
60*36dcc4a4SLionel Sambucwhen the set and message numbers match.
61*36dcc4a4SLionel Sambuc.Pp
62*36dcc4a4SLionel SambucThe generated message catalog contains message
63*36dcc4a4SLionel Sambucstrings that will be retrieved using the
64*36dcc4a4SLionel Sambuc.Xr catgets 3
65*36dcc4a4SLionel Sambuclibrary call.
66*36dcc4a4SLionel SambucThese messages are dynamically loaded by the
67*36dcc4a4SLionel SambucNative Language Support (NLS) library at run time.
68*36dcc4a4SLionel SambucError messages are grouped into sets, and a program can load a
69*36dcc4a4SLionel Sambucparticular set depending on which type, or language, of messages
70*36dcc4a4SLionel Sambucis desired.
71*36dcc4a4SLionel Sambuc.Ss Message Text Source File Format
72*36dcc4a4SLionel SambucThe message text source files are text files in the format described below.
73*36dcc4a4SLionel SambucNote that the fields of a message text source line are separated by
74*36dcc4a4SLionel Sambucspace or tab characters.
75*36dcc4a4SLionel Sambuc.\" XXX Required by POSIX; the code must be fixed first.  Above line should be
76*36dcc4a4SLionel Sambuc.\" a single space or tab character;
77*36dcc4a4SLionel Sambuc.\" any other space or tab characters are considered to be part of the
78*36dcc4a4SLionel Sambuc.\" field contents.
79*36dcc4a4SLionel Sambuc.Bl -tag -width 3n
80*36dcc4a4SLionel Sambuc.It Li $set Ar n comment
81*36dcc4a4SLionel SambucDetermines the set identifier to be used for all subsequent messages
82*36dcc4a4SLionel Sambucuntil the next
83*36dcc4a4SLionel Sambuc.Li $set
84*36dcc4a4SLionel Sambucor end-of-file.
85*36dcc4a4SLionel SambucThe
86*36dcc4a4SLionel Sambuc.Ar n
87*36dcc4a4SLionel Sambucis the set identifier which is defined as a number in the range
88*36dcc4a4SLionel Sambuc.Bo 1 ,
89*36dcc4a4SLionel Sambuc.Dv NL_SETMAX Bc .
90*36dcc4a4SLionel SambucSet identifiers within a single source file need not be contiguous.
91*36dcc4a4SLionel SambucAny string following the set identifier is treated as a comment.
92*36dcc4a4SLionel SambucIf no
93*36dcc4a4SLionel Sambuc.Li $set
94*36dcc4a4SLionel Sambucdirective is specified in a message text source file,
95*36dcc4a4SLionel Sambucall messages will be located in the default message set
96*36dcc4a4SLionel Sambuc.Dv NL_SETD .
97*36dcc4a4SLionel Sambuc.It Li $delset Ar n comment
98*36dcc4a4SLionel SambucRemoves message set
99*36dcc4a4SLionel Sambuc.Ar n
100*36dcc4a4SLionel Sambucfrom the catalog.
101*36dcc4a4SLionel SambucThe
102*36dcc4a4SLionel Sambuc.Ar n
103*36dcc4a4SLionel Sambucis a set identifier in the range
104*36dcc4a4SLionel Sambuc.Bo 1 ,
105*36dcc4a4SLionel Sambuc.Dv NL_SETMAX Bc .
106*36dcc4a4SLionel SambucIf a message set was created earlier in the
107*36dcc4a4SLionel Sambuccurrent file, or in a file previously read by the
108*36dcc4a4SLionel Sambuc.Nm
109*36dcc4a4SLionel Sambuccommand, this directive will remove it.
110*36dcc4a4SLionel SambucAny string following the set identifier is treated as a comment.
111*36dcc4a4SLionel Sambuc.It Li $ Ar comment
112*36dcc4a4SLionel SambucA line beginning with
113*36dcc4a4SLionel Sambuc.Li $
114*36dcc4a4SLionel Sambucfollowed by a space or tab character is treated as a comment.
115*36dcc4a4SLionel Sambuc.It Ar m message-text
116*36dcc4a4SLionel SambucA message line consists of a message identifier
117*36dcc4a4SLionel Sambuc.Ar m
118*36dcc4a4SLionel Sambucin the range
119*36dcc4a4SLionel Sambuc.Bo 1 ,
120*36dcc4a4SLionel Sambuc.Dv NL_MSGMAX Bc
121*36dcc4a4SLionel Sambucand the
122*36dcc4a4SLionel Sambuc.Ar message-text .
123*36dcc4a4SLionel SambucThe
124*36dcc4a4SLionel Sambuc.Ar message-text
125*36dcc4a4SLionel Sambucis read until the end of the line or a quote character
126*36dcc4a4SLionel Sambuc(if one is specified).
127*36dcc4a4SLionel SambucThe
128*36dcc4a4SLionel Sambuc.Ar message-text
129*36dcc4a4SLionel Sambucis stored in the message catalog with
130*36dcc4a4SLionel Sambucthe set identifier specified by the last
131*36dcc4a4SLionel Sambuc.Li $set
132*36dcc4a4SLionel Sambucdirective, and the message identifier
133*36dcc4a4SLionel Sambuc.Ar m .
134*36dcc4a4SLionel SambucIf the
135*36dcc4a4SLionel Sambuc.Ar message-text
136*36dcc4a4SLionel Sambucis empty and there is a space or tab character
137*36dcc4a4SLionel Sambucfollowing the message identifier,
138*36dcc4a4SLionel Sambucan empty string is stored in the message catalog.
139*36dcc4a4SLionel SambucIf no
140*36dcc4a4SLionel Sambuc.Ar message-text
141*36dcc4a4SLionel Sambucis provided,
142*36dcc4a4SLionel Sambucand if there is no space or tab character following the message
143*36dcc4a4SLionel Sambucidentifier,
144*36dcc4a4SLionel Sambucthe message with the message identifier
145*36dcc4a4SLionel Sambuc.Ar m
146*36dcc4a4SLionel Sambucin the current set is removed from the catalog.
147*36dcc4a4SLionel SambucMessage identifiers need not be contiguous within a single set.
148*36dcc4a4SLionel SambucThe length of
149*36dcc4a4SLionel Sambuc.Ar message-text
150*36dcc4a4SLionel Sambucmust be in the range
151*36dcc4a4SLionel Sambuc.Bo 0 ,
152*36dcc4a4SLionel Sambuc.Dv NL_TEXTMAX Bc .
153*36dcc4a4SLionel Sambuc.It Li $quote Ar c
154*36dcc4a4SLionel SambucSets an optional quote character to be used around the
155*36dcc4a4SLionel Sambuc.Ar message-text .
156*36dcc4a4SLionel SambucThe quote character
157*36dcc4a4SLionel Sambuc.Ar c
158*36dcc4a4SLionel Sambucmay be any character other than white space.
159*36dcc4a4SLionel SambucIf this is specified, then messages must begin and end with the
160*36dcc4a4SLionel Sambucquote character.
161*36dcc4a4SLionel Sambuc.\" XXX Remove next sentence when code is fixed for POSIX conformance.
162*36dcc4a4SLionel SambucThis is useful when messages must contain leading white space.
163*36dcc4a4SLionel Sambuc.\" XXX Replacement when above is removed.
164*36dcc4a4SLionel Sambuc.\" This is useful to make leading and trailing spaces or empty
165*36dcc4a4SLionel Sambuc.\" messages visible.
166*36dcc4a4SLionel SambucBy default no quote character is used.
167*36dcc4a4SLionel SambucIf an empty
168*36dcc4a4SLionel Sambuc.Li $quote
169*36dcc4a4SLionel Sambucdirective is specified, then the current quote character is unset.
170*36dcc4a4SLionel Sambuc.El
171*36dcc4a4SLionel Sambuc.Pp
172*36dcc4a4SLionel SambucEmpty lines
173*36dcc4a4SLionel Sambuc.\" XXX Remove next line when the code is fixed for POSIX conformance.
174*36dcc4a4SLionel Sambucand leading blanks
175*36dcc4a4SLionel Sambucin a message text source file are ignored.
176*36dcc4a4SLionel SambucAny line beginning with any character other than those
177*36dcc4a4SLionel Sambucdescribed above is ignored as a syntax error.
178*36dcc4a4SLionel Sambuc.Pp
179*36dcc4a4SLionel SambucText message strings may contain any characters and
180*36dcc4a4SLionel Sambucthe following special characters and escape sequences.
181*36dcc4a4SLionel Sambuc.Pp
182*36dcc4a4SLionel Sambuc.Bl -column -offset indent ".Sy carriage return" ".Sy Symbol" ".Sy Sequence"
183*36dcc4a4SLionel Sambuc.It Sy Description Ta Sy Symbol Ta Sy Sequence
184*36dcc4a4SLionel Sambuc.It newline Ta NL(LF) Ta Li \en
185*36dcc4a4SLionel Sambuc.It horizontal tab Ta HT Ta Li \et
186*36dcc4a4SLionel Sambuc.It vertical tab Ta VT Ta Li \ev
187*36dcc4a4SLionel Sambuc.It backspace Ta BS Ta Li \eb
188*36dcc4a4SLionel Sambuc.It carriage return Ta CR Ta Li \er
189*36dcc4a4SLionel Sambuc.It form feed Ta FF Ta Li \ef
190*36dcc4a4SLionel Sambuc.It backslash Ta \e Ta Li \e\e
191*36dcc4a4SLionel Sambuc.It bit pattern Ta ddd Ta Li \eddd
192*36dcc4a4SLionel Sambuc.El
193*36dcc4a4SLionel Sambuc.Pp
194*36dcc4a4SLionel SambucA bit pattern,
195*36dcc4a4SLionel Sambuc.Li \eddd ,
196*36dcc4a4SLionel Sambucconsists of a backslash followed by
197*36dcc4a4SLionel Sambucone, two, or three octal digits representing the value of the character.
198*36dcc4a4SLionel SambucThe current quote character, if defined, may be escaped with a backslash
199*36dcc4a4SLionel Sambucto generate the quote character.
200*36dcc4a4SLionel SambucAny character following the backslash ('\e') other than those specified
201*36dcc4a4SLionel Sambucis ignored.
202*36dcc4a4SLionel Sambuc.Pp
203*36dcc4a4SLionel SambucA backslash at the end of the line continues the message onto the next line.
204*36dcc4a4SLionel SambucThe following two lines are an example of such a message:
205*36dcc4a4SLionel Sambuc.Pp
206*36dcc4a4SLionel Sambuc.Dl 1 This message continues \e
207*36dcc4a4SLionel Sambuc.D1 on the next line
208*36dcc4a4SLionel Sambuc.Pp
209*36dcc4a4SLionel SambucProducing the following message:
210*36dcc4a4SLionel Sambuc.Pp
211*36dcc4a4SLionel Sambuc.Dl 1 This message continues on the next line
212*36dcc4a4SLionel Sambuc.Sh EXIT STATUS
213*36dcc4a4SLionel Sambuc.Ex -std
214*36dcc4a4SLionel Sambuc.Sh SEE ALSO
215*36dcc4a4SLionel Sambuc.Xr catclose 3 ,
216*36dcc4a4SLionel Sambuc.Xr catgets 3 ,
217*36dcc4a4SLionel Sambuc.Xr catopen 3 ,
218*36dcc4a4SLionel Sambuc.Xr nls 7
219*36dcc4a4SLionel Sambuc.\" XXX Close but not quite; add when code is fixed.
220*36dcc4a4SLionel Sambuc.\".Sh STANDARDS
221*36dcc4a4SLionel Sambuc.\"The
222*36dcc4a4SLionel Sambuc.\".Nm
223*36dcc4a4SLionel Sambuc.\"utility is compliant with the
224*36dcc4a4SLionel Sambuc.\".St -p1003.1-2004
225*36dcc4a4SLionel Sambuc.\"standard.
226*36dcc4a4SLionel Sambuc.Sh AUTHORS
227*36dcc4a4SLionel SambucThe Native Language Support (NLS) message catalog facility was
228*36dcc4a4SLionel Sambuccontributed by
229*36dcc4a4SLionel Sambuc.An J.T. Conklin
230*36dcc4a4SLionel Sambuc.Aq jtc@NetBSD.org .
231*36dcc4a4SLionel SambucThis page was originally written by
232*36dcc4a4SLionel Sambuc.An Kee Hinckley
233*36dcc4a4SLionel Sambuc.Aq nazgul@somewhere.com .
234