[= autogen5 template ## This file is part of AutoOpts, a companion to AutoGen. ## AutoOpts is free software. ## AutoOpts is Copyright (C) 1992-2015 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 sha256 sums: ## ## 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 ## 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 ## 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 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 "-" on the usage line. ;;; If the program has the "long-opts" attribute set, then we must ;;; have "" or "--" on the line, depending on ;;; whether or not there are flag options. If any options take ;;; arguments, then append "[]" to the flag description and ;;; "[{=| }]" 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 "[{=| }]")) (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 "-" (if (exist? "flag.arg-type") " []" "") (if (exist? "long-opts") " | " "") ) (if (not (exist? "long-opts")) (string-append "" tmp-val) "" ) ) (if (exist? "long-opts") (string-append "--" 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 (and (exist? "version") (not (exist? "gnu-usage"))) (string-append " - Ver. " (get "version")) "" ) "\n" usage-line "\n" )) =][= # // # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][= INCLUDE "optmain.tlib" =] #ifndef __doxygen__ #define OPTION_CODE_COMPILE 1 #include "[= (define lib-externs "") header-file=]"[= IF (== (get "main.main-type" "") "for-each") =] #include #include #include #include #include #include #include #include #include #include [= ELSE =] #include #include #include #include [= (if (exist? "flag.arg-range") (emit "\n#include ")) (if (and (exist? "resettable") (exist? "flag.open-file")) (emit " #include #include #include " )) =][= ENDIF =] #ifdef __cplusplus extern "C" { #endif extern FILE * option_usage_fp;[= IF (not (exist? "copyright")) =] #define zCopyright NULL #define zLicenseDescrip NULL[= ELSE =][= CASE (define cright-owner (get "copyright.owner" (get "copyright.author"))) (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)) (if (not omit-nls-code) (put-xget "pzCopyright" 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" )) (if (not omit-nls-code) (put-xget "pzCopyNotice" ext-text)) (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 /** * static const strings for [= prog-name =] options */[= (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 (. guarded-test-main) =] #ifdef [=(. main-guard) =] # define VER_PROC optionVersionStderr #else # define VER_PROC optionPrintVersion #endif /* [=(. main-guard)=] */[= ELSE =] #define VER_PROC optionPrintVersion[= ENDIF guarded-test-main =][= ENDIF there is a version =] [= INVOKE emit-option-desc-table =] [= (. lib-externs) =] /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** Reference to the upper cased version of [= prog-name =]. */ #define zPROGNAME ([= (string-table-add-ref opt-strs pname-up) =]) /** Reference to the title line for [= prog-name =] usage. */ #define zUsageTitle ([= (define homerc-ct 0) (define homerc-txt "") (if (not omit-nls-code) (put-xget "pzUsageTitle" usage-text)) (string-table-add-ref opt-strs usage-text) =]) [= FOR homerc =][= (set! tmp-text (get "homerc")) (if (> (string-length tmp-text) 0) (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) \=] /** [= prog-name =] configuration file name. */ #define zRcName ([= (set! tmp-text (get "rcfile" (string-append "." pname-down "rc") )) (string-table-add-ref opt-strs tmp-text) =]) /** Directories to search for [= prog-name =] config files. */ static char const * const apzHomeList[= (sprintf "[%u] = {%s\n NULL };" (+ 1 homerc-ct) homerc-txt) =][= ELSE \=] /** There is no [= prog-name =] configuration file. */ #define zRcName NULL /** There are no directories to search for [= prog-name =] config files. */ #define apzHomeList NULL[= ENDIF =] /** The [= prog-name =] program bug email address. */ #define zBugsAddr ([= (out-push-new) \=] s/@[a-z]*{\([^{@}]*\)}/'\1'/g s=@@=[= 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 (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" ) ) =]) /** Clarification/explanation of what [= prog-name =] does. */ #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 '" (if (exist? "main.comment-char") (get "main.comment-char") "#") "'-prefixed lines are comments.\n" (if (exist? "main.interleaved") "Options may appear in the input interspersed with the 'normal' input.\n" "") "'stdin' may not be a terminal (tty).\n" )) ) (if (not omit-nls-code) (put-xget "pzExplain" tmp-text)) (string-table-add-ref opt-strs tmp-text) ) "NULL" ) =]) /** Extra detail explaining what [= prog-name =] does. */ #define zDetail ([= (if (exist? "detail") (begin (patch-text "detail") (if (not omit-nls-code) (put-xget "pzDetail" tmp-text)) (string-table-add-ref opt-strs tmp-text) ) "NULL" ) =]) /** The full version string for [= prog-name =]. */ #define zFullVersion ([= (if (exist? "version") (begin (if (not omit-nls-code) (put-xget "pzFullVersion" version-text)) (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") =] #ifndef optArgBucket_t #define opt_arg_union_t optArgBucket_t #endif /** Compiled-in initial values for [= prog-name =] options. */ static opt_arg_union_t const original_[=(. pname-down)=]_defaults[ [= (. UP-prefix) =]OPTION_CT ] = { [= (shell (string-append "sed '$s@},@} @' <<\\_EOF_" default-text "\n_EOF_\n")) =] }; /** Compiled-in initial values for [= prog-name =] option cookies. */ 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 emit-help-text help-type = full \=] [= INVOKE emit-help-text help-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 /** Packager information for [= prog-name =]. */ 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") (define put-shell-main (== (get "main.main-type") "shell-process")) (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[= (define tmp-val "\n + OPTPROC_") (if (not (exist? "allow-errors")) (emit tmp-val "ERRSTOP")) (if (exist? "flag.value") (emit tmp-val "SHORTOPT")) (if (exist? "long-opts") (emit tmp-val "LONGOPT")) (if (not (exist? "flag.min")) (emit tmp-val "NO_REQ_OPT")) (if (exist? "flag.disable") (emit tmp-val "NEGATIONS")) (if (>= number-opt-index 0) (emit tmp-val "NUM_OPT")) (if (exist? "environrc") (emit tmp-val "ENVIRON")) (if (not (exist? "argument")) (emit tmp-val "NO_ARGS") (if (not (==* (get "argument") "[")) (emit tmp-val "ARGS_REQ"))) (if (exist? "reorder-args") (emit tmp-val "REORDER")) (if (exist? "gnu-usage") (emit tmp-val "GNUUSAGE")) (if (exist? "no-misuse-usage") (emit tmp-val "MISUSE")) (if (exist? "vendor-opt") (emit tmp-val "VENDOR_OPT")) (if put-shell-main (emit tmp-val "SHELL_OUTPUT")) =] ), 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 =][= IF (not omit-nls-code) =][= INVOKE emit-nls-code =][= ENDIF =] #ifdef __cplusplus } #endif[= # // # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][= DEFINE emit-nls-code =] #if ENABLE_NLS /** * This code is designed to translate translatable option text for the * [= prog-name =] program. These translations happen upon entry * to optionProcess(). */ #include #include #include #include #ifdef HAVE_DCGETTEXT # include #endif #include 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. It tries the "libopts" domain first, then whatever has been * set via the \a textdomain(3) call. * * @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 * res; if (pz == NULL) return NULL; #ifdef HAVE_DCGETTEXT /* * While processing the option_xlateable_txt data, try to use the * "libopts" domain. Once we switch to the option descriptor data, * do *not* use that domain. */ if (option_xlateable_txt.field_ct != 0) { res = dgettext("libopts", pz); if (res == pz) res = (char *)VOIDP(_(pz)); } else res = (char *)VOIDP(_(pz)); #else res = (char *)VOIDP(_(pz)); #endif if (res == pz) return res; res = strdup(res); if (res == NULL) { fputs(_("No memory for duping translated strings\n"), stderr); exit([=(. nomem-exit-code)=]); } return res; } /** * All the pointers we use are marked "* const", but they are stored in * writable memory. Coerce the mutability and set the pointer. */ 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 opts = &[=(. 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_xlateable_txt.field_ct != 0) { /* * Do the translations. The first pointer follows the field count * field. The field count field is the size of a pointer. */ char ** ppz = (char**)VOIDP(&(option_xlateable_txt)); int ix = option_xlateable_txt.field_ct; do { ppz++; /* skip over field_ct */ *ppz = AO_gettext(*ppz); } while (--ix > 0); /* prevent re-translation and disable "libopts" domain lookup */ option_xlateable_txt.field_ct = 0; [= FOR field IN pzCopyright pzCopyNotice pzFullVersion =] coerce_it(VOIDP(&(opts->[= field =])));[= ENDFOR =][= IF (not (exist? "full-usage"))=][= FOR field IN pzUsageTitle pzExplain pzDetail =] coerce_it(VOIDP(&(opts->[= field =])));[= ENDFOR =] { tOptDesc * od = opts->pOptDesc; for (ix = opts->optCt; ix > 0; ix--, od++) coerce_it(VOIDP(&(od->pzText))); }[= ENDIF =] } } #endif /* ENABLE_NLS */ #ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT /** I18N function strictly for xgettext. Do not compile. */ static void bogus_function(void) { /* TRANSLATORS: The following dummy function was crated solely so that xgettext can extract the correct strings. These strings are actually referenced by a field name in the [=(. pname)=]Options structure noted in the comments below. The literal text is defined in [=(. pname)=]_opt_strs. NOTE: the strings below are segmented with respect to the source string [=(. pname)=]_opt_strs. The strings above are handed off for translation at run time a paragraph at a time. Consequently, they are presented here for translation a paragraph at a time. ALSO: often the description for an option will reference another option by name. These are set off with apostrophe quotes (I hope). Do not translate option names. */[= (out-resume "xget") (emit (out-pop #t)) (out-push-new) \=] incdir=[= (if (defined? 'inc-dir) inc-dir "") ;;' 4emacs =] test -d "$incdir" || incdir=`dirname [=(tpl-file #t)=]`/.. incdir=`cd $incdir/autoopts >/dev/null 2>&1 && pwd` test -f ${incdir}/usage-txt.h && { sedcmd='/LIBOPTS-MESSAGES:/,/END-[= (if (and (exist? "full-usage") (exist? "short-usage")) "LIBOPTS-MESSAGES" "USAGE-TEXT" ) =]/p' sed -n "$sedcmd" ${incdir}/usage-txt.h } [= (shell (out-pop #t)) =] } #endif /* uncompilable code */[= 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, AOUSE_RESET_OPTION, /* 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, AOUSE_VERSION, /* 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, AOUSE_HELP, /* 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, AOUSE_MORE_HELP, /* 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, AOUSE_USAGE, /* 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, AOUSE_SAVE_OPTS, /* 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") =], AOUSE_LOAD_OPTS, /* 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, AOUSE_VENDOR_OPT, /* 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 */ \=]