4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 * eftinfo.c -- main routine for eftinfo command
28 * argument processing and the general flow through all the other
29 * modules is driven by this file.
32 #pragma ident "%Z%%M% %I% %E% SMI"
54 /* stuff exported by yacc-generated parsers */
55 extern void yyparse(void);
59 * This external definition has to be here. If we put it in literals.h
60 * lint complains about the declaration not being used within the block
61 * when compiling literals.c.
63 extern void literals_init(void);
65 static const char *Usage
= "[-DEPghpqvw] eft-files...";
66 static const char *Help
=
67 "\t-D Print dictionaries EFT references.\n"
68 "\t-E Print ereports EFT will consume.\n"
69 "\t-P Print problems EFT can diagnose.\n"
70 "\t-g Print generated iterators (use with -p)\n"
71 "\t-h Print this help message\n"
72 "\t-p Print complete propagation tree\n"
73 "\t-q Quiet mode, no header info printed\n"
74 "\t-v Enable verbose output\n"
75 "\t-w Enable language warnings";
77 * and some undocumented extras...
78 * "\t-S Print stats for compiler memory usage, etc.\n"
79 * "\t-Y Enable parser debug output\n"
80 * "\t-d Enable general debug output\n"
81 * "\t-y Enable lexer debug output\n"
89 extern int Pchildgen
; /* flag to ptree for printing generated interators */
91 extern struct lut
*Dicts
;
95 dictprint(const char *s
, void *rhs
, void *arg
)
97 static char *sep
= "";
99 out(O_OK
|O_NONL
, "%s%s", sep
, s
);
104 main(int argc
, char *argv
[])
118 stats_init(1); /* extended stats always enabled for eftinfo */
124 while ((c
= getopt(argc
, argv
, "DEPSYdghpqvwy")) != EOF
) {
160 out(O_PROG
, "version %d.%d",
161 VERSION_MAJOR
, VERSION_MINOR
);
162 out(O_DIE
|O_USAGE
, "%s\n%s", Usage
, Help
);
182 out(O_DIE
|O_USAGE
, Usage
);
187 out(O_PROG
|O_VERB
, "version %d.%d",
188 VERSION_MAJOR
, VERSION_MINOR
);
192 out(O_DIE
|O_USAGE
, Usage
);
195 eftread_showheader(1);
197 lex_init(&argv
[optind
], NULL
, yflag
);
204 if (count
= out_errcount())
205 out(O_DIE
, "%d error%s encountered, exiting.", OUTS(count
));
208 out(O_OK
|O_NONL
, "Dictionaries: ");
209 lut_walk(Dicts
, (lut_cb
)dictprint
, NULL
);
214 ptree_ereport(O_OK
, NULL
);
217 ptree_fault(O_OK
, NULL
);
218 ptree_upset(O_OK
, NULL
);
219 ptree_defect(O_OK
, NULL
);
223 ptree_name_iter(O_OK
, tree_root(NULL
));