4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2001 by Sun Microsystems, Inc.
24 * All rights reserved.
30 #pragma ident "%Z%%M% %I% %E% SMI"
37 #include <sys/types.h>
38 #include <sys/param.h>
47 #include "../../lib/libc/inc/msgfmt.h"
54 #define DOMAIN_TOKEN L"domain" /* domain token in po file */
56 #define MSGID_TOKEN L"msgid" /* msg id token in po file */
58 #define MSGSTR_TOKEN L"msgstr" /* target str token in po file */
62 #define MAX_VALUE_LEN 3 /* size of msg id and target str */
65 #define MAX_VALUE_LEN 512 /* size of msg id and target str */
70 * check if the next character is possible valid character.
72 #define CK_NXT_CH(a, l) \
73 ((a[(l) - 1] == L' ') || (a[(l) - 1] == L'\t') || \
74 (a[(l) - 1] == L'\n') || (a[(l) - 1] == L'\0'))
77 char *msgid
; /* msg id string */
78 char *msgstr
; /* msg target string */
79 int msgid_offset
; /* msg id offset in mo file */
80 int msgstr_offset
; /* msg target string offset in mo file */
81 struct msg_chain
*next
; /* next node */
84 struct domain_struct
{
85 char *domain
; /* domain name */
86 struct msg_chain
*first_elem
; /* head of msg link list */
87 struct msg_chain
*current_elem
; /* most recently used msg */
88 struct domain_struct
*next
; /* next domain node */
91 #define ERR_EXEC_FAILED \
92 "failed to execute %s.\n"
95 "Usage: msgfmt [-D dir | --directory=dir] [-f | --use-fuzzy]\n" \
96 " [-g] [-o outfile | --output-file=outfile]\n" \
97 " [-s] [--strict] [-v] [--verbose] files ...\n"
99 #define ERR_GNU_ON_SUN \
100 "-g and -s are mutually exclusive.\n"
102 #define ERR_STAT_FAILED \
103 "stat failed for %s.\n"
105 #define ERR_MMAP_FAILED \
106 "mmap failed for %s.\n"
108 #define ERR_MUNMAP_FAILED \
109 "munmap failed for %s.\n"
112 "Error, No space after directive at line number %d.\n"
114 #define ERR_EXITING \
117 #define WARN_NO_MSGSTR \
118 "Consecutive MSGID tokens " \
119 "encountered at line number: %d, ignored.\n"
121 #define WARN_NO_MSGID \
122 "Consecutive MSGSTR tokens " \
123 "encountered at line number: %d, ignored.\n"
125 #define WARN_SYNTAX_ERR \
126 "Syntax at line number: %d, " \
129 #define WARN_MISSING_QUOTE \
130 "Syntax at line number: %d, " \
131 "Missing \", ignored\n"
133 #define WARN_MISSING_QUOTE_AT_EOL \
134 "Syntax at line number: %d, " \
135 "Missing \" at EOL, ignored\n"
137 #define WARN_INVALID_STRING \
138 "the string after closing \" " \
139 "is ignored at line number %d.\n"
141 #define WARN_DUP_MSG \
142 "Duplicate id \"%s\" at line number: " \
145 #define DIAG_GNU_FOUND \
146 "GNU PO file found.\n"
148 #define DIAG_INVOKING_GNU \
149 "Generating the MO file in the GNU MO format.\n"
155 #endif /* _SUN_MSGFMT_H */