Blame autoopts/tpl/optcode.tlib

Packit Service 96b5d3
[= autogen5 template
Packit Service 96b5d3
Packit Service 96b5d3
##  This file is part of AutoOpts, a companion to AutoGen.
Packit Service 96b5d3
##  AutoOpts is free software.
Packit Service 96b5d3
##  AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
Packit Service 96b5d3
##
Packit Service 96b5d3
##  AutoOpts is available under any one of two licenses.  The license
Packit Service 96b5d3
##  in use must be one of these two and the choice is under the control
Packit Service 96b5d3
##  of the user of the license.
Packit Service 96b5d3
##
Packit Service 96b5d3
##   The GNU Lesser General Public License, version 3 or later
Packit Service 96b5d3
##      See the files "COPYING.lgplv3" and "COPYING.gplv3"
Packit Service 96b5d3
##
Packit Service 96b5d3
##   The Modified Berkeley Software Distribution License
Packit Service 96b5d3
##      See the file "COPYING.mbsd"
Packit Service 96b5d3
##
Packit Service 96b5d3
##  These files have the following sha256 sums:
Packit Service 96b5d3
##
Packit Service 96b5d3
##  8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95  COPYING.gplv3
Packit Service 96b5d3
##  4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b  COPYING.lgplv3
Packit Service 96b5d3
##  13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239  COPYING.mbsd
Packit Service 96b5d3
Packit Service 96b5d3
=][=
Packit Service 96b5d3
Packit Service 96b5d3
;;;
Packit Service 96b5d3
;;;  Compute the usage line.  It is complex because we are trying to
Packit Service 96b5d3
;;;  encode as much information as we can and still be comprehensible.
Packit Service 96b5d3
;;;
Packit Service 96b5d3
;;;  The rules are:  If any options have a "value" attribute, then
Packit Service 96b5d3
;;;  there are flags allowed, so include "-<flag>" on the usage line.
Packit Service 96b5d3
;;;  If the program has the "long-opts" attribute set, then we must
Packit Service 96b5d3
;;;  have "<option-name>" or "--<name>" on the line, depending on
Packit Service 96b5d3
;;;  whether or not there are flag options.  If any options take
Packit Service 96b5d3
;;;  arguments, then append "[<val>]" to the flag description and
Packit Service 96b5d3
;;;  "[{=| }<val>]" to the option-name/name descriptions.  We will not
Packit Service 96b5d3
;;;  worry about being correct if every option has a required argument.
Packit Service 96b5d3
;;;  Finally, if there are no minimum occurrence counts (i.e. all
Packit Service 96b5d3
;;;  options are optional), then we put square brackets around the
Packit Service 96b5d3
;;;  syntax.
Packit Service 96b5d3
;;;
Packit Service 96b5d3
;;;  Compute the option arguments
Packit Service 96b5d3
;;;
Packit Service 96b5d3
(define tmp-val "")
Packit Service 96b5d3
(if (exist? "flag.arg-type")
Packit Service 96b5d3
    (set! tmp-val "[{=| }<val>]"))
Packit Service 96b5d3
Packit Service 96b5d3
(define usage-line (string-append "Usage:  %s "
Packit Service 96b5d3
Packit Service 96b5d3
  ;; If at least one option has a minimum occurrence count
Packit Service 96b5d3
  ;; we use curly brackets around the option syntax.
Packit Service 96b5d3
  ;;
Packit Service 96b5d3
  (if (not (exist? "flag.min")) "[ " "{ ")
Packit Service 96b5d3
Packit Service 96b5d3
  (if (exist? "flag.value")
Packit Service 96b5d3
      (string-append "-<flag>"
Packit Service 96b5d3
         (if (exist? "flag.arg-type") " [<val>]" "")
Packit Service 96b5d3
         (if (exist? "long-opts") " | " "") )
Packit Service 96b5d3
      (if (not (exist? "long-opts"))
Packit Service 96b5d3
         (string-append "<option-name>" tmp-val) "" )  )
Packit Service 96b5d3
Packit Service 96b5d3
  (if (exist? "long-opts")
Packit Service 96b5d3
      (string-append "--<name>" tmp-val) "" )
Packit Service 96b5d3
Packit Service 96b5d3
  (if (not (exist? "flag.min")) " ]..." " }...")
Packit Service 96b5d3
) )
Packit Service 96b5d3
Packit Service 96b5d3
(if (exist? "argument")
Packit Service 96b5d3
  (set! usage-line (string-append usage-line
Packit Service 96b5d3
Packit Service 96b5d3
    ;; the USAGE line plus the program name plus the argument goes
Packit Service 96b5d3
    ;; past 80 columns, then break the line, else separate with space
Packit Service 96b5d3
    ;;
Packit Service 96b5d3
    (if (< 80 (+ (string-length usage-line)
Packit Service 96b5d3
          (len "argument")
Packit Service 96b5d3
          (string-length prog-name) ))
Packit Service 96b5d3
        " \\\n\t\t"
Packit Service 96b5d3
        " "
Packit Service 96b5d3
    )
Packit Service 96b5d3
Packit Service 96b5d3
    (get "argument")
Packit Service 96b5d3
  ))
Packit Service 96b5d3
)
Packit Service 96b5d3
Packit Service 96b5d3
(define usage-text (string-append prog-name
Packit Service 96b5d3
        (if (exist? "package")
Packit Service 96b5d3
            (string-append " (" (get "package") ")")
Packit Service 96b5d3
            "" )
Packit Service 96b5d3
        " - " (get "prog-title")
Packit Service 96b5d3
        (if (and (exist? "version") (not (exist? "gnu-usage")))
Packit Service 96b5d3
            (string-append " - Ver. " (get "version"))
Packit Service 96b5d3
            "" )
Packit Service 96b5d3
        "\n" usage-line "\n"
Packit Service 96b5d3
)) =][= #
Packit Service 96b5d3
Packit Service 96b5d3
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
Packit Service 96b5d3
Packit Service 96b5d3
INCLUDE "optmain.tlib"
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
#ifndef __doxygen__
Packit Service 96b5d3
#define OPTION_CODE_COMPILE 1
Packit Service 96b5d3
#include "[= (define lib-externs "") header-file=]"[=
Packit Service 96b5d3
Packit Service 96b5d3
IF (== (get "main.main-type" "") "for-each")
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
#include <sys/types.h>
Packit Service 96b5d3
#include <sys/stat.h>
Packit Service 96b5d3
Packit Service 96b5d3
#include <ctype.h>
Packit Service 96b5d3
#include <errno.h>
Packit Service 96b5d3
#include <fcntl.h>
Packit Service 96b5d3
#include <limits.h>
Packit Service 96b5d3
#include <stdio.h>
Packit Service 96b5d3
#include <stdlib.h>
Packit Service 96b5d3
#include <string.h>
Packit Service 96b5d3
#include <unistd.h>[=
Packit Service 96b5d3
Packit Service 96b5d3
ELSE
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
#include <sys/types.h>
Packit Service 96b5d3
Packit Service 96b5d3
#include <limits.h>
Packit Service 96b5d3
#include <stdio.h>
Packit Service 96b5d3
#include <stdlib.h>[=
Packit Service 96b5d3
Packit Service 96b5d3
 (if (exist? "flag.arg-range")
Packit Service 96b5d3
     (emit "\n#include <errno.h>"))
Packit Service 96b5d3
Packit Service 96b5d3
 (if (and (exist? "resettable") (exist? "flag.open-file"))
Packit Service 96b5d3
     (emit "
Packit Service 96b5d3
#include <sys/stat.h>
Packit Service 96b5d3
#include <fcntl.h>
Packit Service 96b5d3
#include <unistd.h>" )) =][=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
Packit Service 96b5d3
#ifdef  __cplusplus
Packit Service 96b5d3
extern "C" {
Packit Service 96b5d3
#endif
Packit Service 96b5d3
extern FILE * option_usage_fp;[=
Packit Service 96b5d3
Packit Service 96b5d3
IF (not (exist? "copyright"))
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
#define zCopyright      NULL
Packit Service 96b5d3
#define zLicenseDescrip NULL[=
Packit Service 96b5d3
ELSE  =][=
Packit Service 96b5d3
  CASE (define cright-owner (get "copyright.owner" (get "copyright.author")))
Packit Service 96b5d3
       (get "copyright.type")   =][=
Packit Service 96b5d3
Packit Service 96b5d3
    = note                      =][=
Packit Service 96b5d3
      (set! tmp-text (get  "copyright.text"))
Packit Service 96b5d3
      (define ext-text tmp-text)            =][=
Packit Service 96b5d3
Packit Service 96b5d3
    ~~* .                       =][=
Packit Service 96b5d3
      (define ext-text
Packit Service 96b5d3
         (license-description (get "copyright.type")
Packit Service 96b5d3
            prog-name "" cright-owner ) )
Packit Service 96b5d3
Packit Service 96b5d3
      (set! tmp-text
Packit Service 96b5d3
         (license-info (get "copyright.type")
Packit Service 96b5d3
            prog-name "" cright-owner (get "copyright.date") ) )
Packit Service 96b5d3
                                =][=
Packit Service 96b5d3
Packit Service 96b5d3
    *                           =][=
Packit Service 96b5d3
      (set! tmp-text (sprintf
Packit Service 96b5d3
              "Copyright (C) %s %s, all rights reserved"
Packit Service 96b5d3
              (get "copyright.date") cright-owner  ))
Packit Service 96b5d3
      (define ext-text tmp-text)  =][=
Packit Service 96b5d3
Packit Service 96b5d3
  ESAC                          =][=
Packit Service 96b5d3
Packit Service 96b5d3
(set! tmp-text (string-append version-text "\n" tmp-text))
Packit Service 96b5d3
(if (not omit-nls-code)
Packit Service 96b5d3
    (put-xget "pzCopyright" tmp-text))
Packit Service 96b5d3
Packit Service 96b5d3
(string-append "\n#define zCopyright      ("
Packit Service 96b5d3
    (string-table-add-ref opt-strs tmp-text)
Packit Service 96b5d3
    ")\n#define zLicenseDescrip ("
Packit Service 96b5d3
Packit Service 96b5d3
    (if (= tmp-text ext-text)
Packit Service 96b5d3
        "zCopyright"
Packit Service 96b5d3
        (begin
Packit Service 96b5d3
           (set! ext-text (string-append (shell (string-append
Packit Service 96b5d3
             "${CLexe} --fill -I0 -W75 <<_EOF_\n" ext-text "\n_EOF_" )) "\n" ))
Packit Service 96b5d3
Packit Service 96b5d3
           (if (not omit-nls-code)
Packit Service 96b5d3
               (put-xget "pzCopyNotice" ext-text))
Packit Service 96b5d3
           (string-table-add-ref opt-strs ext-text)
Packit Service 96b5d3
    )   )
Packit Service 96b5d3
    ")\n" )                     =][=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF "copyright"               =][=
Packit Service 96b5d3
Packit Service 96b5d3
   (define usage-proc (get "usage"))
Packit Service 96b5d3
   (if (< 1 (string-length usage-proc))
Packit Service 96b5d3
     (emit (string-append "\nextern tUsageProc " usage-proc ";"))
Packit Service 96b5d3
     (set! usage-proc "optionUsage")
Packit Service 96b5d3
   )
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
[= INVOKE join-or-expand   join-type = "include" =]
Packit Service 96b5d3
#ifndef NULL
Packit Service 96b5d3
#  define NULL 0
Packit Service 96b5d3
#endif
Packit Service 96b5d3
Packit Service 96b5d3
/**
Packit Service 96b5d3
 *  static const strings for [= prog-name =] options
Packit Service 96b5d3
 */[=
Packit Service 96b5d3
 (out-resume "home-list")      \=][=
Packit Service 96b5d3
Packit Service 96b5d3
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
Packit Service 96b5d3
Packit Service 96b5d3
FOR flag "\n"           =][=
Packit Service 96b5d3
  (define flag-index (for-index)) =][=
Packit Service 96b5d3
  INVOKE emit-opt-strs  =][=
Packit Service 96b5d3
Packit Service 96b5d3
  (if (exist? "lib-name") (begin
Packit Service 96b5d3
      (set! lib-opt-ptr (string->c-name! (string-append
Packit Service 96b5d3
                        (get "lib-name") "_" (get "name") "_optDesc_p")))
Packit Service 96b5d3
      (set! lib-externs (string-append lib-externs
Packit Service 96b5d3
                        (sprintf "tOptDesc * const %-16s = optDesc + %d;\n"
Packit Service 96b5d3
                                 lib-opt-ptr (for-index) )  ))
Packit Service 96b5d3
  )   )                 =][=
Packit Service 96b5d3
Packit Service 96b5d3
ENDFOR flag             =][=
Packit Service 96b5d3
Packit Service 96b5d3
INVOKE help-strs        =][=
Packit Service 96b5d3
INVOKE decl-callbacks   =][=
Packit Service 96b5d3
Packit Service 96b5d3
IF (exist? "version")   =][=
Packit Service 96b5d3
Packit Service 96b5d3
  IF (exist? "version-proc") =]
Packit Service 96b5d3
#define VER_PROC        [= (get "version-proc") =][=
Packit Service 96b5d3
  ELIF (. guarded-test-main) =]
Packit Service 96b5d3
#ifdef [=(. main-guard) =]
Packit Service 96b5d3
# define VER_PROC       optionVersionStderr
Packit Service 96b5d3
#else
Packit Service 96b5d3
# define VER_PROC       optionPrintVersion
Packit Service 96b5d3
#endif /* [=(. main-guard)=] */[=
Packit Service 96b5d3
  ELSE                  =]
Packit Service 96b5d3
#define VER_PROC        optionPrintVersion[=
Packit Service 96b5d3
  ENDIF  guarded-test-main =][=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF  there is a version
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
[= INVOKE emit-option-desc-table =]
Packit Service 96b5d3
[= (. lib-externs) =]
Packit Service 96b5d3
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Packit Service 96b5d3
/** Reference to the upper cased version of [= prog-name =]. */
Packit Service 96b5d3
#define zPROGNAME       ([= (string-table-add-ref opt-strs pname-up)   =])
Packit Service 96b5d3
/** Reference to the title line for [= prog-name =] usage. */
Packit Service 96b5d3
#define zUsageTitle     ([=
Packit Service 96b5d3
 (define homerc-ct   0)
Packit Service 96b5d3
 (define homerc-txt "")
Packit Service 96b5d3
 (if (not omit-nls-code)
Packit Service 96b5d3
     (put-xget "pzUsageTitle" usage-text))
Packit Service 96b5d3
Packit Service 96b5d3
 (string-table-add-ref opt-strs usage-text) =])
Packit Service 96b5d3
[=
Packit Service 96b5d3
FOR homerc              =][=
Packit Service 96b5d3
  (set! tmp-text (get "homerc"))
Packit Service 96b5d3
  (if (> (string-length tmp-text) 0) (begin
Packit Service 96b5d3
      (set! homerc-ct  (+ 1 homerc-ct))
Packit Service 96b5d3
      (set! homerc-txt (string-append homerc-txt
Packit Service 96b5d3
            "\n    " (string-table-add-ref opt-strs tmp-text) "," ))
Packit Service 96b5d3
  )   )                 =][=
Packit Service 96b5d3
ENDFOR homerc           =][=
Packit Service 96b5d3
IF (> homerc-ct 0)     \=]
Packit Service 96b5d3
/** [= prog-name =] configuration file name. */
Packit Service 96b5d3
#define zRcName         ([=
Packit Service 96b5d3
 (set! tmp-text (get "rcfile"
Packit Service 96b5d3
       (string-append "." pname-down "rc") ))
Packit Service 96b5d3
 (string-table-add-ref opt-strs tmp-text) =])
