Do not use \." for comments, always use .\". Discussed with uwe@.diff -r1.11 -r1.12 src/lib/libintl/gettext.3
(joerg)
--- src/lib/libintl/gettext.3 2004/11/10 13:46:14 1.11
+++ src/lib/libintl/gettext.3 2009/11/12 00:43:52 1.12
@@ -1,407 +1,407 @@ | @@ -1,407 +1,407 @@ | |||
1 | .\" $NetBSD: gettext.3,v 1.11 2004/11/10 13:46:14 wiz Exp $ | 1 | .\" $NetBSD: gettext.3,v 1.12 2009/11/12 00:43:52 joerg Exp $ | |
2 | .\" | 2 | .\" | |
3 | .\" Copyright (c) 2000 Citrus Project, | 3 | .\" Copyright (c) 2000 Citrus Project, | |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. | |
5 | .\" | 5 | .\" | |
6 | .\" Redistribution and use in source and binary forms, with or without | 6 | .\" Redistribution and use in source and binary forms, with or without | |
7 | .\" modification, are permitted provided that the following conditions | 7 | .\" modification, are permitted provided that the following conditions | |
8 | .\" are met: | 8 | .\" are met: | |
9 | .\" 1. Redistributions of source code must retain the above copyright | 9 | .\" 1. Redistributions of source code must retain the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer. | 10 | .\" notice, this list of conditions and the following disclaimer. | |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
12 | .\" notice, this list of conditions and the following disclaimer in the | 12 | .\" notice, this list of conditions and the following disclaimer in the | |
13 | .\" documentation and/or other materials provided with the distribution. | 13 | .\" documentation and/or other materials provided with the distribution. | |
14 | .\" | 14 | .\" | |
15 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 15 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
16 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 16 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 18 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
19 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 19 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
20 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 20 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
21 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 21 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
22 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 22 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
23 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 23 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
24 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 24 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
25 | .\" SUCH DAMAGE. | 25 | .\" SUCH DAMAGE. | |
26 | .\" | 26 | .\" | |
27 | .Dd November 10, 2004 | 27 | .Dd November 10, 2004 | |
28 | .Dt GETTEXT 3 | 28 | .Dt GETTEXT 3 | |
29 | .Os | 29 | .Os | |
30 | .Sh NAME | 30 | .Sh NAME | |
31 | .Nm gettext , | 31 | .Nm gettext , | |
32 | .Nm dgettext , | 32 | .Nm dgettext , | |
33 | .Nm ngettext , | 33 | .Nm ngettext , | |
34 | .Nm dngettext , | 34 | .Nm dngettext , | |
35 | .Nm textdomain , | 35 | .Nm textdomain , | |
36 | .Nm bindtextdomain , | 36 | .Nm bindtextdomain , | |
37 | .Nm bind_textdomain_codeset , | 37 | .Nm bind_textdomain_codeset , | |
38 | .Nm dcgettext , | 38 | .Nm dcgettext , | |
39 | .Nm dcngettext | 39 | .Nm dcngettext | |
40 | .Nd message handling functions | 40 | .Nd message handling functions | |
41 | .Sh LIBRARY | 41 | .Sh LIBRARY | |
42 | .Lb libintl | 42 | .Lb libintl | |
43 | .Sh SYNOPSIS | 43 | .Sh SYNOPSIS | |
44 | .In libintl.h | 44 | .In libintl.h | |
45 | .Ft char * | 45 | .Ft char * | |
46 | .Fn gettext "const char *msgid" | 46 | .Fn gettext "const char *msgid" | |
47 | .Ft char * | 47 | .Ft char * | |
48 | .Fn dgettext "const char *domainname" "const char *msgid" | 48 | .Fn dgettext "const char *domainname" "const char *msgid" | |
49 | .Ft char * | 49 | .Ft char * | |
50 | .Fn ngettext "const char *msgid1" "const char *msgid2" "unsigned long int n" | 50 | .Fn ngettext "const char *msgid1" "const char *msgid2" "unsigned long int n" | |
51 | .Ft char * | 51 | .Ft char * | |
52 | .Fn dngettext "const char *domainname" "const char *msgid1" "const char *msgid2" "unsigned long int n" | 52 | .Fn dngettext "const char *domainname" "const char *msgid1" "const char *msgid2" "unsigned long int n" | |
53 | .Ft char * | 53 | .Ft char * | |
54 | .Fn textdomain "const char *domainname" | 54 | .Fn textdomain "const char *domainname" | |
55 | .Ft char * | 55 | .Ft char * | |
56 | .Fn bindtextdomain "const char *domainname" "const char *dirname" | 56 | .Fn bindtextdomain "const char *domainname" "const char *dirname" | |
57 | .Ft char * | 57 | .Ft char * | |
58 | .Fn bind_textdomain_codeset "const char *domainname" "const char *codeset" | 58 | .Fn bind_textdomain_codeset "const char *domainname" "const char *codeset" | |
59 | .In libintl.h | 59 | .In libintl.h | |
60 | .In locale.h | 60 | .In locale.h | |
61 | .Ft char * | 61 | .Ft char * | |
62 | .Fn dcgettext "const char *domainname" "const char *msgid" "int category" | 62 | .Fn dcgettext "const char *domainname" "const char *msgid" "int category" | |
63 | .Ft char * | 63 | .Ft char * | |
64 | .Fn dcngettext "const char *domainname" "const char *msgid1" "const char *msgid2" "unsigned long int n" "int category" | 64 | .Fn dcngettext "const char *domainname" "const char *msgid1" "const char *msgid2" "unsigned long int n" "int category" | |
65 | .Sh DESCRIPTION | 65 | .Sh DESCRIPTION | |
66 | The | 66 | The | |
67 | .Fn gettext , | 67 | .Fn gettext , | |
68 | .Fn dgettext , | 68 | .Fn dgettext , | |
69 | and | 69 | and | |
70 | .Fn dcgettext | 70 | .Fn dcgettext | |
71 | functions attempt to retrieve a | 71 | functions attempt to retrieve a | |
72 | target string based on the specified | 72 | target string based on the specified | |
73 | .Fa msgid | 73 | .Fa msgid | |
74 | argument within the context of a | 74 | argument within the context of a | |
75 | specific domain and the current locale. | 75 | specific domain and the current locale. | |
76 | The length of strings returned by | 76 | The length of strings returned by | |
77 | .Fn gettext , | 77 | .Fn gettext , | |
78 | .Fn dgettext , | 78 | .Fn dgettext , | |
79 | and | 79 | and | |
80 | .Fn dcgettext | 80 | .Fn dcgettext | |
81 | is undetermined until the function is | 81 | is undetermined until the function is | |
82 | called. | 82 | called. | |
83 | The | 83 | The | |
84 | .Fa msgid | 84 | .Fa msgid | |
85 | argument is a nul-terminated string. | 85 | argument is a nul-terminated string. | |
86 | .Pp | 86 | .Pp | |
87 | The | 87 | The | |
88 | .Fn ngettext , | 88 | .Fn ngettext , | |
89 | .Fn dngettext , | 89 | .Fn dngettext , | |
90 | and | 90 | and | |
91 | .Fn dcngettext | 91 | .Fn dcngettext | |
92 | functions are equivalent to | 92 | functions are equivalent to | |
93 | .Fn gettext , | 93 | .Fn gettext , | |
94 | .Fn dgettext , | 94 | .Fn dgettext , | |
95 | and | 95 | and | |
96 | .Fn dcgettext , | 96 | .Fn dcgettext , | |
97 | respectively, except for the handling of | 97 | respectively, except for the handling of | |
98 | plural forms. | 98 | plural forms. | |
99 | The | 99 | The | |
100 | .Fn ngettext , | 100 | .Fn ngettext , | |
101 | .Fn dngettext , | 101 | .Fn dngettext , | |
102 | and | 102 | and | |
103 | .Fn dcngettext | 103 | .Fn dcngettext | |
104 | functions search for the | 104 | functions search for the | |
105 | message string using the | 105 | message string using the | |
106 | .Fa msgid1 | 106 | .Fa msgid1 | |
107 | argument as the key, using the argument | 107 | argument as the key, using the argument | |
108 | .Fa n | 108 | .Fa n | |
109 | to | 109 | to | |
110 | determine the plural form. | 110 | determine the plural form. | |
111 | If no message catalogs are found, | 111 | If no message catalogs are found, | |
112 | .Fa msgid1 | 112 | .Fa msgid1 | |
113 | is returned | 113 | is returned | |
114 | if | 114 | if | |
115 | .Fa n Li == 1 , | 115 | .Fa n Li == 1 , | |
116 | otherwise | 116 | otherwise | |
117 | .Fa msgid2 | 117 | .Fa msgid2 | |
118 | is returned. | 118 | is returned. | |
119 | .Pp | 119 | .Pp | |
120 | The | 120 | The | |
121 | .Dv LANGUAGE | 121 | .Dv LANGUAGE | |
122 | environment variable is examined first to determine the message | 122 | environment variable is examined first to determine the message | |
123 | catalogs to be used. | 123 | catalogs to be used. | |
124 | The value of the | 124 | The value of the | |
125 | .Dv LANGUAGE | 125 | .Dv LANGUAGE | |
126 | environment variable is a list | 126 | environment variable is a list | |
127 | of locale names separated by colon (:) character. | 127 | of locale names separated by colon (:) character. | |
128 | If the | 128 | If the | |
129 | .Dv LANGUAGE | 129 | .Dv LANGUAGE | |
130 | environment | 130 | environment | |
131 | variable is defined, each locale name is tried in the specified order and if a | 131 | variable is defined, each locale name is tried in the specified order and if a | |
132 | message catalog containing the requested message is found, the message is | 132 | message catalog containing the requested message is found, the message is | |
133 | returned. | 133 | returned. | |
134 | If the | 134 | If the | |
135 | .Dv LANGUAGE | 135 | .Dv LANGUAGE | |
136 | environment variable is defined but failed to locate | 136 | environment variable is defined but failed to locate | |
137 | a message catalog, the | 137 | a message catalog, the | |
138 | .Fa msgid | 138 | .Fa msgid | |
139 | string will be returned. | 139 | string will be returned. | |
140 | .Pp | 140 | .Pp | |
141 | If the | 141 | If the | |
142 | .Dv LANGUAGE | 142 | .Dv LANGUAGE | |
143 | environment variable is not defined, | 143 | environment variable is not defined, | |
144 | .Dv LC_ALL , | 144 | .Dv LC_ALL , | |
145 | .Dv LC_xxx , | 145 | .Dv LC_xxx , | |
146 | and | 146 | and | |
147 | .Dv LANG | 147 | .Dv LANG | |
148 | environment variables are examined to locate the message catalog, | 148 | environment variables are examined to locate the message catalog, | |
149 | following the convention used by the | 149 | following the convention used by the | |
150 | .Xr setlocale 3 | 150 | .Xr setlocale 3 | |
151 | function. | 151 | function. | |
152 | .Pp | 152 | .Pp | |
153 | The pathname used to locate the message catalog is | 153 | The pathname used to locate the message catalog is | |
154 | .Pa dirname/locale/category/domainname.mo , | 154 | .Pa dirname/locale/category/domainname.mo , | |
155 | where dirname is the directory specified by | 155 | where dirname is the directory specified by | |
156 | .Fn bindtextdomain , | 156 | .Fn bindtextdomain , | |
157 | locale is a locale name determined by the definition of environment variables, | 157 | locale is a locale name determined by the definition of environment variables, | |
158 | .Fa category | 158 | .Fa category | |
159 | is | 159 | is | |
160 | .Dv LC_MESSAGES | 160 | .Dv LC_MESSAGES | |
161 | if | 161 | if | |
162 | .Fn gettext , | 162 | .Fn gettext , | |
163 | .Fn ngettext , | 163 | .Fn ngettext , | |
164 | .Fn dgettext , | 164 | .Fn dgettext , | |
165 | or | 165 | or | |
166 | .Fn dngettext | 166 | .Fn dngettext | |
167 | is | 167 | is | |
168 | called, otherwise | 168 | called, otherwise | |
169 | .Dv LC_xxx | 169 | .Dv LC_xxx | |
170 | where the name is the same as the locale category name | 170 | where the name is the same as the locale category name | |
171 | specified by the | 171 | specified by the | |
172 | .Fa category | 172 | .Fa category | |
173 | argument of | 173 | argument of | |
174 | .Fn dcgettext | 174 | .Fn dcgettext | |
175 | or | 175 | or | |
176 | .Fn dcngettext . | 176 | .Fn dcngettext . | |
177 | .Fa domainname | 177 | .Fa domainname | |
178 | is the name of the domain specified by | 178 | is the name of the domain specified by | |
179 | .Fn textdomain | 179 | .Fn textdomain | |
180 | or the | 180 | or the | |
181 | .Fa domainname | 181 | .Fa domainname | |
182 | argument of | 182 | argument of | |
183 | .Fn dgettext , | 183 | .Fn dgettext , | |
184 | .Fn dngettext , | 184 | .Fn dngettext , | |
185 | .Fn dcgettext , | 185 | .Fn dcgettext , | |
186 | or | 186 | or | |
187 | .Fn dcngettext . | 187 | .Fn dcngettext . | |
188 | .Pp | 188 | .Pp | |
189 | For | 189 | For | |
190 | .Fn gettext | 190 | .Fn gettext | |
191 | and | 191 | and | |
192 | .Fn ngettext , | 192 | .Fn ngettext , | |
193 | the domain used is set by the last valid call to | 193 | the domain used is set by the last valid call to | |
194 | .Fn textdomain . | 194 | .Fn textdomain . | |
195 | If a valid call to | 195 | If a valid call to | |
196 | .Fn textdomain | 196 | .Fn textdomain | |
197 | has not been made, the default | 197 | has not been made, the default | |
198 | domain (called messages) is used. | 198 | domain (called messages) is used. | |
199 | .Pp | 199 | .Pp | |
200 | For | 200 | For | |
201 | .Fn dgettext , | 201 | .Fn dgettext , | |
202 | .Fn dngettext , | 202 | .Fn dngettext , | |
203 | .Fn dcgettext , | 203 | .Fn dcgettext , | |
204 | and | 204 | and | |
205 | .Fn dcngettext , | 205 | .Fn dcngettext , | |
206 | the domain used is | 206 | the domain used is | |
207 | specified by the | 207 | specified by the | |
208 | .Fa domainname | 208 | .Fa domainname | |
209 | argument. | 209 | argument. | |
210 | The | 210 | The | |
211 | .Fa domainname | 211 | .Fa domainname | |
212 | argument is equivalent in | 212 | argument is equivalent in | |
213 | syntax and meaning to the | 213 | syntax and meaning to the | |
214 | .Fa domainname | 214 | .Fa domainname | |
215 | argument to | 215 | argument to | |
216 | .Fn textdomain , | 216 | .Fn textdomain , | |
217 | except that the | 217 | except that the | |
218 | selection of the domain is valid only for the duration of the | 218 | selection of the domain is valid only for the duration of the | |
219 | .Fn dgettext , | 219 | .Fn dgettext , | |
220 | .Fn dngettext , | 220 | .Fn dngettext , | |
221 | .Fn dcgettext , | 221 | .Fn dcgettext , | |
222 | or | 222 | or | |
223 | .Fn dcngettext | 223 | .Fn dcngettext | |
224 | function call. | 224 | function call. | |
225 | .Pp | 225 | .Pp | |
226 | The | 226 | The | |
227 | .Fn dcgettext | 227 | .Fn dcgettext | |
228 | and | 228 | and | |
229 | .Fn dcngettext | 229 | .Fn dcngettext | |
230 | functions require additional argument | 230 | functions require additional argument | |
231 | .Fa category | 231 | .Fa category | |
232 | for retrieving message string for other than | 232 | for retrieving message string for other than | |
233 | .Dv LC_MESSAGES | 233 | .Dv LC_MESSAGES | |
234 | category. | 234 | category. | |
235 | Available value for the | 235 | Available value for the | |
236 | .Fa category | 236 | .Fa category | |
237 | argument are | 237 | argument are | |
238 | .Dv LC_CTYPE , | 238 | .Dv LC_CTYPE , | |
239 | .Dv LC_COLLATE , | 239 | .Dv LC_COLLATE , | |
240 | .Dv LC_MESSAGES , | 240 | .Dv LC_MESSAGES , | |
241 | .Dv LC_MONETARY , | 241 | .Dv LC_MONETARY , | |
242 | .Dv LC_NUMERIC , | 242 | .Dv LC_NUMERIC , | |
243 | and | 243 | and | |
244 | .Dv LC_TIME . | 244 | .Dv LC_TIME . | |
245 | The call of | 245 | The call of | |
246 | .Fn dcgettext "domainname" "msgid" "LC_MESSAGES" | 246 | .Fn dcgettext "domainname" "msgid" "LC_MESSAGES" | |
247 | is equivalent to | 247 | is equivalent to | |
248 | .Fn dgettext "domainname" "msgid" . | 248 | .Fn dgettext "domainname" "msgid" . | |
249 | Note that | 249 | Note that | |
250 | .Dv LC_ALL | 250 | .Dv LC_ALL | |
251 | must not be used. | 251 | must not be used. | |
252 | .Pp | 252 | .Pp | |
253 | The | 253 | The | |
254 | .Fn textdomain | 254 | .Fn textdomain | |
255 | function sets or queries the name of the current domain of the | 255 | function sets or queries the name of the current domain of the | |
256 | active | 256 | active | |
257 | .Dv LC_MESSAGES | 257 | .Dv LC_MESSAGES | |
258 | locale category. | 258 | locale category. | |
259 | The | 259 | The | |
260 | .Fa domainname | 260 | .Fa domainname | |
261 | argument is a | 261 | argument is a | |
262 | nul-terminated string that can contain only the characters allowed in legal | 262 | nul-terminated string that can contain only the characters allowed in legal | |
263 | filenames. | 263 | filenames. | |
264 | .Pp | 264 | .Pp | |
265 | The | 265 | The | |
266 | .Fa domainname | 266 | .Fa domainname | |
267 | argument is the unique name of a domain on the system. | 267 | argument is the unique name of a domain on the system. | |
268 | If there | 268 | If there | |
269 | are multiple versions of the same domain on one system, namespace collisions | 269 | are multiple versions of the same domain on one system, namespace collisions | |
270 | can be avoided by using | 270 | can be avoided by using | |
271 | .Fn bindtextdomain . | 271 | .Fn bindtextdomain . | |
272 | If | 272 | If | |
273 | .Fn textdomain | 273 | .Fn textdomain | |
274 | is not called, a | 274 | is not called, a | |
275 | default domain is selected. | 275 | default domain is selected. | |
276 | The setting of domain made by the last valid call | 276 | The setting of domain made by the last valid call | |
277 | to | 277 | to | |
278 | .Fn textdomain | 278 | .Fn textdomain | |
279 | remains valid across subsequent calls to | 279 | remains valid across subsequent calls to | |
280 | .Xr setlocale 3 , | 280 | .Xr setlocale 3 , | |
281 | and | 281 | and | |
282 | .Fn gettext . | 282 | .Fn gettext . | |
283 | .Pp | 283 | .Pp | |
284 | The | 284 | The | |
285 | .Fa domainname | 285 | .Fa domainname | |
286 | argument is applied to the currently active LC_MESSAGES locale. | 286 | argument is applied to the currently active LC_MESSAGES locale. | |
287 | .Pp | 287 | .Pp | |
288 | The current setting of the domain can be queried without affecting the current | 288 | The current setting of the domain can be queried without affecting the current | |
289 | state of the domain by calling | 289 | state of the domain by calling | |
290 | .Fn textdomain | 290 | .Fn textdomain | |
291 | with | 291 | with | |
292 | .Fa domainname | 292 | .Fa domainname | |
293 | set to the | 293 | set to the | |
294 | .Dv NULL | 294 | .Dv NULL | |
295 | pointer. | 295 | pointer. | |
296 | Calling | 296 | Calling | |
297 | .Fn textdomain | 297 | .Fn textdomain | |
298 | with a | 298 | with a | |
299 | .Fa domainname | 299 | .Fa domainname | |
300 | argument of a | 300 | argument of a | |
301 | .Dv NULL | 301 | .Dv NULL | |
302 | string sets | 302 | string sets | |
303 | the domain to the default domain | 303 | the domain to the default domain | |
304 | .Pq messages . | 304 | .Pq messages . | |
305 | .Pp | 305 | .Pp | |
306 | The | 306 | The | |
307 | .Fn bindtextdomain | 307 | .Fn bindtextdomain | |
308 | function binds the path predicate for a message domain | 308 | function binds the path predicate for a message domain | |
309 | .Fa domainname | 309 | .Fa domainname | |
310 | to the value contained in dirname. | 310 | to the value contained in dirname. | |
311 | If | 311 | If | |
312 | .Fa domainname | 312 | .Fa domainname | |
313 | is a non-empty | 313 | is a non-empty | |
314 | string and has not been bound previously, | 314 | string and has not been bound previously, | |
315 | .Fn bindtextdomain | 315 | .Fn bindtextdomain | |
316 | binds | 316 | binds | |
317 | .Fa domainname | 317 | .Fa domainname | |
318 | with | 318 | with | |
319 | .Fa dirname . | 319 | .Fa dirname . | |
320 | .Pp | 320 | .Pp | |
321 | If | 321 | If | |
322 | .Fa domainname | 322 | .Fa domainname | |
323 | is a non-empty string and has been bound previously, | 323 | is a non-empty string and has been bound previously, | |
324 | .Fn bindtextdomain | 324 | .Fn bindtextdomain | |
325 | replaces the old binding with dirname. | 325 | replaces the old binding with dirname. | |
326 | The dirname argument | 326 | The dirname argument | |
327 | can be an absolute pathname being resolved when | 327 | can be an absolute pathname being resolved when | |
328 | .Fn gettext , | 328 | .Fn gettext , | |
329 | .Fn ngettext , | 329 | .Fn ngettext , | |
330 | .Fn dgettext , | 330 | .Fn dgettext , | |
331 | .Fn dngettext , | 331 | .Fn dngettext , | |
332 | .Fn dcgettext , | 332 | .Fn dcgettext , | |
333 | or | 333 | or | |
334 | .Fn dcngettext | 334 | .Fn dcngettext | |
335 | are called. | 335 | are called. | |
336 | If | 336 | If | |
337 | .Fa domainname | 337 | .Fa domainname | |
338 | is a | 338 | is a | |
339 | .Dv NULL | 339 | .Dv NULL | |
340 | pointer or an empty string, | 340 | pointer or an empty string, | |
341 | .Fn bindtextdomain | 341 | .Fn bindtextdomain | |
342 | returns a | 342 | returns a | |
343 | .Dv NULL | 343 | .Dv NULL | |
344 | pointer. | 344 | pointer. | |
345 | If | 345 | If | |
346 | .Fn bindtextdomain | 346 | .Fn bindtextdomain | |
347 | is not called, implementation-defined default directory is used. | 347 | is not called, implementation-defined default directory is used. | |
348 | .Pp | 348 | .Pp | |
349 | The | 349 | The | |
350 | .Fn bind_textdomain_codeset | 350 | .Fn bind_textdomain_codeset | |
351 | function can be used to specify the output | 351 | function can be used to specify the output | |
352 | .Fa codeset | 352 | .Fa codeset | |
353 | for message catalogs for domain | 353 | for message catalogs for domain | |
354 | .Fa domainname . | 354 | .Fa domainname . | |
355 | The | 355 | The | |
356 | .Fa codeset | 356 | .Fa codeset | |
357 | argument must | 357 | argument must | |
358 | be a valid codeset name which can be used for the | 358 | be a valid codeset name which can be used for the | |
359 | .Xr iconv_open 3 | 359 | .Xr iconv_open 3 | |
360 | function. | 360 | function. | |
361 | .Pp | 361 | .Pp | |
362 | If the | 362 | If the | |
363 | .Fa codeset | 363 | .Fa codeset | |
364 | argument is the | 364 | argument is the | |
365 | .Dv NULL | 365 | .Dv NULL | |
366 | pointer, | 366 | pointer, | |
367 | .Fn bind_textdomain_codeset | 367 | .Fn bind_textdomain_codeset | |
368 | returns the currently selected | 368 | returns the currently selected | |
369 | .Fa codeset | 369 | .Fa codeset | |
370 | for the domain with the name | 370 | for the domain with the name | |
371 | .Fa domainname . | 371 | .Fa domainname . | |
372 | It returns a | 372 | It returns a | |
373 | .Dv NULL | 373 | .Dv NULL | |
374 | pointer if no | 374 | pointer if no | |
375 | .Fa codeset | 375 | .Fa codeset | |
376 | has yet been selected. | 376 | has yet been selected. | |
377 | .Pp | 377 | .Pp | |
378 | The | 378 | The | |
379 | .Fn bind_textdomain_codeset | 379 | .Fn bind_textdomain_codeset | |
380 | function can be used several times. | 380 | function can be used several times. | |
381 | If used multiple times, with the same | 381 | If used multiple times, with the same | |
382 | .Fa domainname | 382 | .Fa domainname | |
383 | argument, | 383 | argument, | |
384 | the later call overrides the | 384 | the later call overrides the | |
385 | settings made by the earlier one. | 385 | settings made by the earlier one. | |
386 | .Pp | 386 | .Pp | |
387 | The | 387 | The | |
388 | .Fn bind_textdomain_codeset | 388 | .Fn bind_textdomain_codeset | |
389 | function returns a pointer to a string containing | 389 | function returns a pointer to a string containing | |
390 | the name of the selected | 390 | the name of the selected | |
391 | .Fa codeset . | 391 | .Fa codeset . | |
392 | .\".Sh "RETURN VALUES" | 392 | .\".Sh "RETURN VALUES" | |
393 | .\".Sh EXAMPLES | 393 | .\".Sh EXAMPLES | |
394 | .Sh SEE ALSO | 394 | .Sh SEE ALSO | |
395 | .Xr setlocale 3 , | 395 | .Xr setlocale 3 , | |
396 | .Xr nls 7 | 396 | .Xr nls 7 | |
397 | .\".Sh STANDARDS | 397 | .\".Sh STANDARDS | |
398 | .Sh HISTORY | 398 | .Sh HISTORY | |
399 | The functions are implemented by Citrus project, | 399 | The functions are implemented by Citrus project, | |
400 | based on the documentations for GNU gettext. | 400 | based on the documentations for GNU gettext. | |
401 | .Sh BUGS | 401 | .Sh BUGS | |
402 | \." The text was ripped off from Annex C of | 402 | .\" The text was ripped off from Annex C of | |
403 | \." .Dq LI18NUX 2000 Globalization Specification Version 1.0 . | 403 | .\" .Dq LI18NUX 2000 Globalization Specification Version 1.0 . | |
404 | \." .Pp | 404 | .\" .Pp | |
405 | .Fn bind_textdomain_codeset | 405 | .Fn bind_textdomain_codeset | |
406 | does not work at this moment | 406 | does not work at this moment | |
407 | .Pq it always fails . | 407 | .Pq it always fails . |
--- src/usr.bin/tr/tr.1 2009/08/22 00:23:02 1.17
+++ src/usr.bin/tr/tr.1 2009/11/12 00:43:53 1.18
@@ -1,350 +1,350 @@ | @@ -1,350 +1,350 @@ | |||
1 | .\" $NetBSD: tr.1,v 1.17 2009/08/22 00:23:02 joerg Exp $ | 1 | .\" $NetBSD: tr.1,v 1.18 2009/11/12 00:43:53 joerg Exp $ | |
2 | .\" | 2 | .\" | |
3 | .\" Copyright (c) 1991, 1993 | 3 | .\" Copyright (c) 1991, 1993 | |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. | |
5 | .\" | 5 | .\" | |
6 | .\" This code is derived from software contributed to Berkeley by | 6 | .\" This code is derived from software contributed to Berkeley by | |
7 | .\" the Institute of Electrical and Electronics Engineers, Inc. | 7 | .\" the Institute of Electrical and Electronics Engineers, Inc. | |
8 | .\" | 8 | .\" | |
9 | .\" Redistribution and use in source and binary forms, with or without | 9 | .\" Redistribution and use in source and binary forms, with or without | |
10 | .\" modification, are permitted provided that the following conditions | 10 | .\" modification, are permitted provided that the following conditions | |
11 | .\" are met: | 11 | .\" are met: | |
12 | .\" 1. Redistributions of source code must retain the above copyright | 12 | .\" 1. Redistributions of source code must retain the above copyright | |
13 | .\" notice, this list of conditions and the following disclaimer. | 13 | .\" notice, this list of conditions and the following disclaimer. | |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
15 | .\" notice, this list of conditions and the following disclaimer in the | 15 | .\" notice, this list of conditions and the following disclaimer in the | |
16 | .\" documentation and/or other materials provided with the distribution. | 16 | .\" documentation and/or other materials provided with the distribution. | |
17 | .\" 3. Neither the name of the University nor the names of its contributors | 17 | .\" 3. Neither the name of the University nor the names of its contributors | |
18 | .\" may be used to endorse or promote products derived from this software | 18 | .\" may be used to endorse or promote products derived from this software | |
19 | .\" without specific prior written permission. | 19 | .\" without specific prior written permission. | |
20 | .\" | 20 | .\" | |
21 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 21 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
22 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 22 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 23 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 24 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
25 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 25 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 26 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 27 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 28 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 29 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | .\" SUCH DAMAGE. | 31 | .\" SUCH DAMAGE. | |
32 | .\" | 32 | .\" | |
33 | .\" @(#)tr.1 8.1 (Berkeley) 6/6/93 | 33 | .\" @(#)tr.1 8.1 (Berkeley) 6/6/93 | |
34 | .\" | 34 | .\" | |
35 | .Dd March 23, 2004 | 35 | .Dd March 23, 2004 | |
36 | .Dt TR 1 | 36 | .Dt TR 1 | |
37 | .Os | 37 | .Os | |
38 | .Sh NAME | 38 | .Sh NAME | |
39 | .Nm tr | 39 | .Nm tr | |
40 | .Nd translate characters | 40 | .Nd translate characters | |
41 | .Sh SYNOPSIS | 41 | .Sh SYNOPSIS | |
42 | .Nm | 42 | .Nm | |
43 | .Op Fl cs | 43 | .Op Fl cs | |
44 | .Ar string1 string2 | 44 | .Ar string1 string2 | |
45 | .Nm | 45 | .Nm | |
46 | .Op Fl c | 46 | .Op Fl c | |
47 | .Fl d | 47 | .Fl d | |
48 | .Ar string1 | 48 | .Ar string1 | |
49 | .Nm | 49 | .Nm | |
50 | .Op Fl c | 50 | .Op Fl c | |
51 | .Fl s | 51 | .Fl s | |
52 | .Ar string1 | 52 | .Ar string1 | |
53 | .Nm | 53 | .Nm | |
54 | .Op Fl c | 54 | .Op Fl c | |
55 | .Fl ds | 55 | .Fl ds | |
56 | .Ar string1 string2 | 56 | .Ar string1 string2 | |
57 | .Sh DESCRIPTION | 57 | .Sh DESCRIPTION | |
58 | The | 58 | The | |
59 | .Nm | 59 | .Nm | |
60 | utility copies the standard input to the standard output with substitution | 60 | utility copies the standard input to the standard output with substitution | |
61 | or deletion of selected characters. | 61 | or deletion of selected characters. | |
62 | .Pp | 62 | .Pp | |
63 | The following options are available: | 63 | The following options are available: | |
64 | .Bl -tag -width Ds | 64 | .Bl -tag -width Ds | |
65 | .It Fl c | 65 | .It Fl c | |
66 | Complements the set of characters in | 66 | Complements the set of characters in | |
67 | .Ar string1 , | 67 | .Ar string1 , | |
68 | that is | 68 | that is | |
69 | .Fl c Ar \&ab | 69 | .Fl c Ar \&ab | |
70 | includes every character except for | 70 | includes every character except for | |
71 | .Sq a | 71 | .Sq a | |
72 | and | 72 | and | |
73 | .Sq b . | 73 | .Sq b . | |
74 | .It Fl d | 74 | .It Fl d | |
75 | The | 75 | The | |
76 | .Fl d | 76 | .Fl d | |
77 | option causes characters to be deleted from the input. | 77 | option causes characters to be deleted from the input. | |
78 | .It Fl s | 78 | .It Fl s | |
79 | The | 79 | The | |
80 | .Fl s | 80 | .Fl s | |
81 | option squeezes multiple occurrences of the characters listed in the last | 81 | option squeezes multiple occurrences of the characters listed in the last | |
82 | operand (either | 82 | operand (either | |
83 | .Ar string1 | 83 | .Ar string1 | |
84 | or | 84 | or | |
85 | .Ar string2 ) | 85 | .Ar string2 ) | |
86 | in the input into a single instance of the character. | 86 | in the input into a single instance of the character. | |
87 | This occurs after all deletion and translation is completed. | 87 | This occurs after all deletion and translation is completed. | |
88 | .El | 88 | .El | |
89 | .Pp | 89 | .Pp | |
90 | In the first synopsis form, the characters in | 90 | In the first synopsis form, the characters in | |
91 | .Ar string1 | 91 | .Ar string1 | |
92 | are translated into the characters in | 92 | are translated into the characters in | |
93 | .Ar string2 | 93 | .Ar string2 | |
94 | where the first character in | 94 | where the first character in | |
95 | .Ar string1 | 95 | .Ar string1 | |
96 | is translated into the first character in | 96 | is translated into the first character in | |
97 | .Ar string2 | 97 | .Ar string2 | |
98 | and so on. | 98 | and so on. | |
99 | If | 99 | If | |
100 | .Ar string1 | 100 | .Ar string1 | |
101 | is longer than | 101 | is longer than | |
102 | .Ar string2 , | 102 | .Ar string2 , | |
103 | the last character found in | 103 | the last character found in | |
104 | .Ar string2 | 104 | .Ar string2 | |
105 | is duplicated until | 105 | is duplicated until | |
106 | .Ar string1 | 106 | .Ar string1 | |
107 | is exhausted. | 107 | is exhausted. | |
108 | .Pp | 108 | .Pp | |
109 | In the second synopsis form, the characters in | 109 | In the second synopsis form, the characters in | |
110 | .Ar string1 | 110 | .Ar string1 | |
111 | are deleted from the input. | 111 | are deleted from the input. | |
112 | .Pp | 112 | .Pp | |
113 | In the third synopsis form, the characters in | 113 | In the third synopsis form, the characters in | |
114 | .Ar string1 | 114 | .Ar string1 | |
115 | are compressed as described for the | 115 | are compressed as described for the | |
116 | .Fl s | 116 | .Fl s | |
117 | option. | 117 | option. | |
118 | .Pp | 118 | .Pp | |
119 | In the fourth synopsis form, the characters in | 119 | In the fourth synopsis form, the characters in | |
120 | .Ar string1 | 120 | .Ar string1 | |
121 | are deleted from the input, and the characters in | 121 | are deleted from the input, and the characters in | |
122 | .Ar string2 | 122 | .Ar string2 | |
123 | are compressed as described for the | 123 | are compressed as described for the | |
124 | .Fl s | 124 | .Fl s | |
125 | option. | 125 | option. | |
126 | .Pp | 126 | .Pp | |
127 | The following conventions can be used in | 127 | The following conventions can be used in | |
128 | .Ar string1 | 128 | .Ar string1 | |
129 | and | 129 | and | |
130 | .Ar string2 | 130 | .Ar string2 | |
131 | to specify sets of characters: | 131 | to specify sets of characters: | |
132 | .Bl -tag -width [:equiv:] | 132 | .Bl -tag -width [:equiv:] | |
133 | .It character | 133 | .It character | |
134 | Any character not described by one of the following conventions | 134 | Any character not described by one of the following conventions | |
135 | represents itself. | 135 | represents itself. | |
136 | .It \eoctal | 136 | .It \eoctal | |
137 | A backslash followed by 1, 2 or 3 octal digits represents a character | 137 | A backslash followed by 1, 2 or 3 octal digits represents a character | |
138 | with that encoded value. | 138 | with that encoded value. | |
139 | To follow an octal sequence with a digit as a character, left zero-pad | 139 | To follow an octal sequence with a digit as a character, left zero-pad | |
140 | the octal sequence to the full 3 octal digits. | 140 | the octal sequence to the full 3 octal digits. | |
141 | .It \echaracter | 141 | .It \echaracter | |
142 | A backslash followed by certain special characters maps to special | 142 | A backslash followed by certain special characters maps to special | |
143 | values. | 143 | values. | |
144 | .sp | 144 | .sp | |
145 | .Bl -column cc | 145 | .Bl -column cc | |
146 | .It \ea \*[Lt]alert character\*[Gt] | 146 | .It \ea \*[Lt]alert character\*[Gt] | |
147 | .It \eb \*[Lt]backspace\*[Gt] | 147 | .It \eb \*[Lt]backspace\*[Gt] | |
148 | .It \ef \*[Lt]form-feed\*[Gt] | 148 | .It \ef \*[Lt]form-feed\*[Gt] | |
149 | .It \en \*[Lt]newline\*[Gt] | 149 | .It \en \*[Lt]newline\*[Gt] | |
150 | .It \er \*[Lt]carriage return\*[Gt] | 150 | .It \er \*[Lt]carriage return\*[Gt] | |
151 | .It \et \*[Lt]tab\*[Gt] | 151 | .It \et \*[Lt]tab\*[Gt] | |
152 | .It \ev \*[Lt]vertical tab\*[Gt] | 152 | .It \ev \*[Lt]vertical tab\*[Gt] | |
153 | .El | 153 | .El | |
154 | .sp | 154 | .sp | |
155 | A backslash followed by any other character maps to that character. | 155 | A backslash followed by any other character maps to that character. | |
156 | .It c-c | 156 | .It c-c | |
157 | Represents the range of characters between the range endpoints, inclusively. | 157 | Represents the range of characters between the range endpoints, inclusively. | |
158 | .It [:class:] | 158 | .It [:class:] | |
159 | Represents all characters belonging to the defined character class. | 159 | Represents all characters belonging to the defined character class. | |
160 | Class names are: | 160 | Class names are: | |
161 | .sp | 161 | .sp | |
162 | .Bl -column xdigit | 162 | .Bl -column xdigit | |
163 | .It alnum \*[Lt]alphanumeric characters\*[Gt] | 163 | .It alnum \*[Lt]alphanumeric characters\*[Gt] | |
164 | .It alpha \*[Lt]alphabetic characters\*[Gt] | 164 | .It alpha \*[Lt]alphabetic characters\*[Gt] | |
165 | .It blank \*[Lt]blank characters\*[Gt] | 165 | .It blank \*[Lt]blank characters\*[Gt] | |
166 | .It cntrl \*[Lt]control characters\*[Gt] | 166 | .It cntrl \*[Lt]control characters\*[Gt] | |
167 | .It digit \*[Lt]numeric characters\*[Gt] | 167 | .It digit \*[Lt]numeric characters\*[Gt] | |
168 | .It graph \*[Lt]graphic characters\*[Gt] | 168 | .It graph \*[Lt]graphic characters\*[Gt] | |
169 | .It lower \*[Lt]lower-case alphabetic characters\*[Gt] | 169 | .It lower \*[Lt]lower-case alphabetic characters\*[Gt] | |
170 | .It print \*[Lt]printable characters\*[Gt] | 170 | .It print \*[Lt]printable characters\*[Gt] | |
171 | .It punct \*[Lt]punctuation characters\*[Gt] | 171 | .It punct \*[Lt]punctuation characters\*[Gt] | |
172 | .It space \*[Lt]space characters\*[Gt] | 172 | .It space \*[Lt]space characters\*[Gt] | |
173 | .It upper \*[Lt]upper-case characters\*[Gt] | 173 | .It upper \*[Lt]upper-case characters\*[Gt] | |
174 | .It xdigit \*[Lt]hexadecimal characters\*[Gt] | 174 | .It xdigit \*[Lt]hexadecimal characters\*[Gt] | |
175 | .El | 175 | .El | |
176 | .Pp | 176 | .Pp | |
177 | \." All classes may be used in | 177 | .\" All classes may be used in | |
178 | \." .Ar string1 , | 178 | .\" .Ar string1 , | |
179 | \." and in | 179 | .\" and in | |
180 | \." .Ar string2 | 180 | .\" .Ar string2 | |
181 | \." when both the | 181 | .\" when both the | |
182 | \." .Fl d | 182 | .\" .Fl d | |
183 | \." and | 183 | .\" and | |
184 | \." .Fl s | 184 | .\" .Fl s | |
185 | \." options are specified. | 185 | .\" options are specified. | |
186 | \." Otherwise, only the classes ``upper'' and ``lower'' may be used in | 186 | .\" Otherwise, only the classes ``upper'' and ``lower'' may be used in | |
187 | \." .Ar string2 | 187 | .\" .Ar string2 | |
188 | \." and then only when the corresponding class (``upper'' for ``lower'' | 188 | .\" and then only when the corresponding class (``upper'' for ``lower'' | |
189 | \." and vice-versa) is specified in the same relative position in | 189 | .\" and vice-versa) is specified in the same relative position in | |
190 | \." .Ar string1 . | 190 | .\" .Ar string1 . | |
191 | \." .Pp | 191 | .\" .Pp | |
192 | With the exception of the | 192 | With the exception of the | |
193 | .Dq upper | 193 | .Dq upper | |
194 | and | 194 | and | |
195 | .Dq lower | 195 | .Dq lower | |
196 | classes, characters in the classes are in unspecified order. | 196 | classes, characters in the classes are in unspecified order. | |
197 | In the | 197 | In the | |
198 | .Dq upper | 198 | .Dq upper | |
199 | and | 199 | and | |
200 | .Dq lower | 200 | .Dq lower | |
201 | classes, characters are entered in ascending order. | 201 | classes, characters are entered in ascending order. | |
202 | .Pp | 202 | .Pp | |
203 | For specific information as to which ASCII characters are included | 203 | For specific information as to which ASCII characters are included | |
204 | in these classes, see | 204 | in these classes, see | |
205 | .Xr ctype 3 | 205 | .Xr ctype 3 | |
206 | and related manual pages. | 206 | and related manual pages. | |
207 | .It [=equiv=] | 207 | .It [=equiv=] | |
208 | Represents all characters or collating (sorting) elements belonging to | 208 | Represents all characters or collating (sorting) elements belonging to | |
209 | the same equivalence class as | 209 | the same equivalence class as | |
210 | .Ar equiv . | 210 | .Ar equiv . | |
211 | If there is a secondary ordering within the equivalence class, the | 211 | If there is a secondary ordering within the equivalence class, the | |
212 | characters are ordered in ascending sequence. | 212 | characters are ordered in ascending sequence. | |
213 | Otherwise, they are ordered after their encoded values. | 213 | Otherwise, they are ordered after their encoded values. | |
214 | An example of an equivalence class might be | 214 | An example of an equivalence class might be | |
215 | .Dq \&c | 215 | .Dq \&c | |
216 | and | 216 | and | |
217 | .Dq \&ch | 217 | .Dq \&ch | |
218 | in Spanish; | 218 | in Spanish; | |
219 | English has no equivalence classes. | 219 | English has no equivalence classes. | |
220 | .It [#*n] | 220 | .It [#*n] | |
221 | Represents | 221 | Represents | |
222 | .Ar n | 222 | .Ar n | |
223 | repeated occurrences of the character represented by | 223 | repeated occurrences of the character represented by | |
224 | .Ar # . | 224 | .Ar # . | |
225 | This | 225 | This | |
226 | expression is only valid when it occurs in | 226 | expression is only valid when it occurs in | |
227 | .Ar string2 . | 227 | .Ar string2 . | |
228 | If | 228 | If | |
229 | .Ar n | 229 | .Ar n | |
230 | is omitted or is zero, it is interpreted as large enough to extend | 230 | is omitted or is zero, it is interpreted as large enough to extend | |
231 | .Ar string2 | 231 | .Ar string2 | |
232 | sequence to the length of | 232 | sequence to the length of | |
233 | .Ar string1 . | 233 | .Ar string1 . | |
234 | If | 234 | If | |
235 | .Ar n | 235 | .Ar n | |
236 | has a leading zero, it is interpreted as an octal value, otherwise, | 236 | has a leading zero, it is interpreted as an octal value, otherwise, | |
237 | it's interpreted as a decimal value. | 237 | it's interpreted as a decimal value. | |
238 | .El | 238 | .El | |
239 | .Sh EXIT STATUS | 239 | .Sh EXIT STATUS | |
240 | .Nm | 240 | .Nm | |
241 | exits 0 on success, and \*[Gt]0 if an error occurs. | 241 | exits 0 on success, and \*[Gt]0 if an error occurs. | |
242 | .Sh EXAMPLES | 242 | .Sh EXAMPLES | |
243 | The following examples are shown as given to the shell: | 243 | The following examples are shown as given to the shell: | |
244 | .Pp | 244 | .Pp | |
245 | Create a list of the words in | 245 | Create a list of the words in | |
246 | .Ar file1 , | 246 | .Ar file1 , | |
247 | one per line, where a word is taken to be a maximal string of letters: | 247 | one per line, where a word is taken to be a maximal string of letters: | |
248 | .sp | 248 | .sp | |
249 | .D1 Li "tr -cs \*q[:alpha:]\*q \*q\en\*q \*[Lt] file1" | 249 | .D1 Li "tr -cs \*q[:alpha:]\*q \*q\en\*q \*[Lt] file1" | |
250 | .sp | 250 | .sp | |
251 | Translate the contents of | 251 | Translate the contents of | |
252 | .Ar file1 | 252 | .Ar file1 | |
253 | to upper-case: | 253 | to upper-case: | |
254 | .sp | 254 | .sp | |
255 | .D1 Li "tr \*q[:lower:]\*q \*q[:upper:]\*q \*[Lt] file1" | 255 | .D1 Li "tr \*q[:lower:]\*q \*q[:upper:]\*q \*[Lt] file1" | |
256 | .sp | 256 | .sp | |
257 | Strip out non-printable characters from | 257 | Strip out non-printable characters from | |
258 | .Ar file1 : | 258 | .Ar file1 : | |
259 | .sp | 259 | .sp | |
260 | .D1 Li "tr -cd \*q[:print:]\*q \*[Lt] file1" | 260 | .D1 Li "tr -cd \*q[:print:]\*q \*[Lt] file1" | |
261 | .Sh COMPATIBILITY | 261 | .Sh COMPATIBILITY | |
262 | .At V | 262 | .At V | |
263 | has historically implemented character ranges using the syntax | 263 | has historically implemented character ranges using the syntax | |
264 | .Dq [c-c] | 264 | .Dq [c-c] | |
265 | instead of the | 265 | instead of the | |
266 | .Dq c-c | 266 | .Dq c-c | |
267 | used by historic | 267 | used by historic | |
268 | .Bx | 268 | .Bx | |
269 | implementations and standardized by POSIX. | 269 | implementations and standardized by POSIX. | |
270 | .At V | 270 | .At V | |
271 | shell scripts should work under this implementation as long as | 271 | shell scripts should work under this implementation as long as | |
272 | the range is intended to map in another range, i.e. the command | 272 | the range is intended to map in another range, i.e. the command | |
273 | .Pp | 273 | .Pp | |
274 | .Ic "tr [a-z] [A-Z]" | 274 | .Ic "tr [a-z] [A-Z]" | |
275 | .Pp | 275 | .Pp | |
276 | will work as it will map the | 276 | will work as it will map the | |
277 | .Sq \&[ | 277 | .Sq \&[ | |
278 | character in | 278 | character in | |
279 | .Ar string1 | 279 | .Ar string1 | |
280 | to the | 280 | to the | |
281 | .Sq \&[ | 281 | .Sq \&[ | |
282 | character in | 282 | character in | |
283 | .Ar string2 . | 283 | .Ar string2 . | |
284 | However, if the shell script is deleting or squeezing characters as in | 284 | However, if the shell script is deleting or squeezing characters as in | |
285 | the command | 285 | the command | |
286 | .Pp | 286 | .Pp | |
287 | .Ic "tr -d [a-z]" | 287 | .Ic "tr -d [a-z]" | |
288 | .Pp | 288 | .Pp | |
289 | the characters | 289 | the characters | |
290 | .Sq \&[ | 290 | .Sq \&[ | |
291 | and | 291 | and | |
292 | .Sq \&] | 292 | .Sq \&] | |
293 | will be included in the deletion or compression list which would | 293 | will be included in the deletion or compression list which would | |
294 | not have happened under an historic | 294 | not have happened under an historic | |
295 | .At V | 295 | .At V | |
296 | implementation. | 296 | implementation. | |
297 | Additionally, any scripts that depended on the sequence | 297 | Additionally, any scripts that depended on the sequence | |
298 | .Dq a-z | 298 | .Dq a-z | |
299 | to represent the three characters | 299 | to represent the three characters | |
300 | .Sq \&a , | 300 | .Sq \&a , | |
301 | .Sq \&- , | 301 | .Sq \&- , | |
302 | and | 302 | and | |
303 | .Sq \&z | 303 | .Sq \&z | |
304 | will have to be rewritten as | 304 | will have to be rewritten as | |
305 | .Dq a\e-z . | 305 | .Dq a\e-z . | |
306 | .Pp | 306 | .Pp | |
307 | The | 307 | The | |
308 | .Nm | 308 | .Nm | |
309 | utility has historically not permitted the manipulation of NUL bytes in | 309 | utility has historically not permitted the manipulation of NUL bytes in | |
310 | its input and, additionally, stripped NUL's from its input stream. | 310 | its input and, additionally, stripped NUL's from its input stream. | |
311 | This implementation has removed this behavior as a bug. | 311 | This implementation has removed this behavior as a bug. | |
312 | .Pp | 312 | .Pp | |
313 | The | 313 | The | |
314 | .Nm | 314 | .Nm | |
315 | utility has historically been extremely forgiving of syntax errors, | 315 | utility has historically been extremely forgiving of syntax errors, | |
316 | for example, the | 316 | for example, the | |
317 | .Fl c | 317 | .Fl c | |
318 | and | 318 | and | |
319 | .Fl s | 319 | .Fl s | |
320 | options were ignored unless two strings were specified. | 320 | options were ignored unless two strings were specified. | |
321 | This implementation will not permit illegal syntax. | 321 | This implementation will not permit illegal syntax. | |
322 | .Sh STANDARDS | 322 | .Sh STANDARDS | |
323 | The | 323 | The | |
324 | .Nm | 324 | .Nm | |
325 | utility is expected to be | 325 | utility is expected to be | |
326 | .St -p1003.2 | 326 | .St -p1003.2 | |
327 | compatible. | 327 | compatible. | |
328 | It should be noted that the feature wherein the last character of | 328 | It should be noted that the feature wherein the last character of | |
329 | .Ar string2 | 329 | .Ar string2 | |
330 | is duplicated if | 330 | is duplicated if | |
331 | .Ar string2 | 331 | .Ar string2 | |
332 | has less characters than | 332 | has less characters than | |
333 | .Ar string1 | 333 | .Ar string1 | |
334 | is permitted by POSIX but is not required. | 334 | is permitted by POSIX but is not required. | |
335 | Shell scripts attempting to be portable to other POSIX systems should use | 335 | Shell scripts attempting to be portable to other POSIX systems should use | |
336 | the | 336 | the | |
337 | .Dq [#*] | 337 | .Dq [#*] | |
338 | convention instead of relying on this behavior. | 338 | convention instead of relying on this behavior. | |
339 | .Sh BUGS | 339 | .Sh BUGS | |
340 | .Nm | 340 | .Nm | |
341 | was originally designed to work with | 341 | was originally designed to work with | |
342 | .Tn US-ASCII . | 342 | .Tn US-ASCII . | |
343 | Its use with character sets that do not share all the properties of | 343 | Its use with character sets that do not share all the properties of | |
344 | .Tn US-ASCII , | 344 | .Tn US-ASCII , | |
345 | e.g., a symmetric set of upper and lower case characters | 345 | e.g., a symmetric set of upper and lower case characters | |
346 | that can be algorithmically converted one to the other, | 346 | that can be algorithmically converted one to the other, | |
347 | may yield unpredictable results. | 347 | may yield unpredictable results. | |
348 | .Pp | 348 | .Pp | |
349 | .Nm | 349 | .Nm | |
350 | should be internationalized. | 350 | should be internationalized. |