8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / msgfmt / gnu_msgfmt.c
blob79c41c1780153a938ac41f0428dc4eedb7a4b5ad
1 /*
2 * CDDL HEADER START
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
7 * with the License.
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]
20 * CDDL HEADER END
23 * Copyright (c) 2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include "gnu_msgfmt.h"
31 static char *cmd;
32 int fuzzy_flag = 0;
33 int verbose_flag = 0;
34 int strict_flag = 0;
35 int po_error = 0;
36 char *inputdir = NULL;
37 char *outfile = NULL;
38 char **po_names;
40 static void
41 usage(void)
43 (void) fprintf(stderr,
44 gettext(ERR_USAGE), cmd);
45 exit(1);
48 int
49 main(int argc, char **argv)
51 int i, ret;
52 static struct flags flag;
54 (void) setlocale(LC_ALL, "");
55 #if !defined(TEXT_DOMAIN)
56 #define TEXT_DOMAIN "SYS_TEST"
57 #endif
58 (void) textdomain(TEXT_DOMAIN);
60 if (cmd = strrchr(argv[0], '/'))
61 ++cmd;
62 else
63 cmd = argv[0];
65 ret = parse_option(&argc, &argv, &flag);
66 if (ret == -1) {
67 usage();
68 /* NOTREACHED */
70 if (flag.idir) {
71 inputdir = flag.idir;
73 if (flag.ofile) {
74 outfile = flag.ofile;
75 catalog_init(outfile);
77 if (flag.fuzzy) {
78 fuzzy_flag = 1;
80 if (flag.sun_p) {
81 error(gettext(ERR_SUN_ON_GNU), cmd);
82 /* NOTREACHED */
84 if (flag.verbose) {
85 verbose_flag = 1;
87 if (flag.strict) {
88 strict_flag = 1;
91 po_names = (char **)Xmalloc(argc * sizeof (char *));
92 while (argc-- > 0) {
93 if (verbose_flag) {
94 diag(gettext(DIAG_START_PROC), *argv);
96 po_init(*argv);
97 (void) yyparse();
98 po_fini();
99 argv++;
101 for (i = 0; i < cur_po_index; i++) {
102 free(po_names[i]);
104 free(po_names);
105 if (po_error) {
106 /* error found */
107 error(gettext(ERR_ERROR_FOUND), po_error);
108 /* NOTREACHED */
110 output_all_gnu_mo_files();
112 return (0);