Packit Service 96b5d3
/** Directories to search for [= prog-name =] config files. */
Packit Service 96b5d3
static char const * const apzHomeList[=
Packit Service 96b5d3
  (sprintf "[%u] = {%s\n    NULL };" (+ 1 homerc-ct) homerc-txt) =][=
Packit Service 96b5d3
Packit Service 96b5d3
ELSE                    \=]
Packit Service 96b5d3
/** There is no [= prog-name =] configuration file. */
Packit Service 96b5d3
#define zRcName         NULL
Packit Service 96b5d3
/** There are no directories to search for [= prog-name =] config files. */
Packit Service 96b5d3
#define apzHomeList     NULL[=
Packit Service 96b5d3
ENDIF                   =]
Packit Service 96b5d3
/** The [= prog-name =] program bug email address. */
Packit Service 96b5d3
#define zBugsAddr       ([=
Packit Service 96b5d3
(out-push-new)         \=]
Packit Service 96b5d3
s/@[a-z]*{\([^{@}]*\)}/'\1'/g
Packit Service 96b5d3
s=@<prog-name>@=[= prog-name =]=g
Packit Service 96b5d3
/^@\(end *\)*example/d
Packit Service 96b5d3
s/^@item *$/\
Packit Service 96b5d3
/[=
Packit Service 96b5d3
Packit Service 96b5d3
(define patch-text-sed
Packit Service 96b5d3
  (sprintf "sed %s <<\\_EODetail_ | ${CLexe} --fill -I0 -W75\n"
Packit Service 96b5d3
    (raw-shell-str (out-pop #t)) ) )
Packit Service 96b5d3
Packit Service 96b5d3
(define patch-text (lambda (t-name)
Packit Service 96b5d3
  (set! tmp-text (string-append
Packit Service 96b5d3
Packit Service 96b5d3
  (shell (string-append
Packit Service 96b5d3
    patch-text-sed
Packit Service 96b5d3
    (get t-name)
Packit Service 96b5d3
    "\n_EODetail_" ))
Packit Service 96b5d3
  "\n" )) ))
Packit Service 96b5d3
Packit Service 96b5d3
(if (exist? "copyright.eaddr")
Packit Service 96b5d3
    (string-table-add-ref opt-strs (get "copyright.eaddr"))
Packit Service 96b5d3
    (if (exist? "eaddr")
Packit Service 96b5d3
        (string-table-add-ref opt-strs (get "eaddr"))
Packit Service 96b5d3
        "NULL"
Packit Service 96b5d3
)   )                   =])
Packit Service 96b5d3
/** Clarification/explanation of what [= prog-name =] does. */
Packit Service 96b5d3
#define zExplain        ([=
Packit Service 96b5d3
Packit Service 96b5d3
(if (or (exist? "explain") (== (get "main.main-type") "for-each"))
Packit Service 96b5d3
    (begin
Packit Service 96b5d3
      (if (exist? "explain")
Packit Service 96b5d3
          (patch-text "explain")
Packit Service 96b5d3
          (set! tmp-text "")  )
Packit Service 96b5d3
Packit Service 96b5d3
      (if (== (get "main.main-type") "for-each")
Packit Service 96b5d3
          (set! tmp-text (string-append tmp-text
Packit Service 96b5d3
"\nIf no arguments are provided, input arguments are read from stdin,
Packit Service 96b5d3
one per line; blank and '"
Packit Service 96b5d3
(if (exist? "main.comment-char") (get "main.comment-char") "#")
Packit Service 96b5d3
"'-prefixed lines are comments.\n"
Packit Service 96b5d3
(if (exist? "main.interleaved")
Packit Service 96b5d3
    "Options may appear in the input interspersed with the 'normal' input.\n"
Packit Service 96b5d3
    "")
Packit Service 96b5d3
"'stdin' may not be a terminal (tty).\n" ))  )
Packit Service 96b5d3
Packit Service 96b5d3
      (if (not omit-nls-code)
Packit Service 96b5d3
          (put-xget "pzExplain" tmp-text))
Packit Service 96b5d3
      (string-table-add-ref opt-strs tmp-text)
Packit Service 96b5d3
    )
Packit Service 96b5d3
    "NULL"
Packit Service 96b5d3
)                       =])
Packit Service 96b5d3
/** Extra detail explaining what [= prog-name =] does. */
Packit Service 96b5d3
#define zDetail         ([=
Packit Service 96b5d3
Packit Service 96b5d3
(if (exist? "detail")
Packit Service 96b5d3
    (begin
Packit Service 96b5d3
      (patch-text "detail")
Packit Service 96b5d3
      (if (not omit-nls-code)
Packit Service 96b5d3
          (put-xget "pzDetail" tmp-text))
Packit Service 96b5d3
      (string-table-add-ref opt-strs tmp-text)
Packit Service 96b5d3
    )
Packit Service 96b5d3
    "NULL"
Packit Service 96b5d3
)                       =])
Packit Service 96b5d3
/** The full version string for [= prog-name =]. */
Packit Service 96b5d3
#define zFullVersion    ([=
Packit Service 96b5d3
Packit Service 96b5d3
(if (exist? "version") (begin
Packit Service 96b5d3
    (if (not omit-nls-code)
Packit Service 96b5d3
        (put-xget "pzFullVersion" version-text))
Packit Service 96b5d3
    (string-table-add-ref opt-strs version-text) )
Packit Service 96b5d3
  "NULL")               =])[=
Packit Service 96b5d3
(tpl-file-line extract-fmt)
Packit Service 96b5d3
=][=
Packit Service 96b5d3
Packit Service 96b5d3
   IF (. omit-nls-code) =]
