2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 //%% (c) Copyright 1993, 1994 Hewlett-Packard Company
24 //%% (c) Copyright 1993, 1994 International Business Machines Corp.
25 //%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
26 //%% (c) Copyright 1993, 1994 Novell, Inc.
27 //%% $TOG: options.C /main/4 1998/03/20 14:26:44 mgreess $
32 * Common option handling routines
34 * Copyright (c) 1990 by Sun Microsystems, Inc.
39 #include "util/copyright.h"
40 #if defined(__linux__) || defined(sgi) || defined(CSRG_BASED)
45 #include "util/tt_iostream.h"
46 #include "util/tt_gettext.h"
51 _dbdirectories = new _Tt_string_list;
53 _sel_filename = (char *) 0;
55 _sel_objid_key = (_Tt_db_key *) 0;
57 _sel_type = (char *) 0;
63 _repair_netisam_p = 0;
65 _repair_type = (char *) 0;
71 set_opts(int argc, char **argv)
74 char *opts = optstring();
76 while (-1 != (c = getopt(argc,(char **)argv,opts))) {
77 if (!set_option(c, optarg)) {
82 _dbdirectories = new _Tt_string_list;
83 for (; optind<argc; ++optind) {
84 _Tt_string s(argv[optind]);
85 _dbdirectories->append(s);
92 set_common_option(int optchar, const char *optval)
96 case 'h': // treat h as illegal, forces Usage: msg
99 _TT_PRINT_VERSIONS(progname)
102 _debug_level = atoi(optval);
106 _sel_filename = optval;
110 _sel_objid_key = new _Tt_db_key(_Tt_string(optval));
132 _repair_netisam_p = 1;
136 _repair_type = optval;
139 _repair_delete_p = 1;
150 fprintf(f,"%s <\n",type_string());
151 fprintf(f,"\nDirectories:\n");
152 dbdirectories()->print(_tt_string_print,f);
155 if (_sel_filename_p) {
156 fprintf(f,catgets(_ttcatd, 6, 7, "Select by filename: %s\n"),
157 (char *)_sel_filename);
160 fprintf(f, "%s", catgets(_ttcatd, 6, 8, "Select by objid key:"));
161 _sel_objid_key->print(f);
165 fprintf(f,catgets(_ttcatd, 6, 9, "Select by type: %s\n"),
168 if (_diag_badform_p) {
169 fprintf(f, "%s", catgets(_ttcatd, 6, 10,
170 "Diagnose badly formed entities\n"));
173 fprintf(f, "%s", catgets(_ttcatd, 6, 11, "Diagnose references to "
174 "non-existent entities\n"));
177 fprintf(f, "%s", catgets(_ttcatd, 6, 12, "Display ids\n"));
180 fprintf(f, "%s", catgets(_ttcatd, 6, 13, "Display mandatory data\n"));
183 fprintf(f, "%s", catgets(_ttcatd, 6, 14,
184 "Display properties and values data\n"));
186 if (_repair_netisam_p) {
187 fprintf(f, "%s", catgets(_ttcatd, 6, 15,
188 "Invoke NetISAM isrepair() function before "
191 if (_repair_type_p) {
192 fprintf(f,catgets(_ttcatd, 6, 16,
193 "Repair by setting to type: %s\n"),
194 (char *)_repair_type);
196 if (_repair_delete_p) {
197 fprintf(f, "%s", catgets(_ttcatd, 6, 17, "Repair by deleting\n"));
199 fprintf(f,catgets(_ttcatd, 6, 18, "Debugging printout level %d\n"),