3
3
* DO NOT EDIT THIS FILE (genshell.c)
5
* It has been AutoGen-ed Saturday May 5, 2007 at 12:02:35 PM PDT
5
* It has been AutoGen-ed November 8, 2009 at 08:41:09 AM by AutoGen 5.9.10pre13
6
6
* From the definitions genshell.def
7
7
* and the template file options
9
* Generated from AutoOpts 29:0:4 templates.
9
* Generated from AutoOpts @AO_CURRENT@:@AO_REVISION@:@AO_AGE@ templates.
21
21
* This source file is copyrighted and licensed under the following terms:
23
* genshellopt copyright 1999-2007 Bruce Korb - all rights reserved
23
* genshellopt copyright (c) 1999-2009 Bruce Korb - all rights reserved
25
* genshellopt is free software; you can redistribute it and/or
26
* modify it under the terms of the GNU Lesser General Public
27
* License as published by the Free Software Foundation; either
28
* version 2.1 of the License, or (at your option) any later version.
30
* genshellopt is distributed in the hope that it will be useful,
31
* but WITHOUT ANY WARRANTY; without even the implied warranty of
32
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33
* Lesser General Public License for more details.
35
* You should have received a copy of the GNU Lesser General Public
36
* License along with genshellopt. If not, write to:
37
* The Free Software Foundation, Inc.,
38
* 51 Franklin Street, Fifth Floor
39
* Boston, MA 02110-1301, USA.
25
* genshellopt is free software: you can redistribute it and/or modify it
26
* under the terms of the GNU General Public License as published by the
27
* Free Software Foundation, either version 3 of the License, or
28
* (at your option) any later version.
30
* genshellopt is distributed in the hope that it will be useful, but
31
* WITHOUT ANY WARRANTY; without even the implied warranty of
32
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
33
* See the GNU General Public License for more details.
35
* You should have received a copy of the GNU General Public License along
36
* with this program. If not, see <http://www.gnu.org/licenses/>.
39
#include <sys/types.h>
43
40
#include <limits.h>
45
44
#define OPTION_CODE_COMPILE 1
46
45
#include "genshell.h"
51
/* TRANSLATORS: choose the translation for option names wisely because you
52
cannot ever change your mind. */
51
53
tSCC zCopyright[] =
52
"genshellopt copyright (c) 1999-2007 Bruce Korb, all rights reserved";
53
tSCC zCopyrightNotice[] =
54
"genshellopt is free software; you can redistribute it and/or\n\
55
modify it under the terms of the GNU Lesser General Public\n\
56
License as published by the Free Software Foundation; either\n\
57
version 2.1 of the License, or (at your option) any later version.\n\n\
58
genshellopt is distributed in the hope that it will be useful,\n\
59
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
60
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\
61
Lesser General Public License for more details.\n\n\
62
You should have received a copy of the GNU Lesser General Public\n\
63
License along with genshellopt. If not, write to:\n\
64
\tThe Free Software Foundation, Inc.,\n\
65
\t51 Franklin Street, Fifth Floor\n\
66
\tBoston, MA 02110-1301, USA.";
54
"genshellopt copyright (c) 1999-2009 Bruce Korb, all rights reserved";
55
tSCC zCopyrightNotice[610] =
56
"genshellopt is free software: you can redistribute it and/or modify it under\n\
57
the terms of the GNU General Public License as published by the Free Software\n\
58
Foundation, either version 3 of the License, or (at your option) any later\n\
60
genshellopt is distributed in the hope that it will be useful, but WITHOUT ANY\n\
61
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n\
62
PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n\
63
You should have received a copy of the GNU General Public License along with\n\
64
this program. If not, see <http://www.gnu.org/licenses/>.";
67
66
extern tUsageProc genshelloptUsage;
101
101
* Help/More_Help/Version option descriptions:
103
tSCC zHelpText[] = "Display usage information and exit";
104
tSCC zHelp_Name[] = "help";
106
tSCC zMore_HelpText[] = "Extended usage information passed thru pager";
107
tSCC zMore_Help_Name[] = "more-help";
109
tSCC zVersionText[] = "Output version information and exit";
110
tSCC zVersion_Name[] = "version";
103
tSCC zHelpText[] = "Display extended usage information and exit";
104
tSCC zHelp_Name[] = "help";
105
#ifdef HAVE_WORKING_FORK
106
#define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
107
tSCC zMore_Help_Name[] = "more-help";
108
tSCC zMore_HelpText[] = "Extended usage information passed thru pager";
110
#define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
111
#define zMore_Help_Name NULL
112
#define zMore_HelpText NULL
114
#ifdef NO_OPTIONAL_OPT_ARGS
115
# define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT
117
# define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
118
OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
121
tSCC zVersionText[] = "Output version information and exit";
122
tSCC zVersion_Name[] = "version";
112
124
* Declare option callback procedures
145
157
/* desc, NAME, name */ zShellText, zShell_NAME, zShell_Name,
146
158
/* disablement strs */ zNotShell_Name, zNotShell_Pfx },
148
#ifdef NO_OPTIONAL_OPT_ARGS
149
# define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT
151
# define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
152
OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
155
160
{ /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
156
161
/* equiv idx value */ NO_EQUIVALENT, 0,
157
162
/* equivalenced to */ NO_EQUIVALENT,
158
163
/* min, max, act ct */ 0, 1, 0,
159
/* opt state flags */ VERSION_OPT_FLAGS, 0,
164
/* opt state flags */ OPTST_VERSION_FLAGS, 0,
160
165
/* last opt argumnt */ { NULL },
161
166
/* arg list/cookie */ NULL,
162
167
/* must/cannot opts */ NULL, NULL,
164
169
/* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
165
170
/* disablement strs */ NULL, NULL },
167
#undef VERSION_OPT_FLAGS
170
174
{ /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
183
187
/* equiv idx value */ NO_EQUIVALENT, 0,
184
188
/* equivalenced to */ NO_EQUIVALENT,
185
189
/* min, max, act ct */ 0, 1, 0,
186
/* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
190
/* opt state flags */ OPTST_MORE_HELP_FLAGS, 0,
187
191
/* last opt argumnt */ { NULL },
188
192
/* arg list/cookie */ NULL,
189
193
/* must/cannot opts */ NULL, NULL,
213
217
text, the second line of the file through the ending tag will be replaced\n\
214
218
by the newly generated text. The first `#!' line will be regenerated.\n";
215
219
tSCC zFullVersion[] = GENSHELLOPT_FULL_VERSION;
216
/* extracted from optcode.tpl near line 408 */
220
/* extracted from optcode.tpl near line 495 */
218
222
#if defined(ENABLE_NLS)
219
223
# define OPTPROC_BASE OPTPROC_TRANSLATE
223
227
# define translate_option_strings NULL
224
228
#endif /* ENABLE_NLS */
231
#define genshellopt_full_usage NULL
232
#define genshellopt_short_usage NULL
226
233
tOptions genshelloptOptions = {
227
234
OPTIONS_STRUCT_VERSION,
228
235
0, NULL, /* original argc + argv */
246
253
* Indexes to special options
248
{ INDEX_OPT_MORE_HELP,
249
0 /* no option state saving */,
250
NO_EQUIVALENT /* index of '-#' option */,
255
{ INDEX_OPT_MORE_HELP, /* more-help option index */
256
NO_EQUIVALENT, /* save option index */
257
NO_EQUIVALENT, /* '-#' option index */
251
258
NO_EQUIVALENT /* index of default opt */
253
5 /* full option count */, 2 /* user option count */
260
5 /* full option count */, 2 /* user option count */,
261
genshellopt_full_usage, genshellopt_short_usage,
306
316
* Guard against re-translation. It won't work. The strings will have
307
317
* been changed by the first pass through this code. One shot only.
309
if (option_usage_text.field_ct == 0)
312
* Do the translations. The first pointer follows the field count field.
313
* The field count field is the size of a pointer.
316
char** ppz = (char**)(void*)&(option_usage_text);
317
int ix = option_usage_text.field_ct;
319
if (option_usage_text.field_ct != 0) {
322
* Do the translations. The first pointer follows the field count
323
* field. The field count field is the size of a pointer.
325
tOptDesc* pOD = genshelloptOptions.pOptDesc;
326
char** ppz = (char**)(void*)&(option_usage_text);
327
int ix = option_usage_text.field_ct;
321
331
*ppz = AO_gettext(*ppz);
322
332
} while (--ix > 0);
334
COERSION(pzCopyright);
335
COERSION(pzCopyNotice);
336
COERSION(pzFullVersion);
337
COERSION(pzUsageTitle);
340
option_usage_text.field_ct = 0;
342
for (ix = genshelloptOptions.optCt; ix > 0; ix--, pOD++)
343
coerce_it((void*)&(pOD->pzText));
324
option_usage_text.field_ct = 0;
346
if ((genshelloptOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
327
347
tOptDesc* pOD = genshelloptOptions.pOptDesc;
328
int ix = genshelloptOptions.optCt;
331
pOD->pzText = AO_gettext(pOD->pzText);
332
pOD->pz_NAME = AO_gettext(pOD->pz_NAME);
333
pOD->pz_Name = AO_gettext(pOD->pz_Name);
334
pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName);
335
pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx);
350
for (ix = genshelloptOptions.optCt; ix > 0; ix--, pOD++) {
351
coerce_it((void*)&(pOD->pz_Name));
352
coerce_it((void*)&(pOD->pz_DisableName));
353
coerce_it((void*)&(pOD->pz_DisablePfx));
355
/* prevent re-translation */
356
genshelloptOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
341
COERSION(pzCopyright);
342
COERSION(pzCopyNotice);
343
COERSION(pzFullVersion);
344
COERSION(pzUsageTitle);
349
360
#endif /* ENABLE_NLS */