Packit Service 96b5d3
#define OPTPROC_BASE OPTPROC_NONE
Packit Service 96b5d3
#define translate_option_strings NULL
Packit Service 96b5d3
[= ELSE  =]
Packit Service 96b5d3
#if defined(ENABLE_NLS)
Packit Service 96b5d3
# define OPTPROC_BASE OPTPROC_TRANSLATE[=
Packit Service 96b5d3
CASE   no-xlate             =][=
Packit Service 96b5d3
!E                          =][=
Packit Service 96b5d3
= opt-cfg                   =] | OPTPROC_NXLAT_OPT_CFG[=
Packit Service 96b5d3
= opt                       =] | OPTPROC_NXLAT_OPT[=
Packit Service 96b5d3
*                           =][= (error "invalid value for 'no-xlate'") =][=
Packit Service 96b5d3
ESAC   no-xlate             =]
Packit Service 96b5d3
  static tOptionXlateProc translate_option_strings;
Packit Service 96b5d3
#else
Packit Service 96b5d3
# define OPTPROC_BASE OPTPROC_NONE
Packit Service 96b5d3
# define translate_option_strings NULL
Packit Service 96b5d3
#endif /* ENABLE_NLS */
Packit Service 96b5d3
[= ENDIF no-nls             =][=
Packit Service 96b5d3
   IF (exist? "resettable") =]
