42#define OPTION_CODE_COMPILE 1
43#include "mkernel-opt.h"
59#define zCopyright (mkernel_opt_strs+0)
60#define zLicenseDescrip (mkernel_opt_strs+266)
70static char const mkernel_opt_strs[1624] =
72 "Copyright (C) 2017 Francois Cerbelle, all rights reserved.\n"
73 "This is free software. It is licensed for use, modification and\n"
74 "redistribution under the terms of the GNU Lesser General Public License,\n"
75 "version 3 or later <http://gnu.org/licenses/lgpl.html>\n\0"
76 "mkernel is free software: you can redistribute it and/or modify it under\n"
77 "the terms of the GNU Lesser General Public License as published by the Free\n"
78 "Software Foundation, either version 3 of the License, or (at your option)\n"
79 "any later version.\n\n"
80 "mkernel is distributed in the hope that it will be useful, but WITHOUT ANY\n"
81 "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n"
82 "FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for\n"
84 "You should have received a copy of the GNU Lesser General Public License\n"
85 "along with this program. If not, see <http://www.gnu.org/licenses/>.\";\n\0"
86 "path to load modules from\0"
89 "display extended usage information and exit\0"
91 "extended usage information passed thru pager\0"
93 "output version information and exit\0"
95 "save the option state to a config file\0"
97 "load options from a config file\0"
102 "mkernel - Generic micro-kernel application\n"
103 "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <module>\n\0"
106 "francois@cerbelle.net\0"
107 "additional information given whenever the usage routine is invoked.\n\0"
108 "This string is added to the usage output when the HELP option is selected.\n"
109 "The contents of the file 'mkernel.details' is added to the usage output\n"
110 "when the MORE-HELP option is selected.\n\0"
117#define MODULE_PATH_DESC (mkernel_opt_strs+892)
119#define MODULE_PATH_NAME (mkernel_opt_strs+918)
121#define MODULE_PATH_name (mkernel_opt_strs+930)
123#define MODULE_PATH_FLAGS (OPTST_DISABLED \
124 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
129#define HELP_DESC (mkernel_opt_strs+942)
130#define HELP_name (mkernel_opt_strs+986)
131#ifdef HAVE_WORKING_FORK
132#define MORE_HELP_DESC (mkernel_opt_strs+991)
133#define MORE_HELP_name (mkernel_opt_strs+1036)
134#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
136#define MORE_HELP_DESC HELP_DESC
137#define MORE_HELP_name HELP_name
138#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
140#ifdef NO_OPTIONAL_OPT_ARGS
141# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
143# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
144 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
146#define VER_DESC (mkernel_opt_strs+1046)
147#define VER_name (mkernel_opt_strs+1082)
148#define SAVE_OPTS_DESC (mkernel_opt_strs+1090)
149#define SAVE_OPTS_name (mkernel_opt_strs+1129)
150#define LOAD_OPTS_DESC (mkernel_opt_strs+1139)
151#define LOAD_OPTS_NAME (mkernel_opt_strs+1171)
152#define NO_LOAD_OPTS_name (mkernel_opt_strs+1181)
153#define LOAD_OPTS_pfx (mkernel_opt_strs+1194)
154#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
165#define VER_PROC optionPrintVersion
173static tOptDesc optDesc[OPTION_CT] = {
174 { 0, VALUE_OPT_MODULE_PATH,
175 0, VALUE_OPT_MODULE_PATH,
186 { INDEX_OPT_VERSION, VALUE_OPT_VERSION,
187 NO_EQUIVALENT, VALUE_OPT_VERSION,
200 { INDEX_OPT_HELP, VALUE_OPT_HELP,
201 NO_EQUIVALENT, VALUE_OPT_HELP,
204 OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP,
212 { INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
213 NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
224 { INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
225 NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS,
228 OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
229 | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS,
237 { INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
238 NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS,
241 OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
242 | OPTST_DISABLE_IMM, AOUSE_LOAD_OPTS,
254#define zPROGNAME (mkernel_opt_strs+1197)
256#define zUsageTitle (mkernel_opt_strs+1205)
258#define zRcName (mkernel_opt_strs+1321)
260static char const *
const apzHomeList[2] = {
261 mkernel_opt_strs+1315,
264#define zBugsAddr (mkernel_opt_strs+1332)
266#define zExplain (mkernel_opt_strs+1354)
268#define zDetail (mkernel_opt_strs+1423)
270#define zFullVersion (mkernel_opt_strs+1610)
273#if defined(ENABLE_NLS)
274# define OPTPROC_BASE OPTPROC_TRANSLATE
277# define OPTPROC_BASE OPTPROC_NONE
278# define translate_option_strings NULL
281#define mkernel_full_usage (NULL)
282#define mkernel_short_usage (NULL)
297doUsageOpt(tOptions * opts, tOptDesc * od)
300 ex_code = MKERNEL_EXIT_SUCCESS;
303 exit(MKERNEL_EXIT_FAILURE);
313# define PKGDATADIR ""
321# define mkernel_packager_info NULL
325 "Packaged by " WITH_PACKAGER
327# ifdef WITH_PACKAGER_VERSION
328 " ("WITH_PACKAGER_VERSION
")"
331# ifdef WITH_PACKAGER_BUG_REPORTS
332 "\nReport mkernel bugs to " WITH_PACKAGER_BUG_REPORTS
344 OPTIONS_STRUCT_VERSION,
353 + OPTPROC_GNUUSAGE ),
366 { INDEX_OPT_MORE_HELP,
390#include <autoopts/usage-txt.h>
392static char * AO_gettext(
char const * pz);
393static void coerce_it(
void ** s);
406AO_gettext(
char const * pz)
417 if (option_xlateable_txt.field_ct != 0) {
420 res = (
char *)VOIDP(
_(pz));
422 res = (
char *)VOIDP(
_(pz));
424 res = (
char *)VOIDP(
_(pz));
430 fputs(
_(
"No memory for duping translated strings\n"), stderr);
431 exit(MKERNEL_EXIT_FAILURE);
440static void coerce_it(
void ** s) { *s = AO_gettext(*s);
456 if (option_xlateable_txt.field_ct != 0) {
461 char ** ppz = (
char**)VOIDP(&(option_xlateable_txt));
462 int ix = option_xlateable_txt.field_ct;
466 *ppz = AO_gettext(*ppz);
469 option_xlateable_txt.field_ct = 0;
471 coerce_it(VOIDP(&(opts->pzCopyright)));
472 coerce_it(VOIDP(&(opts->pzCopyNotice)));
473 coerce_it(VOIDP(&(opts->pzFullVersion)));
474 coerce_it(VOIDP(&(opts->pzUsageTitle)));
475 coerce_it(VOIDP(&(opts->pzExplain)));
476 coerce_it(VOIDP(&(opts->pzDetail)));
478 tOptDesc * od = opts->pOptDesc;
479 for (ix = opts->optCt; ix > 0; ix--, od++)
480 coerce_it(VOIDP(&(od->pzText)));
486#ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT
488static void bogus_function(
void) {
506 puts(
_(
"mkernel 0.0.2\n\
507Copyright (C) 2017 Francois Cerbelle, all rights reserved.\n\
508This is free software. It is licensed for use, modification and\n\
509redistribution under the terms of the GNU Lesser General Public License,\n\
510version 3 or later <http://gnu.org/licenses/lgpl.html>\n"));
513 puts(
_(
"mkernel is free software: you can redistribute it and/or modify it under\n\
514the terms of the GNU Lesser General Public License as published by the Free\n\
515Software Foundation, either version 3 of the License, or (at your option)\n\
516any later version.\n\n"));
517 puts(
_(
"mkernel is distributed in the hope that it will be useful, but WITHOUT ANY\n\
518WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n\
519FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for\n\
521 puts(
_(
"You should have received a copy of the GNU Lesser General Public License\n\
522along with this program. If not, see <http://www.gnu.org/licenses/>.\";\n"));
525 puts(
_(
"path to load modules from"));
528 puts(
_(
"display extended usage information and exit"));
531 puts(
_(
"extended usage information passed thru pager"));
534 puts(
_(
"output version information and exit"));
537 puts(
_(
"save the option state to a config file"));
540 puts(
_(
"load options from a config file"));
543 puts(
_(
"mkernel - Generic micro-kernel application\n\
544Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <module>\n"));
547 puts(
_(
"additional information given whenever the usage routine is invoked.\n"));
550 puts(
_(
"This string is added to the usage output when the HELP option is selected.\n\
551The contents of the file 'mkernel.details' is added to the usage output\n\
552when the MORE-HELP option is selected.\n"));
555 puts(
_(
"mkernel 0.0.2"));
558 puts(
_(
"<<<NOT-FOUND>>>"));
561 puts(
_(
"<<<NOT-FOUND>>>"));
563#line 67 "../autoopts.c"
564 puts(
_(
"allocation of %d bytes failed\n"));
565#line 89 "../autoopts.c"
566 puts(
_(
"allocation of %d bytes failed\n"));
568 puts(
_(
"AutoOpts function called without option descriptor\n"));
570 puts(
_(
"\tThis exceeds the compiled library version: "));
572 puts(
_(
"Automated Options Processing Error!\n"
573 "\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
574#line 78 "../autoopts.c"
575 puts(
_(
"realloc of %d bytes at 0x%p failed\n"));
577 puts(
_(
"\tThis is less than the minimum library version: "));
578#line 121 "../version.c"
579 puts(
_(
"Automated Options version %s\n"
580 "\tCopyright (C) 1999-2017 by Bruce Korb - all rights reserved\n"));
581#line 49 "../makeshell.c"
582 puts(
_(
"(AutoOpts bug): %s.\n"));
584 puts(
_(
"optionResetOpt() called, but reset-option not configured"));
585#line 241 "../usage.c"
586 puts(
_(
"could not locate the 'help' option"));
587#line 330 "../autoopts.c"
588 puts(
_(
"optionProcess() was called with invalid data"));
589#line 697 "../usage.c"
590 puts(
_(
"invalid argument type specified"));
592 puts(
_(
"defaulted to option with optional arg"));
594 puts(
_(
"aliasing option is out of range."));
596 puts(
_(
"%s error: the keyword '%s' is ambiguous for %s\n"));
598 puts(
_(
" The following options match:\n"));
600 puts(
_(
"%s: ambiguous option name: %s (matches %d options)\n"));
601#line 161 "../check.c"
602 puts(
_(
"%s: Command line arguments required\n"));
604 puts(
_(
"%d %s%s options allowed\n"));
605#line 56 "../makeshell.c"
606 puts(
_(
"%s error %d (%s) calling %s for '%s'\n"));
607#line 268 "../makeshell.c"
608 puts(
_(
"interprocess pipe"));
609#line 171 "../version.c"
610 puts(
_(
"error: version option argument '%c' invalid. Use:\n"
611 "\t'v' - version only\n"
612 "\t'c' - version and copyright\n"
613 "\t'n' - version and full copyright notice\n"));
615 puts(
_(
"%s error: the '%s' and '%s' options conflict\n"));
617 puts(
_(
"%s: The '%s' option has been disabled."));
619 puts(
_(
"%s: The '%s' option has been disabled."));
621 puts(
_(
"-equivalence"));
623 puts(
_(
"%s: illegal option -- %c\n"));
624#line 110 "../reset.c"
625 puts(
_(
"%s: illegal option -- %c\n"));
627 puts(
_(
"%s: illegal option -- %s\n"));
629 puts(
_(
"%s: illegal option -- %s\n"));
630#line 118 "../reset.c"
631 puts(
_(
"%s: illegal option -- %s\n"));
633 puts(
_(
"%s: unknown vendor extension option -- %s\n"));
635 puts(
_(
" or an integer from %d through %d\n"));
637 puts(
_(
" or an integer from %d through %d\n"));
638#line 696 "../usage.c"
639 puts(
_(
"%s error: invalid option descriptor for %s\n"));
640#line 1030 "../usage.c"
641 puts(
_(
"%s error: invalid option descriptor for %s\n"));
643 puts(
_(
"%s: invalid option name: %s\n"));
645 puts(
_(
"%s: The '%s' option requires an argument.\n"));
646#line 150 "../autoopts.c"
647 puts(
_(
"(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n"
648 "\t'%s' and '%s'."));
650 puts(
_(
"%s error: The %s option is required\n"));
652 puts(
_(
"%s: The '%s' option cannot have an argument.\n"));
653#line 151 "../check.c"
654 puts(
_(
"%s: Command line arguments are not allowed.\n"));
656 puts(
_(
"error %d (%s) creating %s\n"));
658 puts(
_(
"%s error: '%s' does not match any %s keywords.\n"));
660 puts(
_(
"%s error: The '%s' option requires an argument.\n"));
662 puts(
_(
"error %d (%s) stat-ing %s\n"));
664 puts(
_(
"error %d (%s) stat-ing %s\n"));
665#line 143 "../restore.c"
666 puts(
_(
"%s error: no saved option state\n"));
667#line 225 "../autoopts.c"
668 puts(
_(
"'%s' is not a command line option.\n"));
670 puts(
_(
"%s error: '%s' is not a recognizable date/time.\n"));
672 puts(
_(
"%s error: '%s' is not a recognizable time duration.\n"));
674 puts(
_(
"%s error: The %s option must appear %d times.\n"));
675#line 165 "../numeric.c"
676 puts(
_(
"%s error: '%s' is not a recognizable number.\n"));
678 puts(
_(
"%s error: %s exceeds %s keyword count\n"));
679#line 279 "../usage.c"
680 puts(
_(
"Try '%s %s' for more information.\n"));
682 puts(
_(
"one %s%s option allowed\n"));
683#line 170 "../makeshell.c"
684 puts(
_(
"standard output"));
685#line 905 "../makeshell.c"
686 puts(
_(
"standard output"));
687#line 223 "../usage.c"
688 puts(
_(
"standard output"));
689#line 364 "../usage.c"
690 puts(
_(
"standard output"));
691#line 574 "../usage.c"
692 puts(
_(
"standard output"));
693#line 178 "../version.c"
694 puts(
_(
"standard output"));
695#line 223 "../usage.c"
696 puts(
_(
"standard error"));
697#line 364 "../usage.c"
698 puts(
_(
"standard error"));
699#line 574 "../usage.c"
700 puts(
_(
"standard error"));
701#line 178 "../version.c"
702 puts(
_(
"standard error"));
703#line 170 "../makeshell.c"
705#line 905 "../makeshell.c"
707#line 222 "../usage.c"
709#line 363 "../usage.c"
711#line 573 "../usage.c"
713#line 177 "../version.c"
715#line 60 "../numeric.c"
716 puts(
_(
"%s error: %s option value %ld is out of range.\n"));
718 puts(
_(
"%s error: %s option requires the %s option\n"));
720 puts(
_(
"%s warning: cannot save options - %s not regular file\n"));
722 puts(
_(
"%s warning: cannot save options - %s not regular file\n"));
724 puts(
_(
"%s warning: cannot save options - %s not regular file\n"));
726 puts(
_(
"%s warning: cannot save options - %s not regular file\n"));
730#line 822 "../usage.c"
731 puts(
_(
"\t\t\t\t- an alternate for '%s'\n"));
732#line 1097 "../usage.c"
733 puts(
_(
"Version, usage and configuration options:"));
734#line 873 "../usage.c"
735 puts(
_(
"\t\t\t\t- default option for unnamed options\n"));
736#line 786 "../usage.c"
737 puts(
_(
"\t\t\t\t- disabled as '--%s'\n"));
738#line 1066 "../usage.c"
739 puts(
_(
" --- %-14s %s\n"));
740#line 1064 "../usage.c"
741 puts(
_(
"This option has been disabled"));
742#line 813 "../usage.c"
743 puts(
_(
"\t\t\t\t- enabled by default\n"));
745 puts(
_(
"%s error: only "));
746#line 1143 "../usage.c"
747 puts(
_(
" - examining environment variables named %s_*\n"));
749 puts(
_(
"\t\t\t\t- file must not pre-exist\n"));
751 puts(
_(
"\t\t\t\t- file must pre-exist\n"));
752#line 329 "../usage.c"
753 puts(
_(
"Options are specified by doubled hyphens and their name or by a single\n"
754 "hyphen and the flag character.\n"));
755#line 882 "../makeshell.c"
757 "= = = = = = = =\n\n"
758 "This incarnation of genshell will produce\n"
759 "a shell script to parse the options for %s:\n\n"));
761 puts(
_(
" or an integer mask with any of the lower %d bits set\n"));
762#line 846 "../usage.c"
763 puts(
_(
"\t\t\t\t- is a set membership option\n"));
764#line 867 "../usage.c"
765 puts(
_(
"\t\t\t\t- must appear between %d and %d times\n"));
766#line 331 "../usage.c"
767 puts(
_(
"Options are specified by single or double hyphens and their name.\n"));
768#line 853 "../usage.c"
769 puts(
_(
"\t\t\t\t- may appear multiple times\n"));
770#line 840 "../usage.c"
771 puts(
_(
"\t\t\t\t- may not be preset\n"));
772#line 1258 "../usage.c"
773 puts(
_(
" Arg Option-Name Description\n"));
774#line 1194 "../usage.c"
775 puts(
_(
" Flg Arg Option-Name Description\n"));
776#line 1252 "../usage.c"
777 puts(
_(
" Flg Arg Option-Name Description\n"));
778#line 1253 "../usage.c"
780#line 1259 "../usage.c"
782#line 336 "../usage.c"
783 puts(
_(
"The '-#<number>' option may omit the hash char\n"));
784#line 332 "../usage.c"
785 puts(
_(
"All arguments are named options.\n"));
786#line 920 "../usage.c"
787 puts(
_(
" - reading file %s"));
788#line 358 "../usage.c"
790 "Please send bug reports to: <%s>\n"));
791#line 100 "../version.c"
793 "Please send bug reports to: <%s>\n"));
794#line 129 "../version.c"
796 "Please send bug reports to: <%s>\n"));
797#line 852 "../usage.c"
798 puts(
_(
"\t\t\t\t- may NOT appear - preset only\n"));
799#line 893 "../usage.c"
801 "The following option preset mechanisms are supported:\n"));
802#line 1141 "../usage.c"
804 "The following option preset mechanisms are supported:\n"));
805#line 631 "../usage.c"
806 puts(
_(
"prohibits these options:\n"));
807#line 626 "../usage.c"
808 puts(
_(
"prohibits the option '%s'\n"));
809#line 81 "../numeric.c"
810 puts(
_(
"%s%ld to %ld"));
811#line 79 "../numeric.c"
812 puts(
_(
"%sgreater than or equal to %ld"));
813#line 75 "../numeric.c"
814 puts(
_(
"%s%ld exactly"));
815#line 68 "../numeric.c"
816 puts(
_(
"%sit must lie in one of the ranges:\n"));
817#line 68 "../numeric.c"
818 puts(
_(
"%sit must be in the range:\n"));
819#line 88 "../numeric.c"
821#line 66 "../numeric.c"
822 puts(
_(
"%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
823#line 77 "../numeric.c"
824 puts(
_(
"%sless than or equal to %ld"));
825#line 339 "../usage.c"
826 puts(
_(
"Operands and options may be intermixed. They will be reordered.\n"));
827#line 601 "../usage.c"
828 puts(
_(
"requires the option '%s'\n"));
829#line 604 "../usage.c"
830 puts(
_(
"requires these options:\n"));
831#line 1270 "../usage.c"
832 puts(
_(
" Arg Option-Name Req? Description\n"));
833#line 1264 "../usage.c"
834 puts(
_(
" Flg Arg Option-Name Req? Description\n"));
836 puts(
_(
"or you may use a numeric representation. Preceding these with a '!'\n"
837 "will clear the bits, specifying 'none' will clear all bits, and 'all'\n"
838 "will set them all. Multiple entries may be passed as an option\n"
839 "argument list.\n"));
840#line 859 "../usage.c"
841 puts(
_(
"\t\t\t\t- may appear up to %d times\n"));
843 puts(
_(
"The valid \"%s\" option keywords are:\n"));
844#line 1101 "../usage.c"
845 puts(
_(
"The next option supports vendor supported extra options:"));
846#line 722 "../usage.c"
847 puts(
_(
"These additional options are:"));
#define dgettext(Domainname, Msgid)
#define strdup(chaine)
Same syntaxt and same behavior than regular strdup function, with memory leaks tracking.
tOptProc optionBooleanVal
Declare option callback procedures.
#define MODULE_PATH_DESC
module-path option description:
#define zDetail
Extra detail explaining what mkernel does.
tOptProc optionPrintVersion
#define zPROGNAME
Reference to the upper cased version of mkernel.
#define mkernel_short_usage
#define mkernel_packager_info
Information about the person or institution that packaged mkernel for the current distribution.
#define zUsageTitle
Reference to the title line for mkernel usage.
tOptProc optionNumericVal
#define mkernel_full_usage
tOptions mkernelOptions
The option definitions for mkernel.
#define PKGDATADIR
The directory containing the data associated with mkernel.
#define zRcName
mkernel configuration file name.
tOptProc optionUnstackArg
tOptProc optionVendorOption
#define MODULE_PATH_NAME
Upper-cased name for the module-path option.
#define zBugsAddr
The mkernel program bug email address.
#define translate_option_strings
tOptProc optionPagedUsage
#define zFullVersion
The full version string for mkernel.
#define NO_LOAD_OPTS_name
#define MODULE_PATH_name
Name string for the module-path option.
#define MODULE_PATH_FLAGS
Compiled in flag settings for the module-path option.
#define zExplain
Clarification/explanation of what mkernel does.
#define _(String)
GetText helper.