summaryrefslogtreecommitdiff
path: root/autoopts/tpl/optcode.tlib
diff options
context:
space:
mode:
Diffstat (limited to 'autoopts/tpl/optcode.tlib')
-rw-r--r--autoopts/tpl/optcode.tlib819
1 files changed, 819 insertions, 0 deletions
diff --git a/autoopts/tpl/optcode.tlib b/autoopts/tpl/optcode.tlib
new file mode 100644
index 0000000..9f519ae
--- /dev/null
+++ b/autoopts/tpl/optcode.tlib
@@ -0,0 +1,819 @@
+[= autogen5 template
+
+# Time-stamp: "2012-08-11 08:31:28 bkorb"
+#
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=][=
+
+;;;
+;;; Compute the usage line. It is complex because we are trying to
+;;; encode as much information as we can and still be comprehensible.
+;;;
+;;; The rules are: If any options have a "value" attribute, then
+;;; there are flags allowed, so include "-<flag>" on the usage line.
+;;; If the program has the "long-opts" attribute set, then we must
+;;; have "<option-name>" or "--<name>" on the line, depending on
+;;; whether or not there are flag options. If any options take
+;;; arguments, then append "[<val>]" to the flag description and
+;;; "[{=| }<val>]" to the option-name/name descriptions. We will not
+;;; worry about being correct if every option has a required argument.
+;;; Finally, if there are no minimum occurrence counts (i.e. all
+;;; options are optional), then we put square brackets around the
+;;; syntax.
+;;;
+;;; Compute the option arguments
+;;;
+(define tmp-val "")
+(if (exist? "flag.arg-type")
+ (set! tmp-val "[{=| }<val>]"))
+
+(define usage-line (string-append "USAGE: %s "
+
+ ;; If at least one option has a minimum occurrence count
+ ;; we use curly brackets around the option syntax.
+ ;;
+ (if (not (exist? "flag.min")) "[ " "{ ")
+
+ (if (exist? "flag.value")
+ (string-append "-<flag>"
+ (if (exist? "flag.arg-type") " [<val>]" "")
+ (if (exist? "long-opts") " | " "") )
+ (if (not (exist? "long-opts"))
+ (string-append "<option-name>" tmp-val) "" ) )
+
+ (if (exist? "long-opts")
+ (string-append "--<name>" tmp-val) "" )
+
+ (if (not (exist? "flag.min")) " ]..." " }...")
+) )
+
+(if (exist? "argument")
+ (set! usage-line (string-append usage-line
+
+ ;; the USAGE line plus the program name plus the argument goes
+ ;; past 80 columns, then break the line, else separate with space
+ ;;
+ (if (< 80 (+ (string-length usage-line)
+ (len "argument")
+ (string-length prog-name) ))
+ " \\\n\t\t"
+ " "
+ )
+
+ (get "argument")
+ ))
+)
+
+(define usage-text (string-append prog-name
+ (if (exist? "package")
+ (string-append " (" (get "package") ")")
+ "" )
+ " - " (get "prog-title")
+ (if (exist? "version")
+ (string-append " - Ver. " (get "version"))
+ "" )
+ "\n" usage-line "\n"
+))
+
+=][= # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+INCLUDE "optmain.tlib"
+
+=][=
+
+IF (or (= "shell-process" (get "main.main-type"))
+ (= "shell-parser" (get "main.main-type"))
+ (exist? "main.code")) =]
+#define [= (set! make-test-main #t) main-guard =] 1[=
+ENDIF
+=]
+#ifndef __doxygen__
+#define OPTION_CODE_COMPILE 1
+#include "[= (define lib-externs "") header-file=]"[=
+
+IF (== (get "main.main-type" "") "for-each")
+
+=]
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>[=
+
+ELSE
+
+=]
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>[=
+
+ (if (exist? "flag.arg-range")
+ (emit "\n#include <errno.h>"))
+
+ (if (and (exist? "resettable") (exist? "flag.open-file"))
+ (emit "
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>" )) =][=
+
+ENDIF
+
+=]
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern FILE * option_usage_fp;
+
+/* TRANSLATORS: choose the translation for option names wisely because you
+ cannot ever change your mind. */[=
+
+IF (not (exist? "copyright"))
+
+=]
+#define zCopyright NULL
+#define zLicenseDescrip NULL[=
+ELSE =][=
+ (define cright-owner (get "copyright.owner" (get "copyright.author")))
+ =][=
+ CASE (get "copyright.type") =][=
+ = note =][=
+ (set! tmp-text (get "copyright.text"))
+ (define ext-text tmp-text) =][=
+
+ ~~* . =][=
+ (define ext-text
+ (license-description (get "copyright.type")
+ prog-name "" cright-owner ) )
+
+ (set! tmp-text
+ (license-info (get "copyright.type")
+ prog-name "" cright-owner (get "copyright.date") ) )
+ =][=
+
+ * =][=
+ (set! tmp-text (sprintf
+ "Copyright (C) %s %s, all rights reserved"
+ (get "copyright.date") cright-owner ))
+ (define ext-text tmp-text) =][=
+
+ ESAC =][=
+
+(set! tmp-text (string-append version-text "\n" tmp-text))
+(string-append "\n#define zCopyright ("
+ (string-table-add-ref opt-strs tmp-text)
+ ")\n#define zLicenseDescrip ("
+
+ (if (= tmp-text ext-text)
+ "zCopyright"
+ (begin
+ (set! ext-text (string-append (shell (string-append
+ "${CLexe} --fill -I0 -W75 <<_EOF_\n" ext-text "\n_EOF_" )) "\n" ))
+
+ (string-table-add-ref opt-strs ext-text)
+ ) )
+ ")\n" ) =][=
+
+ENDIF "copyright" =][=
+
+ (define usage-proc (get "usage"))
+ (if (< 1 (string-length usage-proc))
+ (emit (string-append "\nextern tUsageProc " usage-proc ";"))
+ (set! usage-proc "optionUsage")
+ )
+
+=]
+[= INVOKE join-or-expand join-type = "include" =]
+#ifndef NULL
+# define NULL 0
+#endif
+
+/*
+ * [= prog-name =] option static const strings
+ */[=
+ (out-resume "home-list") \=][=
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+FOR flag "\n" =][=
+ (define flag-index (for-index)) =][=
+ INVOKE emit-opt-strs =][=
+
+ (if (exist? "lib-name") (begin
+ (set! lib-opt-ptr (string->c-name! (string-append
+ (get "lib-name") "_" (get "name") "_optDesc_p")))
+ (set! lib-externs (string-append lib-externs
+ (sprintf "tOptDesc * const %-16s = optDesc + %d;\n"
+ lib-opt-ptr (for-index) ) ))
+ ) ) =][=
+
+ENDFOR flag =][=
+
+INVOKE help-strs =][=
+INVOKE decl-callbacks =][=
+
+IF (exist? "version") =][=
+
+ IF (exist? "version-proc") =]
+#define VER_PROC [= (get "version-proc") =][=
+ ELIF (. make-test-main) =]
+#ifdef [=(. main-guard) =]
+# define VER_PROC optionVersionStderr
+#else
+# define VER_PROC optionPrintVersion
+#endif /* [=(. main-guard)=] */[=
+ ELSE =]
+#define VER_PROC optionPrintVersion[=
+ ENDIF make-test-main =][=
+
+ENDIF there is a version
+
+=]
+[= INVOKE emit-option-desc-table =]
+[= (. lib-externs) =]
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Define the [= (. prog-name) =] Option Environment
+ */
+#define zPROGNAME ([= (string-table-add-ref opt-strs pname-up) =])
+#define zUsageTitle ([=
+ (define homerc-ct 0)
+ (define homerc-txt "")
+ (string-table-add-ref opt-strs usage-text) =])
+[=
+FOR homerc =][=
+ (set! tmp-text (get "homerc"))
+ (if (> (string-length tmp-text)) (begin
+ (set! homerc-ct (+ 1 homerc-ct))
+ (set! homerc-txt (string-append homerc-txt
+ "\n " (string-table-add-ref opt-strs tmp-text) "," ))
+ ) ) =][=
+ENDFOR homerc =][=
+IF (> homerc-ct 0) \=]
+#define zRcName ([=
+ (set! tmp-text (if (exist? "rcfile") (get "rcfile")
+ (string-append "." pname-down "rc") ))
+ (string-table-add-ref opt-strs tmp-text) =])
+static char const * const apzHomeList[=
+ (sprintf "[%u] = {%s\n NULL };" (+ 1 homerc-ct) homerc-txt) =][=
+
+ELSE \=]
+#define zRcName NULL
+#define apzHomeList NULL[=
+ENDIF =]
+#define zBugsAddr ([=
+(out-push-new) \=]
+s/@[a-z]*{\([^{@}]*\)}/``\1''/g
+s=@<prog-name>@=[= prog-name =]=g
+/^@\(end *\)*example/d
+s/^@item *$/\
+/[=
+
+(define patch-text-sed
+ (sprintf "sed %s <<\\_EODetail_ | ${CLexe} --fill -I0 -W75\n"
+ (raw-shell-str (out-pop #t)) ) )
+
+(define patch-text (lambda (t-name)
+ (set! tmp-text (string-append "\n"
+
+ (shell (string-append
+ patch-text-sed
+ (get t-name)
+ "\n_EODetail_" ))
+ "\n" )) ))
+
+(if (exist? "copyright.eaddr")
+ (string-table-add-ref opt-strs (get "copyright.eaddr"))
+ (if (exist? "eaddr")
+ (string-table-add-ref opt-strs (get "eaddr"))
+ "NULL"
+) ) =])
+#define zExplain ([=
+
+(if (or (exist? "explain") (== (get "main.main-type") "for-each"))
+ (begin
+ (if (exist? "explain")
+ (patch-text "explain")
+ (set! tmp-text "") )
+
+ (if (== (get "main.main-type") "for-each")
+ (set! tmp-text (string-append tmp-text
+"\nIf no arguments are provided, input arguments are read from stdin,
+one per line; blank and '#'-prefixed lines are comments.
+'stdin' may not be a terminal (tty).\n" )) )
+
+ (string-table-add-ref opt-strs tmp-text)
+ )
+ "NULL"
+) =])
+#define zDetail ([=
+
+(if (exist? "detail")
+ (begin
+ (patch-text "detail")
+ (string-table-add-ref opt-strs tmp-text)
+ )
+ "NULL"
+) =])
+#define zFullVersion ([=
+
+(if (exist? "version")
+ (string-table-add-ref opt-strs version-text)
+ "NULL") =])[=
+(tpl-file-line extract-fmt)
+=][=
+
+ IF (. omit-nls-code) =]
+#define OPTPROC_BASE OPTPROC_NONE
+#define translate_option_strings NULL
+[= ELSE =]
+#if defined(ENABLE_NLS)
+# define OPTPROC_BASE OPTPROC_TRANSLATE[=
+CASE no-xlate =][=
+!E =][=
+= opt-cfg =] | OPTPROC_NXLAT_OPT_CFG[=
+= opt =] | OPTPROC_NXLAT_OPT[=
+* =][= (error "invalid value for 'no-xlate'") =][=
+ESAC no-xlate =]
+ static tOptionXlateProc translate_option_strings;
+#else
+# define OPTPROC_BASE OPTPROC_NONE
+# define translate_option_strings NULL
+#endif /* ENABLE_NLS */
+[= ENDIF no-nls =][=
+ IF (exist? "resettable") =]
+static optArgBucket_t const original_[=(. pname-down)=]_defaults[ [=
+(. UP-prefix) =]OPTION_CT ] = {
+[= (shell (string-append
+ "sed '$s@},@} @' <<\\_EOF_" default-text "\n_EOF_\n")) =]
+};
+static void * const original_[=(. pname-down)=]_cookies[ [=
+(. UP-prefix) =]OPTION_CT ] = {
+[=
+ (shell (string-append "${CLexe} -I4 -S, <<\\_EOF_\n" default-cookie "_EOF_"))
+=]
+};
+[= ENDIF resettable=]
+[= INVOKE usage-text usage-type = full \=]
+[= INVOKE usage-text usage-type = short =]
+#endif /* not defined __doxygen__ */
+[= INVOKE emit-option-callbacks =]
+/**
+ * The directory containing the data associated with [= prog-name =].
+ */
+#ifndef PKGDATADIR
+# define PKGDATADIR ""
+#endif
+
+/**
+ * Information about the person or institution that packaged [= prog-name =]
+ * for the current distribution.
+ */
+#ifndef WITH_PACKAGER
+# define [=(. pname)=]_packager_info NULL
+#else
+static char const [=(. pname)=]_packager_info[] =
+ "Packaged by " WITH_PACKAGER
+
+# ifdef WITH_PACKAGER_VERSION
+ " ("WITH_PACKAGER_VERSION")"
+# endif
+
+# ifdef WITH_PACKAGER_BUG_REPORTS
+ "\nReport [=(. pname)=] bugs to " WITH_PACKAGER_BUG_REPORTS
+# endif
+ "\n";
+#endif
+#ifndef __doxygen__
+[=
+ (out-suspend "home-list") =][=
+ (emit-string-table opt-strs) =][=
+ (out-resume "home-list") =][=
+ (out-pop #t)
+=]
+#endif /* __doxygen__ */
+/**
+ * The option definitions for [= prog-name =]. The one structure that
+ * binds them all.
+ */
+tOptions [=(. pname)=]Options = {
+ OPTIONS_STRUCT_VERSION,
+ 0, NULL, /* original argc + argv */
+ ( OPTPROC_BASE[= IF (not (exist? "allow-errors")) =]
+ + OPTPROC_ERRSTOP[= ENDIF=][=IF (exist? "flag.value") =]
+ + OPTPROC_SHORTOPT[= ENDIF=][=IF (exist? "long-opts") =]
+ + OPTPROC_LONGOPT[= ENDIF=][=IF (not (exist? "flag.min")) =]
+ + OPTPROC_NO_REQ_OPT[= ENDIF=][=IF (exist? "flag.disable") =]
+ + OPTPROC_NEGATIONS[= ENDIF=][=IF (>= number-opt-index 0) =]
+ + OPTPROC_NUM_OPT[= ENDIF=][=IF (exist? "environrc") =]
+ + OPTPROC_ENVIRON[= ENDIF=][=IF (not (exist? "argument")) =]
+ + OPTPROC_NO_ARGS[= ELIF (not (==* (get "argument") "[" )) =]
+ + OPTPROC_ARGS_REQ[= ENDIF=][=IF (exist? "reorder-args") =]
+ + OPTPROC_REORDER[= ENDIF=][=IF (exist? "gnu-usage") =]
+ + OPTPROC_GNUUSAGE[= ENDIF=][=IF (exist? "no-misuse-usage") =]
+ + OPTPROC_MISUSE[= ENDIF=][=IF (exist? "vendor-opt") =]
+ + OPTPROC_VENDOR_OPT[= ENDIF=] ),
+ 0, NULL, /* current option index, current option */
+ NULL, NULL, zPROGNAME,
+ zRcName, zCopyright, zLicenseDescrip,
+ zFullVersion, apzHomeList, zUsageTitle,
+ zExplain, zDetail, optDesc,
+ zBugsAddr, /* address to send bugs to */
+ NULL, NULL, /* extensions/saved state */
+ [= (. usage-proc) =], /* usage procedure */
+ translate_option_strings, /* translation procedure */
+ /*
+ * Indexes to special options
+ */
+ { [= (if (exist? "no-libopts") "NO_EQUIVALENT"
+ (string-append INDEX-pfx "MORE_HELP"))
+ =], /* more-help option index */
+ [=IF (and (exist? "homerc") (not (exist? "disable-save")))
+ =][= (. INDEX-pfx) =]SAVE_OPTS[=
+ ELSE =]NO_EQUIVALENT[=
+ ENDIF=], /* save option index */
+ [= (if (>= number-opt-index 0) number-opt-index "NO_EQUIVALENT")
+ =], /* '-#' option index */
+ [= (if (>= default-opt-index 0) default-opt-index "NO_EQUIVALENT")
+ =] /* index of default opt */
+ },
+ [= (. option-ct) =] /* full option count */, [=
+ (count "flag")=] /* user option count */,
+ [= (. pname) =]_full_usage, [= (. pname) =]_short_usage,
+[= IF (exist? "resettable") \=]
+ original_[=(. pname-down)=]_defaults, original_[=(. pname-down)=]_cookies,
+[= ELSE \=]
+ NULL, NULL,
+[= ENDIF \=]
+ PKGDATADIR, [=(. pname)=]_packager_info
+};
+[=
+
+FOR lib-name
+
+=]
+tOptDesc* [= (string->c-name! (get "lib-name")) =]_optDesc_p = NULL;[=
+
+ENDFOR =][=
+
+INVOKE emit-nls-code
+
+=]
+#ifdef __cplusplus
+}
+#endif[= #
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-nls-code
+
+=][= IF (. omit-nls-code) =][= RETURN =][= ENDIF
+
+=]
+#if ENABLE_NLS
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <autoopts/usage-txt.h>
+
+static char* AO_gettext(char const* pz);
+static void coerce_it(void** s);
+
+/**
+ * AutoGen specific wrapper function for gettext.
+ * It relies on the macro _() to convert from English to the target
+ * language, then strdup-duplicates the result string.
+ *
+ * @param[in] pz the input text used as a lookup key.
+ * @returns the translated text (if there is one),
+ * or the original text (if not).
+ */
+static char *
+AO_gettext(char const* pz)
+{
+ char* pzRes;
+ if (pz == NULL)
+ return NULL;
+ pzRes = _(pz);
+ if (pzRes == pz)
+ return pzRes;
+ pzRes = strdup(pzRes);
+ if (pzRes == NULL) {
+ fputs(_("No memory for duping translated strings\n"), stderr);
+ exit([=(. nomem-exit-code)=]);
+ }
+ return pzRes;
+}
+
+static void coerce_it(void** s) { *s = AO_gettext(*s);
+}
+
+/**
+ * Translate all the translatable strings in the [=(. pname)=]Options
+ * structure defined above. This is done only once.
+ */
+static void
+translate_option_strings(void)
+{
+ tOptions * const pOpt = &[=(. pname)=]Options;
+
+ /*
+ * Guard against re-translation. It won't work. The strings will have
+ * been changed by the first pass through this code. One shot only.
+ */
+ if (option_usage_text.field_ct != 0) {
+ /*
+ * Do the translations. The first pointer follows the field count
+ * field. The field count field is the size of a pointer.
+ */
+ tOptDesc * pOD = pOpt->pOptDesc;
+ char ** ppz = (char**)(void*)&(option_usage_text);
+ int ix = option_usage_text.field_ct;
+
+ do {
+ ppz++;
+ *ppz = AO_gettext(*ppz);
+ } while (--ix > 0);
+[=
+ FOR field IN pzCopyright pzCopyNotice pzFullVersion pzUsageTitle pzExplain
+ pzDetail pzPackager =]
+ coerce_it((void*)&(pOpt->[= field =]));[=
+ ENDFOR =][=
+
+ IF (exist? "full-usage") =]
+ coerce_it((void*)&(pOpt->pzFullUsage));[=
+ ENDIF =][=
+
+ IF (exist? "short-usage") =]
+ coerce_it((void*)&(pOpt->pzShortUsage));[=
+ ENDIF =]
+ option_usage_text.field_ct = 0;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
+ coerce_it((void*)&(pOD->pzText));
+ }
+
+ if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
+ tOptDesc * pOD = pOpt->pOptDesc;
+ int ix;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {[=
+
+ FOR field IN pz_Name pz_DisableName pz_DisablePfx =][=
+
+ (sprintf "\n coerce_it((void*)&(pOD->%1$s));"
+ (get "field")) =][=
+
+ ENDFOR =]
+ }
+ /* prevent re-translation */
+ [= (. pname)
+ =]Options.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
+ }
+}
+
+#endif /* ENABLE_NLS */
+[=
+
+ENDDEF emit-nls-code
+
+=][=
+
+DEFINE emit-option-desc-table
+
+=]
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Define the [= prog-name =] Option Descriptions.
+ * This is an array of [=(. UP-prefix)=]OPTION_CT entries, one for each
+ * option that the [= prog-name =] program responds to.
+ */
+static tOptDesc optDesc[[=
+(define default-text "")
+(define default-cookie "")
+UP-prefix
+=]OPTION_CT] = {[=
+
+FOR flag "\n" =][=
+ (define flag-index (for-index)) =][=
+
+ INVOKE emit-opt-desc =][=
+
+ENDFOR flag
+
+=][=
+
+IF (exist? "resettable")
+
+=]
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* resettable */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]RESET_OPTION, [= (. VALUE-pfx) =]RESET_OPTION,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]RESET_OPTION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ RESET_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionResetOpt,
+ /* desc, NAME, name */ RESET_DESC, NULL, RESET_name,
+ /* disablement strs */ NULL, NULL },[=
+
+ENDIF
+
+=][=
+
+IF (exist? "version") =]
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* version */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]VERSION, [= (. VALUE-pfx) =]VERSION,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]VERSION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ VER_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ VER_PROC,
+ /* desc, NAME, name */ VER_DESC, NULL, VER_name,
+ /* disablement strs */ NULL, NULL },
+
+[=
+
+ENDIF =]
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* help */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]HELP, [= (. VALUE-pfx) =]HELP,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
+ /* disablement strs */ NULL, NULL }[=
+
+IF (not (exist? "no-libopts")) =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* more-help */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]MORE_HELP, [= (. VALUE-pfx) =]MORE_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]MORE_HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ MORE_HELP_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionPagedUsage,
+ /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
+ /* disablement strs */ NULL, NULL }[=
+
+ENDIF not have no-libopts =][=
+
+IF (exist? "usage-opt") =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* usage-opt */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]USAGE, [= (. VALUE-pfx) =]USAGE,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]USAGE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ USAGE_DESC, NULL, USAGE_name,
+ /* disablement strs */ NULL, NULL }[=
+
+ENDIF have usage-opt =][=
+
+IF (exist? "homerc") =][=
+ IF (not (exist? "disable-save")) =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* save-opts */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]SAVE_OPTS, [=
+ (if (not (exist? "disable-save"))
+ (string-append VALUE-pfx "SAVE_OPTS")
+ "0") =],
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]SAVE_OPTS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
+ /* disablement strs */ NULL, NULL }[=
+
+ ENDIF disable-save does not exist =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* load-opts */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]LOAD_OPTS, [=
+ (if (not (exist? "disable-load"))
+ (string-append VALUE-pfx "LOAD_OPTS")
+ "0") =],
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]LOAD_OPTS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_DISABLE_IMM[=
+ (if (exist? "disable-load") "| OPTST_NO_COMMAND") =], 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionLoadOpt,
+ /* desc, NAME, name */ [=
+ (if (exist? "disable-load") "NULL, NULL, NULL"
+ "LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name")=],
+ /* disablement strs */ [=
+ (if (exist? "disable-load") "NULL, NULL"
+ "NO_LOAD_OPTS_name, LOAD_OPTS_pfx")=] }[=
+
+ENDIF have homerc =][=
+
+IF (exist? "vendor-opt") =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* vendor-opt */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]VENDOR_OPT, [= (. VALUE-pfx) =]VENDOR_OPT,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]VENDOR_OPT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_IMM | OPTST_TWICE, 0, /* both directions */
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionVendorOption,
+ /* desc, NAME, name */ VEND_DESC, NULL, VEND_name,
+ /* disablement strs */ NULL, NULL }[=
+
+ENDIF have vendor-opt =]
+};
+[=
+
+ENDDEF emit-option-desc-table
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * opthead.tpl ends here */ \=]