Packit Service 96b5d3
#ifndef optArgBucket_t
Packit Service 96b5d3
#define opt_arg_union_t optArgBucket_t
Packit Service 96b5d3
#endif
Packit Service 96b5d3
/** Compiled-in initial values for [= prog-name =] options. */
Packit Service 96b5d3
static opt_arg_union_t const original_[=(. pname-down)=]_defaults[ [=
Packit Service 96b5d3
(. UP-prefix) =]OPTION_CT ] = {
Packit Service 96b5d3
[= (shell (string-append
Packit Service 96b5d3
      "sed '$s@},@} @' <<\\_EOF_" default-text "\n_EOF_\n")) =]
Packit Service 96b5d3
};
Packit Service 96b5d3
/** Compiled-in initial values for [= prog-name =] option cookies. */
Packit Service 96b5d3
static void * const original_[=(. pname-down)=]_cookies[ [=
Packit Service 96b5d3
(. UP-prefix) =]OPTION_CT ] = {
Packit Service 96b5d3
[=
Packit Service 96b5d3
 (shell (string-append "${CLexe} -I4 -S, <<\\_EOF_\n" default-cookie "_EOF_"))
Packit Service 96b5d3
=]
Packit Service 96b5d3
};
Packit Service 96b5d3
[= ENDIF resettable=]
Packit Service 96b5d3
[= INVOKE emit-help-text help-type = full  \=]
Packit Service 96b5d3
[= INVOKE emit-help-text help-type = short  =]
Packit Service 96b5d3
#endif /* not defined __doxygen__ */
Packit Service 96b5d3
[= INVOKE emit-option-callbacks          =]
Packit Service 96b5d3
/**
Packit Service 96b5d3
 * The directory containing the data associated with [= prog-name =].
Packit Service 96b5d3
 */
Packit Service 96b5d3
#ifndef  PKGDATADIR
Packit Service 96b5d3
# define PKGDATADIR ""
Packit Service 96b5d3
#endif
Packit Service 96b5d3
Packit Service 96b5d3
/**
Packit Service 96b5d3
 * Information about the person or institution that packaged [= prog-name =]
Packit Service 96b5d3
 * for the current distribution.
Packit Service 96b5d3
 */
Packit Service 96b5d3
#ifndef  WITH_PACKAGER
Packit Service 96b5d3
# define [=(. pname)=]_packager_info NULL
Packit Service 96b5d3
#else
Packit Service 96b5d3
/** Packager information for [= prog-name =]. */
Packit Service 96b5d3
static char const [=(. pname)=]_packager_info[] =
Packit Service 96b5d3
    "Packaged by " WITH_PACKAGER
Packit Service 96b5d3
Packit Service 96b5d3
# ifdef WITH_PACKAGER_VERSION
Packit Service 96b5d3
        " ("WITH_PACKAGER_VERSION")"
Packit Service 96b5d3
# endif
Packit Service 96b5d3
Packit Service 96b5d3
# ifdef WITH_PACKAGER_BUG_REPORTS
Packit Service 96b5d3
    "\nReport [=(. pname)=] bugs to " WITH_PACKAGER_BUG_REPORTS
Packit Service 96b5d3
# endif
Packit Service 96b5d3
    "\n";
Packit Service 96b5d3
#endif
Packit Service 96b5d3
#ifndef __doxygen__
Packit Service 96b5d3
[=
Packit Service 96b5d3
 (out-suspend  "home-list")
Packit Service 96b5d3
 (emit-string-table opt-strs)
Packit Service 96b5d3
 (out-resume   "home-list")
Packit Service 96b5d3
 (define put-shell-main (== (get "main.main-type") "shell-process"))
Packit Service 96b5d3
 (out-pop      #t)
Packit Service 96b5d3
=]
Packit Service 96b5d3
#endif /* __doxygen__ */
Packit Service 96b5d3
/**
Packit Service 96b5d3
 * The option definitions for [= prog-name =].  The one structure that
Packit Service 96b5d3
 * binds them all.
Packit Service 96b5d3
 */
Packit Service 96b5d3
tOptions [=(. pname)=]Options = {
Packit Service 96b5d3
    OPTIONS_STRUCT_VERSION,
Packit Service 96b5d3
    0, NULL,                    /* original argc + argv    */
Packit Service 96b5d3
    ( OPTPROC_BASE[=
Packit Service 96b5d3
    (define tmp-val "\n    + OPTPROC_")
Packit Service 96b5d3
    (if (not (exist? "allow-errors"))       (emit tmp-val "ERRSTOP"))
Packit Service 96b5d3
    (if (exist? "flag.value")               (emit tmp-val "SHORTOPT"))
Packit Service 96b5d3
    (if (exist? "long-opts")                (emit tmp-val "LONGOPT"))
Packit Service 96b5d3
    (if (not (exist? "flag.min"))           (emit tmp-val "NO_REQ_OPT"))
Packit Service 96b5d3
    (if (exist? "flag.disable")             (emit tmp-val "NEGATIONS"))
Packit Service 96b5d3
    (if (>=   number-opt-index 0)           (emit tmp-val "NUM_OPT"))
Packit Service 96b5d3
    (if (exist? "environrc")                (emit tmp-val "ENVIRON"))
Packit Service 96b5d3
    (if (not (exist? "argument"))           (emit tmp-val "NO_ARGS")
Packit Service 96b5d3
       (if (not (==* (get "argument") "[")) (emit tmp-val "ARGS_REQ")))
Packit Service 96b5d3
    (if (exist? "reorder-args")             (emit tmp-val "REORDER"))
Packit Service 96b5d3
    (if (exist? "gnu-usage")                (emit tmp-val "GNUUSAGE"))
Packit Service 96b5d3
    (if (exist? "no-misuse-usage")          (emit tmp-val "MISUSE"))
Packit Service 96b5d3
    (if (exist? "vendor-opt")               (emit tmp-val "VENDOR_OPT"))
Packit Service 96b5d3
    (if put-shell-main                      (emit tmp-val "SHELL_OUTPUT"))
Packit Service 96b5d3
    =] ),
Packit Service 96b5d3
    0, NULL,                    /* current option index, current option */
Packit Service 96b5d3
    NULL,         NULL,         zPROGNAME,
Packit Service 96b5d3
    zRcName,      zCopyright,   zLicenseDescrip,
Packit Service 96b5d3
    zFullVersion, apzHomeList,  zUsageTitle,
Packit Service 96b5d3
    zExplain,     zDetail,      optDesc,
Packit Service 96b5d3
    zBugsAddr,                  /* address to send bugs to */
Packit Service 96b5d3
    NULL, NULL,                 /* extensions/saved state  */
Packit Service 96b5d3
    [= (. usage-proc)       =], /* usage procedure */
Packit Service 96b5d3
    translate_option_strings,   /* translation procedure */
Packit Service 96b5d3
    /*
Packit Service 96b5d3
     *  Indexes to special options
Packit Service 96b5d3
     */
Packit Service 96b5d3
    { [= (if (exist? "no-libopts") "NO_EQUIVALENT"
Packit Service 96b5d3
             (string-append INDEX-pfx "MORE_HELP"))
Packit Service 96b5d3
       =], /* more-help option index */
Packit Service 96b5d3
      [=IF (and (exist? "homerc") (not (exist? "disable-save")))
Packit Service 96b5d3
             =][= (. INDEX-pfx) =]SAVE_OPTS[=
Packit Service 96b5d3
        ELSE =]NO_EQUIVALENT[=
Packit Service 96b5d3
        ENDIF=], /* save option index */
Packit Service 96b5d3
      [= (if (>= number-opt-index 0) number-opt-index "NO_EQUIVALENT")
Packit Service 96b5d3
        =], /* '-#' option index */
Packit Service 96b5d3
      [= (if (>= default-opt-index 0) default-opt-index "NO_EQUIVALENT")
Packit Service 96b5d3
        =] /* index of default opt */
Packit Service 96b5d3
    },
Packit Service 96b5d3
    [= (. option-ct) =] /* full option count */, [=
Packit Service 96b5d3
       (count "flag")=] /* user option count */,
Packit Service 96b5d3
    [= (. pname) =]_full_usage, [= (. pname) =]_short_usage,
Packit Service 96b5d3
[= IF (exist? "resettable") \=]
Packit Service 96b5d3
    original_[=(. pname-down)=]_defaults, original_[=(. pname-down)=]_cookies,
Packit Service 96b5d3
[= ELSE \=]
Packit Service 96b5d3
    NULL, NULL,
Packit Service 96b5d3
[= ENDIF \=]
Packit Service 96b5d3
    PKGDATADIR, [=(. pname)=]_packager_info
Packit Service 96b5d3
};
Packit Service 96b5d3
[=
Packit Service 96b5d3
Packit Service 96b5d3
FOR lib-name
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
tOptDesc* [= (string->c-name! (get "lib-name")) =]_optDesc_p = NULL;[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDFOR                      =][=
Packit Service 96b5d3
Packit Service 96b5d3
IF (not omit-nls-code)      =][=
Packit Service 96b5d3
  INVOKE emit-nls-code      =][=
Packit Service 96b5d3
ENDIF
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
#ifdef  __cplusplus
Packit Service 96b5d3
}
Packit Service 96b5d3
#endif[= #
Packit Service 96b5d3
Packit Service 96b5d3
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
Packit Service 96b5d3
Packit Service 96b5d3
DEFINE emit-nls-code
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
#if ENABLE_NLS
Packit Service 96b5d3
/**
Packit Service 96b5d3
 * This code is designed to translate translatable option text for the
Packit Service 96b5d3
 * [= prog-name =] program.  These translations happen upon entry
Packit Service 96b5d3
 * to optionProcess().
Packit Service 96b5d3
 */
Packit Service 96b5d3
#include <stdio.h>
Packit Service 96b5d3
#include <stdlib.h>
Packit Service 96b5d3
#include <string.h>
Packit Service 96b5d3
#include <unistd.h>
Packit Service 96b5d3
#ifdef HAVE_DCGETTEXT
Packit Service 96b5d3
# include <gettext.h>
Packit Service 96b5d3
#endif
Packit Service 96b5d3
#include <autoopts/usage-txt.h>
Packit Service 96b5d3
Packit Service 96b5d3
static char * AO_gettext(char const * pz);
Packit Service 96b5d3
static void   coerce_it(void ** s);
Packit Service 96b5d3
Packit Service 96b5d3
/**
Packit Service 96b5d3
 * AutoGen specific wrapper function for gettext.  It relies on the macro _()
Packit Service 96b5d3
 * to convert from English to the target language, then strdup-duplicates the
Packit Service 96b5d3
 * result string.  It tries the "libopts" domain first, then whatever has been
Packit Service 96b5d3
 * set via the \a textdomain(3) call.
Packit Service 96b5d3
 *
Packit Service 96b5d3
 * @param[in] pz the input text used as a lookup key.
Packit Service 96b5d3
 * @returns the translated text (if there is one),
Packit Service 96b5d3
 *   or the original text (if not).
Packit Service 96b5d3
 */
Packit Service 96b5d3
static char *
Packit Service 96b5d3
AO_gettext(char const * pz)
Packit Service 96b5d3
{
Packit Service 96b5d3
    char * res;
Packit Service 96b5d3
    if (pz == NULL)
Packit Service 96b5d3
        return NULL;
Packit Service 96b5d3
#ifdef HAVE_DCGETTEXT
Packit Service 96b5d3
    /*
Packit Service 96b5d3
     * While processing the option_xlateable_txt data, try to use the
Packit Service 96b5d3
     * "libopts" domain.  Once we switch to the option descriptor data,
Packit Service 96b5d3
     * do *not* use that domain.
Packit Service 96b5d3
     */
Packit Service 96b5d3
    if (option_xlateable_txt.field_ct != 0) {
Packit Service 96b5d3
        res = dgettext("libopts", pz);
Packit Service 96b5d3
        if (res == pz)
Packit Service 96b5d3
            res = (char *)VOIDP(_(pz));
Packit Service 96b5d3
    } else
Packit Service 96b5d3
        res = (char *)VOIDP(_(pz));
Packit Service 96b5d3
#else
Packit Service 96b5d3
    res = (char *)VOIDP(_(pz));
Packit Service 96b5d3
#endif
Packit Service 96b5d3
    if (res == pz)
Packit Service 96b5d3
        return res;
Packit Service 96b5d3
    res = strdup(res);
Packit Service 96b5d3
    if (res == NULL) {
Packit Service 96b5d3
        fputs(_("No memory for duping translated strings\n"), stderr);
Packit Service 96b5d3
        exit([=(. nomem-exit-code)=]);
Packit Service 96b5d3
    }
Packit Service 96b5d3
    return res;
Packit Service 96b5d3
}
Packit Service 96b5d3
Packit Service 96b5d3
/**
Packit Service 96b5d3
 * All the pointers we use are marked "* const", but they are stored in
Packit Service 96b5d3
 * writable memory.  Coerce the mutability and set the pointer.
Packit Service 96b5d3
 */
Packit Service 96b5d3
static void coerce_it(void ** s) { *s = AO_gettext(*s);
Packit Service 96b5d3
}
Packit Service 96b5d3
Packit Service 96b5d3
/**
Packit Service 96b5d3
 * Translate all the translatable strings in the [=(. pname)=]Options
Packit Service 96b5d3
 * structure defined above.  This is done only once.
Packit Service 96b5d3
 */
Packit Service 96b5d3
static void
Packit Service 96b5d3
translate_option_strings(void)
Packit Service 96b5d3
{
Packit Service 96b5d3
    tOptions * const opts = &[=(. pname)=]Options;
Packit Service 96b5d3
Packit Service 96b5d3
    /*
Packit Service 96b5d3
     *  Guard against re-translation.  It won't work.  The strings will have
Packit Service 96b5d3
     *  been changed by the first pass through this code.  One shot only.
Packit Service 96b5d3
     */
Packit Service 96b5d3
    if (option_xlateable_txt.field_ct != 0) {
Packit Service 96b5d3
        /*
Packit Service 96b5d3
         *  Do the translations.  The first pointer follows the field count
Packit Service 96b5d3
         *  field.  The field count field is the size of a pointer.
Packit Service 96b5d3
         */
Packit Service 96b5d3
        char ** ppz = (char**)VOIDP(&(option_xlateable_txt));
Packit Service 96b5d3
        int     ix  = option_xlateable_txt.field_ct;
Packit Service 96b5d3
Packit Service 96b5d3
        do {
Packit Service 96b5d3
            ppz++; /* skip over field_ct */
Packit Service 96b5d3
            *ppz = AO_gettext(*ppz);
Packit Service 96b5d3
        } while (--ix > 0);
Packit Service 96b5d3
        /* prevent re-translation and disable "libopts" domain lookup */
Packit Service 96b5d3
        option_xlateable_txt.field_ct = 0;
Packit Service 96b5d3
[=
Packit Service 96b5d3
  FOR field IN pzCopyright pzCopyNotice pzFullVersion =]
Packit Service 96b5d3
        coerce_it(VOIDP(&(opts->[= field =])));[=
Packit Service 96b5d3
  ENDFOR                        =][=
Packit Service 96b5d3
Packit Service 96b5d3
  IF (not (exist? "full-usage"))=][=
Packit Service 96b5d3
    FOR field IN pzUsageTitle pzExplain pzDetail =]
Packit Service 96b5d3
        coerce_it(VOIDP(&(opts->[= field =])));[=
Packit Service 96b5d3
    ENDFOR                      =]
Packit Service 96b5d3
        {
Packit Service 96b5d3
            tOptDesc * od = opts->pOptDesc;
Packit Service 96b5d3
            for (ix = opts->optCt; ix > 0; ix--, od++)
Packit Service 96b5d3
                coerce_it(VOIDP(&(od->pzText)));
Packit Service 96b5d3
        }[=
Packit Service 96b5d3
  ENDIF                         =]
Packit Service 96b5d3
    }
Packit Service 96b5d3
}
Packit Service 96b5d3
#endif /* ENABLE_NLS */
Packit Service 96b5d3
Packit Service 96b5d3
#ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT
Packit Service 96b5d3
/** I18N function strictly for xgettext.  Do not compile. */
Packit Service 96b5d3
static void bogus_function(void) {
Packit Service 96b5d3
  /* TRANSLATORS:
Packit Service 96b5d3
Packit Service 96b5d3
     The following dummy function was crated solely so that xgettext can
Packit Service 96b5d3
     extract the correct strings.  These strings are actually referenced
Packit Service 96b5d3
     by a field name in the [=(. pname)=]Options structure noted in the
Packit Service 96b5d3
     comments below.  The literal text is defined in [=(. pname)=]_opt_strs.
Packit Service 96b5d3
   
Packit Service 96b5d3
     NOTE: the strings below are segmented with respect to the source string
Packit Service 96b5d3
     [=(. pname)=]_opt_strs.  The strings above are handed off for translation
Packit Service 96b5d3
     at run time a paragraph at a time.  Consequently, they are presented here
Packit Service 96b5d3
     for translation a paragraph at a time.
Packit Service 96b5d3
   
Packit Service 96b5d3
     ALSO: often the description for an option will reference another option
Packit Service 96b5d3
     by name.  These are set off with apostrophe quotes (I hope).  Do not
Packit Service 96b5d3
     translate option names.
Packit Service 96b5d3
   */[=
Packit Service 96b5d3
Packit Service 96b5d3
(out-resume "xget")
Packit Service 96b5d3
(emit (out-pop #t))
Packit Service 96b5d3
Packit Service 96b5d3
(out-push-new) \=]
Packit Service 96b5d3
incdir=[= (if (defined? 'inc-dir) inc-dir "") ;;' 4emacs =]
Packit Service 96b5d3
test -d "$incdir" || incdir=`dirname [=(tpl-file #t)=]`/..
Packit Service 96b5d3
incdir=`cd $incdir/autoopts >/dev/null 2>&1 && pwd`
Packit Service 96b5d3
test -f ${incdir}/usage-txt.h && {
Packit Service 96b5d3
    sedcmd='/LIBOPTS-MESSAGES:/,/END-[=
Packit Service 96b5d3
Packit Service 96b5d3
  (if (and (exist? "full-usage") (exist? "short-usage"))
Packit Service 96b5d3
      "LIBOPTS-MESSAGES"
Packit Service 96b5d3
      "USAGE-TEXT" ) =]/p'
Packit Service 96b5d3
    sed -n "$sedcmd" ${incdir}/usage-txt.h
Packit Service 96b5d3
}
Packit Service 96b5d3
[= (shell (out-pop #t)) =]
Packit Service 96b5d3
}
Packit Service 96b5d3
#endif /* uncompilable code */[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDDEF emit-nls-code
Packit Service 96b5d3
Packit Service 96b5d3
=][=
Packit Service 96b5d3
Packit Service 96b5d3
DEFINE emit-option-desc-table
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Packit Service 96b5d3
/**
Packit Service 96b5d3
 *  Define the [= prog-name =] Option Descriptions.
Packit Service 96b5d3
 * This is an array of [=(. UP-prefix)=]OPTION_CT entries, one for each
Packit Service 96b5d3
 * option that the [= prog-name =] program responds to.
Packit Service 96b5d3
 */
Packit Service 96b5d3
static tOptDesc optDesc[[=
Packit Service 96b5d3
(define default-text   "")
Packit Service 96b5d3
(define default-cookie "")
Packit Service 96b5d3
UP-prefix
Packit Service 96b5d3
=]OPTION_CT] = {[=
Packit Service 96b5d3
Packit Service 96b5d3
FOR flag "\n"           =][=
Packit Service 96b5d3
  (define flag-index (for-index)) =][=
Packit Service 96b5d3
Packit Service 96b5d3
  INVOKE emit-opt-desc  =][=
Packit Service 96b5d3
Packit Service 96b5d3
ENDFOR flag
Packit Service 96b5d3
Packit Service 96b5d3
=][=
Packit Service 96b5d3
Packit Service 96b5d3
IF (exist? "resettable")
Packit Service 96b5d3
Packit Service 96b5d3
=]
Packit Service 96b5d3
Packit Service 96b5d3
  {  /* entry idx, value */ [=
Packit Service 96b5d3
        (set! default-text (string-append default-text
Packit Service 96b5d3
               "\n    { NULL }, /* resettable */" ))
Packit Service 96b5d3
        (set! default-cookie (string-append default-cookie "NULL\n" ))
Packit Service 96b5d3
        INDEX-pfx =]RESET_OPTION, [= (. VALUE-pfx) =]RESET_OPTION,
Packit Service 96b5d3
     /* equiv idx value  */ NO_EQUIVALENT, [= (. VALUE-pfx) =]RESET_OPTION,
Packit Service 96b5d3
     /* equivalenced to  */ NO_EQUIVALENT,
Packit Service 96b5d3
     /* min, max, act ct */ 0, 1, 0,
Packit Service 96b5d3
     /* opt state flags  */ RESET_FLAGS, AOUSE_RESET_OPTION,
Packit Service 96b5d3
     /* last opt argumnt */ { NULL },
Packit Service 96b5d3
     /* arg list/cookie  */ NULL,
Packit Service 96b5d3
     /* must/cannot opts */ NULL,  NULL,
Packit Service 96b5d3
     /* option proc      */ optionResetOpt,
Packit Service 96b5d3
     /* desc, NAME, name */ RESET_DESC, NULL, RESET_name,
Packit Service 96b5d3
     /* disablement strs */ NULL, NULL },[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF
Packit Service 96b5d3
Packit Service 96b5d3
=][=
Packit Service 96b5d3
Packit Service 96b5d3
IF (exist? "version")   =]
Packit Service 96b5d3
Packit Service 96b5d3
  {  /* entry idx, value */ [=
Packit Service 96b5d3
        (set! default-text (string-append default-text
Packit Service 96b5d3
               "\n    { NULL }, /* version */" ))
Packit Service 96b5d3
        (set! default-cookie (string-append default-cookie "NULL\n" ))
Packit Service 96b5d3
         INDEX-pfx =]VERSION, [= (. VALUE-pfx) =]VERSION,
Packit Service 96b5d3
     /* equiv idx value  */ NO_EQUIVALENT, [= (. VALUE-pfx) =]VERSION,
Packit Service 96b5d3
     /* equivalenced to  */ NO_EQUIVALENT,
Packit Service 96b5d3
     /* min, max, act ct */ 0, 1, 0,
Packit Service 96b5d3
     /* opt state flags  */ VER_FLAGS, AOUSE_VERSION,
Packit Service 96b5d3
     /* last opt argumnt */ { NULL },
Packit Service 96b5d3
     /* arg list/cookie  */ NULL,
Packit Service 96b5d3
     /* must/cannot opts */ NULL, NULL,
Packit Service 96b5d3
     /* option proc      */ VER_PROC,
Packit Service 96b5d3
     /* desc, NAME, name */ VER_DESC, NULL, VER_name,
Packit Service 96b5d3
     /* disablement strs */ NULL, NULL },
Packit Service 96b5d3
Packit Service 96b5d3
[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF =]
Packit Service 96b5d3
Packit Service 96b5d3
  {  /* entry idx, value */ [=
Packit Service 96b5d3
        (set! default-text (string-append default-text
Packit Service 96b5d3
               "\n    { NULL }, /* help */" ))
Packit Service 96b5d3
        (set! default-cookie (string-append default-cookie "NULL\n" ))
Packit Service 96b5d3
        INDEX-pfx =]HELP, [= (. VALUE-pfx) =]HELP,
Packit Service 96b5d3
     /* equiv idx value  */ NO_EQUIVALENT, [= (. VALUE-pfx) =]HELP,
Packit Service 96b5d3
     /* equivalenced to  */ NO_EQUIVALENT,
Packit Service 96b5d3
     /* min, max, act ct */ 0, 1, 0,
Packit Service 96b5d3
     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP,
Packit Service 96b5d3
     /* last opt argumnt */ { NULL },
Packit Service 96b5d3
     /* arg list/cookie  */ NULL,
Packit Service 96b5d3
     /* must/cannot opts */ NULL, NULL,
Packit Service 96b5d3
     /* option proc      */ doUsageOpt,
Packit Service 96b5d3
     /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
Packit Service 96b5d3
     /* disablement strs */ NULL, NULL }[=
Packit Service 96b5d3
Packit Service 96b5d3
IF (not (exist? "no-libopts"))          =],
Packit Service 96b5d3
Packit Service 96b5d3
  {  /* entry idx, value */ [=
Packit Service 96b5d3
        (set! default-text (string-append default-text
Packit Service 96b5d3
               "\n    { NULL }, /* more-help */" ))
Packit Service 96b5d3
        (set! default-cookie (string-append default-cookie "NULL\n" ))
Packit Service 96b5d3
        INDEX-pfx =]MORE_HELP, [= (. VALUE-pfx) =]MORE_HELP,
Packit Service 96b5d3
     /* equiv idx value  */ NO_EQUIVALENT, [= (. VALUE-pfx) =]MORE_HELP,
Packit Service 96b5d3
     /* equivalenced to  */ NO_EQUIVALENT,
Packit Service 96b5d3
     /* min, max, act ct */ 0, 1, 0,
Packit Service 96b5d3
     /* opt state flags  */ MORE_HELP_FLAGS, AOUSE_MORE_HELP,
Packit Service 96b5d3
     /* last opt argumnt */ { NULL },
Packit Service 96b5d3
     /* arg list/cookie  */ NULL,
Packit Service 96b5d3
     /* must/cannot opts */ NULL,  NULL,
Packit Service 96b5d3
     /* option proc      */ optionPagedUsage,
Packit Service 96b5d3
     /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
Packit Service 96b5d3
     /* disablement strs */ NULL, NULL }[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF not have no-libopts               =][=
Packit Service 96b5d3
Packit Service 96b5d3
IF (exist? "usage-opt")                 =],
Packit Service 96b5d3
Packit Service 96b5d3
  {  /* entry idx, value */ [=
Packit Service 96b5d3
        (set! default-text (string-append default-text
Packit Service 96b5d3
               "\n    { NULL }, /* usage-opt */" ))
Packit Service 96b5d3
        (set! default-cookie (string-append default-cookie "NULL\n" ))
Packit Service 96b5d3
        INDEX-pfx =]USAGE, [= (. VALUE-pfx) =]USAGE,
Packit Service 96b5d3
     /* equiv idx value  */ NO_EQUIVALENT, [= (. VALUE-pfx) =]USAGE,
Packit Service 96b5d3
     /* equivalenced to  */ NO_EQUIVALENT,
Packit Service 96b5d3
     /* min, max, act ct */ 0, 1, 0,
Packit Service 96b5d3
     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, AOUSE_USAGE,
Packit Service 96b5d3
     /* last opt argumnt */ { NULL },
Packit Service 96b5d3
     /* arg list/cookie  */ NULL,
Packit Service 96b5d3
     /* must/cannot opts */ NULL,  NULL,
Packit Service 96b5d3
     /* option proc      */ doUsageOpt,
Packit Service 96b5d3
     /* desc, NAME, name */ USAGE_DESC, NULL, USAGE_name,
Packit Service 96b5d3
     /* disablement strs */ NULL, NULL }[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF have usage-opt                    =][=
Packit Service 96b5d3
Packit Service 96b5d3
IF (exist? "homerc")                    =][=
Packit Service 96b5d3
   IF (not (exist? "disable-save"))     =],
Packit Service 96b5d3
Packit Service 96b5d3
  {  /* entry idx, value */ [=
Packit Service 96b5d3
        (set! default-text (string-append default-text
Packit Service 96b5d3
               "\n    { NULL }, /* save-opts */" ))
Packit Service 96b5d3
        (set! default-cookie (string-append default-cookie "NULL\n" ))
Packit Service 96b5d3
        INDEX-pfx =]SAVE_OPTS, [=
Packit Service 96b5d3
           (if (not (exist? "disable-save"))
Packit Service 96b5d3
               (string-append VALUE-pfx "SAVE_OPTS")
Packit Service 96b5d3
               "0") =],
Packit Service 96b5d3
     /* equiv idx value  */ NO_EQUIVALENT, [= (. VALUE-pfx) =]SAVE_OPTS,
Packit Service 96b5d3
     /* equivalenced to  */ NO_EQUIVALENT,
Packit Service 96b5d3
     /* min, max, act ct */ 0, 1, 0,
Packit Service 96b5d3
     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
Packit Service 96b5d3
                       | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS,
Packit Service 96b5d3
     /* last opt argumnt */ { NULL },
Packit Service 96b5d3
     /* arg list/cookie  */ NULL,
Packit Service 96b5d3
     /* must/cannot opts */ NULL,  NULL,
Packit Service 96b5d3
     /* option proc      */ NULL,
Packit Service 96b5d3
     /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
Packit Service 96b5d3
     /* disablement strs */ NULL, NULL }[=
Packit Service 96b5d3
Packit Service 96b5d3
   ENDIF disable-save does not exist     =],
Packit Service 96b5d3
Packit Service 96b5d3
  {  /* entry idx, value */ [=
Packit Service 96b5d3
        (set! default-text (string-append default-text
Packit Service 96b5d3
               "\n    { NULL }, /* load-opts */" ))
Packit Service 96b5d3
        (set! default-cookie (string-append default-cookie "NULL\n" ))
Packit Service 96b5d3
        INDEX-pfx =]LOAD_OPTS, [=
Packit Service 96b5d3
           (if (not (exist? "disable-load"))
Packit Service 96b5d3
               (string-append VALUE-pfx "LOAD_OPTS")
Packit Service 96b5d3
               "0") =],
Packit Service 96b5d3
     /* equiv idx value  */ NO_EQUIVALENT, [= (. VALUE-pfx) =]LOAD_OPTS,
Packit Service 96b5d3
     /* equivalenced to  */ NO_EQUIVALENT,
Packit Service 96b5d3
     /* min, max, act ct */ 0, NOLIMIT, 0,
Packit Service 96b5d3
     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
Packit Service 96b5d3
			  | OPTST_DISABLE_IMM[=
Packit Service 96b5d3
    (if (exist? "disable-load") "| OPTST_NO_COMMAND") =], AOUSE_LOAD_OPTS,
Packit Service 96b5d3
     /* last opt argumnt */ { NULL },
Packit Service 96b5d3
     /* arg list/cookie  */ NULL,
Packit Service 96b5d3
     /* must/cannot opts */ NULL, NULL,
Packit Service 96b5d3
     /* option proc      */ optionLoadOpt,
Packit Service 96b5d3
     /* desc, NAME, name */ [=
Packit Service 96b5d3
    (if (exist? "disable-load") "NULL, NULL, NULL"
Packit Service 96b5d3
         "LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name")=],
Packit Service 96b5d3
     /* disablement strs */ [=
Packit Service 96b5d3
    (if (exist? "disable-load") "NULL, NULL"
Packit Service 96b5d3
         "NO_LOAD_OPTS_name, LOAD_OPTS_pfx")=] }[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF have homerc                       =][=
Packit Service 96b5d3
Packit Service 96b5d3
IF (exist? "vendor-opt")                =],
Packit Service 96b5d3
Packit Service 96b5d3
  {  /* entry idx, value */ [=
Packit Service 96b5d3
        (set! default-text (string-append default-text
Packit Service 96b5d3
               "\n    { NULL }, /* vendor-opt */" ))
Packit Service 96b5d3
        (set! default-cookie (string-append default-cookie "NULL\n" ))
Packit Service 96b5d3
        INDEX-pfx =]VENDOR_OPT, [= (. VALUE-pfx) =]VENDOR_OPT,
Packit Service 96b5d3
     /* equiv idx value  */ NO_EQUIVALENT, [= (. VALUE-pfx) =]VENDOR_OPT,
Packit Service 96b5d3
     /* equivalenced to  */ NO_EQUIVALENT,
Packit Service 96b5d3
     /* min, max, act ct */ 0, NOLIMIT, 0,
Packit Service 96b5d3
     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
Packit Service 96b5d3
                          | OPTST_IMM | OPTST_TWICE, AOUSE_VENDOR_OPT,
Packit Service 96b5d3
     /* last opt argumnt */ { NULL },
Packit Service 96b5d3
     /* arg list/cookie  */ NULL,
Packit Service 96b5d3
     /* must/cannot opts */ NULL,  NULL,
Packit Service 96b5d3
     /* option proc      */ optionVendorOption,
Packit Service 96b5d3
     /* desc, NAME, name */ VEND_DESC, NULL, VEND_name,
Packit Service 96b5d3
     /* disablement strs */ NULL, NULL }[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDIF have vendor-opt                   =]
Packit Service 96b5d3
};
Packit Service 96b5d3
[=
Packit Service 96b5d3
Packit Service 96b5d3
ENDDEF emit-option-desc-table
Packit Service 96b5d3
Packit Service 96b5d3
/*
Packit Service 96b5d3
 * Local Variables:
Packit Service 96b5d3
 * mode: C
Packit Service 96b5d3
 * c-file-style: "stroustrup"
Packit Service 96b5d3
 * indent-tabs-mode: nil
Packit Service 96b5d3
 * End:
Packit Service 96b5d3
 * opthead.tpl ends here */    \=]