xref: /freebsd/contrib/ntp/sntp/ag-tpl/0-old/cmd-doc.tlib (revision 416ba5c74546f32a993436a99516d35008e9f384)
1*2b15cb3dSCy Schubert[+: -*- Mode: nroff -*-
2*2b15cb3dSCy Schubert
3*2b15cb3dSCy Schubert  AutoGen5 template man
4*2b15cb3dSCy Schubert
5*2b15cb3dSCy Schubert# cmd-doc.tlib -- Template for command line man/mdoc pages
6*2b15cb3dSCy Schubert#
7*2b15cb3dSCy Schubert#  This file is part of AutoOpts, a companion to AutoGen.
8*2b15cb3dSCy Schubert#  AutoOpts is free software.
9*2b15cb3dSCy Schubert#  Copyright (C) 1992-2013 Bruce Korb - all rights reserved
10*2b15cb3dSCy Schubert#
11*2b15cb3dSCy Schubert#  AutoOpts is available under any one of two licenses.  The license
12*2b15cb3dSCy Schubert#  in use must be one of these two and the choice is under the control
13*2b15cb3dSCy Schubert#  of the user of the license.
14*2b15cb3dSCy Schubert#
15*2b15cb3dSCy Schubert#   The GNU Lesser General Public License, version 3 or later
16*2b15cb3dSCy Schubert#      See the files "COPYING.lgplv3" and "COPYING.gplv3"
17*2b15cb3dSCy Schubert#
18*2b15cb3dSCy Schubert#   The Modified Berkeley Software Distribution License
19*2b15cb3dSCy Schubert#      See the file "COPYING.mbsd"
20*2b15cb3dSCy Schubert#
21*2b15cb3dSCy Schubert#  These files have the following sha256 sums:
22*2b15cb3dSCy Schubert#
23*2b15cb3dSCy Schubert#  8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95  COPYING.gplv3
24*2b15cb3dSCy Schubert#  4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b  COPYING.lgplv3
25*2b15cb3dSCy Schubert#  13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239  COPYING.mbsd
26*2b15cb3dSCy Schubert
27*2b15cb3dSCy Schubert# Produce a man page for section 1, 5, 6 or 8 commands.  Which is
28*2b15cb3dSCy Schubert# selected via: -DMAN_SECTION=n.  "n" may have a suffix, if desired.
29*2b15cb3dSCy Schubert# These sections have default section names that may be overridden
30*2b15cb3dSCy Schubert# with -DSECTIN_NAME=XX, also passed to the autogen invocation.
31*2b15cb3dSCy Schubert#
32*2b15cb3dSCy Schubert:+][+:
33*2b15cb3dSCy Schubert
34*2b15cb3dSCy Schubert   ;;# START-BUILDTREE-ISMS
35*2b15cb3dSCy Schubert   ;;
36*2b15cb3dSCy Schubert   (shell "CLexe=${AGexe%/agen5/*}/columns/columns
37*2b15cb3dSCy Schubert  test -x \"${CLexe}\" || {
38*2b15cb3dSCy Schubert    CLexe=${AGexe%/autogen}/columns
39*2b15cb3dSCy Schubert    test -x \"${CLexe}\" || die 'columns program is not findable'
40*2b15cb3dSCy Schubert  }")
41*2b15cb3dSCy Schubert
42*2b15cb3dSCy Schubert:+][+: # END-BUILDTREE-ISMS
43*2b15cb3dSCy Schubert
44*2b15cb3dSCy Schubert(shell "CLexe=`echo ${AGexe} | sed 's@/autogen@/columns@'`
45*2b15cb3dSCy Schubert       test -x \"${CLexe}\" || CLexe=`which columns`")
46*2b15cb3dSCy Schubert
47*2b15cb3dSCy Schubert# END-INSTALL-ONLY-CODE :+][+:
48*2b15cb3dSCy Schubert
49*2b15cb3dSCy Schubert(define down-prog-name (string-downcase! (get "prog-name")))
50*2b15cb3dSCy Schubert(define UP-PROG-NAME   (get-up-name "prog-name"))
51*2b15cb3dSCy Schubert
52*2b15cb3dSCy Schubert(define command-doc    #t)
53*2b15cb3dSCy Schubert(define tmp-val        (getenv "MAN_SECTION"))
54*2b15cb3dSCy Schubert(define man-sect       (if (exist? "cmd-section") (get "cmd-section") "1"))
55*2b15cb3dSCy Schubert(define file-name      "")
56*2b15cb3dSCy Schubert(define sect-name      "")
57*2b15cb3dSCy Schubert(define macro-name     "")
58*2b15cb3dSCy Schubert(define tmp-str        "")
59*2b15cb3dSCy Schubert(define fname-line     "")
60*2b15cb3dSCy Schubert(define use-flags      (exist? "flag.value"))
61*2b15cb3dSCy Schubert(define named-mode     (not (or use-flags (exist? "long-opts") )))
62*2b15cb3dSCy Schubert
63*2b15cb3dSCy Schubert(if (defined? 'tmp-val)
64*2b15cb3dSCy Schubert    (if (string? tmp-val)
65*2b15cb3dSCy Schubert        (set! man-sect tmp-val)))
66*2b15cb3dSCy Schubert
67*2b15cb3dSCy Schubert(define section-name
68*2b15cb3dSCy Schubert   (if (=* man-sect "1") "User Commands"
69*2b15cb3dSCy Schubert   (if (=* man-sect "5") "File Formats"
70*2b15cb3dSCy Schubert   (if (=* man-sect "6") "Games"
71*2b15cb3dSCy Schubert   (if (=* man-sect "8") "System Management"
72*2b15cb3dSCy Schubert   (error
73*2b15cb3dSCy Schubert    "the agman-cmd template only produces section 1, 5, 6 and 8 man pages")
74*2b15cb3dSCy Schubert)))))
75*2b15cb3dSCy Schubert(set! tmp-val (getenv "SECTION_NAME"))
76*2b15cb3dSCy Schubert(if (defined? 'tmp-val) (if (string? tmp-val)
77*2b15cb3dSCy Schubert    (set! section-name tmp-val) ))
78*2b15cb3dSCy Schubert
79*2b15cb3dSCy Schubert(define package-text "")
80*2b15cb3dSCy Schubert(define package+version (and (exist? "package") (exist? "version")))
81*2b15cb3dSCy Schubert
82*2b15cb3dSCy Schubert(if (or (exist? "package") (exist? "version")) (begin
83*2b15cb3dSCy Schubert  (set! package-text (string-append
84*2b15cb3dSCy Schubert        (get "package")
85*2b15cb3dSCy Schubert        (if package+version " (" "")
86*2b15cb3dSCy Schubert        (get "version")
87*2b15cb3dSCy Schubert        (if package+version ")" "") ))
88*2b15cb3dSCy Schubert) )
89*2b15cb3dSCy Schubert
90*2b15cb3dSCy Schubert(define name-to-fname (lambda (nm)
91*2b15cb3dSCy Schubert    (string-tr (string-downcase nm) " " "-") ))
92*2b15cb3dSCy Schubert
93*2b15cb3dSCy Schubert(define sect-line-fname (lambda () (begin
94*2b15cb3dSCy Schubert    (out-push-new file-name)
95*2b15cb3dSCy Schubert    (emit (string-append ".Sh \"" sect-name "\"\n"))
96*2b15cb3dSCy Schubert    (string-append "mk-" macro-name) )))
97*2b15cb3dSCy Schubert
98*2b15cb3dSCy Schubert(make-tmp-dir)
99*2b15cb3dSCy Schubert
100*2b15cb3dSCy Schubert(define home-rc-files (exist? "homerc"))
101*2b15cb3dSCy Schubert(define home-rc-text
102*2b15cb3dSCy Schubert  "\nSee \\fBOPTION PRESETS\\fP for configuration files.")
103*2b15cb3dSCy Schubert
104*2b15cb3dSCy Schubert(define environ-init  (exist? "environrc"))
105*2b15cb3dSCy Schubert(define environ-text
106*2b15cb3dSCy Schubert  "\nSee \\fBOPTION PRESETS\\fP for configuration environment variables.")
107*2b15cb3dSCy Schubert
108*2b15cb3dSCy Schubert(emit (head-line))
109*2b15cb3dSCy Schubert(dne ".\\\"  ")                       :+]
110*2b15cb3dSCy Schubert.Sh NAME
111*2b15cb3dSCy Schubert.Nm [+: prog-name                     :+]
112*2b15cb3dSCy Schubert.Nd [+: prog-title                    :+]
113*2b15cb3dSCy Schubert[+: INCLUDE "tpl-config.tlib"         :+][+:#
114*2b15cb3dSCy Schubert
115*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
116*2b15cb3dSCy Schubert.\"  B U I L D   D O C
117*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
118*2b15cb3dSCy Schubert
119*2b15cb3dSCy SchubertDEFINE build-doc                      :+][+:
120*2b15cb3dSCy Schubert
121*2b15cb3dSCy Schubert(if (not command-doc) (begin
122*2b15cb3dSCy Schubert    (set! home-rc-files #f)
123*2b15cb3dSCy Schubert    (set! home-rc-text "")
124*2b15cb3dSCy Schubert)   )                                 :+][+:
125*2b15cb3dSCy Schubert
126*2b15cb3dSCy SchubertINVOKE doc-sections                   :+][+:
127*2b15cb3dSCy SchubertINVOKE ao-sections                    :+][+:
128*2b15cb3dSCy SchubertINVOKE assemble-sections              :+][+:
129*2b15cb3dSCy Schubert
130*2b15cb3dSCy SchubertENDDEF build-doc
131*2b15cb3dSCy Schubert
132*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
133*2b15cb3dSCy Schubert.\"  A S S E M B L E   S E C T I O N S
134*2b15cb3dSCy Schubert.\"
135*2b15cb3dSCy Schubert.\" Emit the files for each section that was provided, and do conversions
136*2b15cb3dSCy Schubert.\"
137*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
138*2b15cb3dSCy Schubert
139*2b15cb3dSCy SchubertDEFINE assemble-sections    :+][+:
140*2b15cb3dSCy Schubert
141*2b15cb3dSCy Schubert(out-push-new)
142*2b15cb3dSCy Schubert
143*2b15cb3dSCy Schubert:+][+:
144*2b15cb3dSCy Schubert#.\" Insert the sections in the prescribed order
145*2b15cb3dSCy Schubert#.\" Ensure a newline between them all.  We strip blank lines,
146*2b15cb3dSCy Schubert#.\" so extra blank lines get removed.
147*2b15cb3dSCy Schubert#:+]
148*2b15cb3dSCy Schubertcvt_prog='[+:
149*2b15cb3dSCy Schubert
150*2b15cb3dSCy Schubert    (define target-form   (if man-page "man" "mdoc"))
151*2b15cb3dSCy Schubert    (define source-form   (get "option-format" "texi"))
152*2b15cb3dSCy Schubert    (define converter     (string-append source-form "2" target-form ))
153*2b15cb3dSCy Schubert    (set! tmp-str (find-file converter))
154*2b15cb3dSCy Schubert
155*2b15cb3dSCy Schubert    (if (not (defined? 'tmp-str))
156*2b15cb3dSCy Schubert        (error (string-append "cannot locate " converter)))
157*2b15cb3dSCy Schubert    tmp-str
158*2b15cb3dSCy Schubert:+]'
159*2b15cb3dSCy Schubertcvt_prog=`cd \`dirname "$cvt_prog"\` >/dev/null && pwd
160*2b15cb3dSCy Schubert         `/`basename "$cvt_prog"`
161*2b15cb3dSCy Schubertcd $tmp_dir
162*2b15cb3dSCy Schuberttest -x "$cvt_prog" || die "'$cvt_prog' is not executable"
163*2b15cb3dSCy Schubert{
164*2b15cb3dSCy Schubert    list='synopsis description options option-presets'
165*2b15cb3dSCy Schubert    for f in $list ; do cat $f ; echo ; done
166*2b15cb3dSCy Schubert    rm -f $list name
167*2b15cb3dSCy Schubert    list='implementation-notes environment files examples exit-status errors
168*2b15cb3dSCy Schubert        compatibility see-also conforming-to history authors copyright bugs
169*2b15cb3dSCy Schubert        notes'
170*2b15cb3dSCy Schubert    for f in $list ; do cat $f ; echo ; done > .end-doc
171*2b15cb3dSCy Schubert    rm -f $list
172*2b15cb3dSCy Schubert    list=`ls -1 *`' .end-doc'
173*2b15cb3dSCy Schubert    for f in $list ; do cat $f ; echo ; done
174*2b15cb3dSCy Schubert    rm -f $list
175*2b15cb3dSCy Schubert} 1>.doc 2>/dev/null
176*2b15cb3dSCy Schubert[+:
177*2b15cb3dSCy SchubertIF (exist? "doc-sub")       :+][+:
178*2b15cb3dSCy Schubert  (out-push-new (string-append tmp-dir "/.cmds")) :+][+:
179*2b15cb3dSCy Schubert  FOR doc-sub               :+][+:
180*2b15cb3dSCy Schubert
181*2b15cb3dSCy Schubert    IF (define field-name (get "sub-type" target-form))
182*2b15cb3dSCy Schubert       (~~ target-form field-name)  :+][+:
183*2b15cb3dSCy Schubert
184*2b15cb3dSCy Schubert       (set! field-name (get "sub-name"))
185*2b15cb3dSCy Schubert       (define rep-string (string-append "<<" field-name ">>"))
186*2b15cb3dSCy Schubert       (emit (string-substitute (get "sub-text") rep-string (get field-name)))
187*2b15cb3dSCy Schubert       "\n"
188*2b15cb3dSCy Schubert
189*2b15cb3dSCy Schubert    :+][+:  ENDIF           :+][+:
190*2b15cb3dSCy Schubert
191*2b15cb3dSCy Schubert  ENDFOR doc-sub            :+][+:
192*2b15cb3dSCy Schubert
193*2b15cb3dSCy Schubert  (out-pop)
194*2b15cb3dSCy Schubert  (define post-proc-cmd (string-append
195*2b15cb3dSCy Schubert          (get "doc-sub-cmd" "sed -f %s %s") " | "
196*2b15cb3dSCy Schubert          egrep-prog " -v '^[ 	]*$' | $cvt_prog"))
197*2b15cb3dSCy Schubert  (sprintf post-proc-cmd ".cmds" ".doc")
198*2b15cb3dSCy Schubert  :+][+:
199*2b15cb3dSCy SchubertELSE                       \:+]
200*2b15cb3dSCy Schubert[+:(. egrep-prog):+] -v '^[ 	]*$' .doc | $cvt_prog[+:
201*2b15cb3dSCy SchubertENDIF doc-sub exists        :+][+:
202*2b15cb3dSCy Schubert
203*2b15cb3dSCy Schubert(shell (out-pop #t))        :+][+:
204*2b15cb3dSCy Schubert
205*2b15cb3dSCy SchubertENDDEF assemble-sections
206*2b15cb3dSCy Schubert
207*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
208*2b15cb3dSCy Schubert.\"  D O C   S E C T I O N S
209*2b15cb3dSCy Schubert.\"
210*2b15cb3dSCy Schubert.\" Emit the files for each section that was provided.
211*2b15cb3dSCy Schubert.\" If multiple sections exist, they get glued together with ".Pp"
212*2b15cb3dSCy Schubert.\" between them.
213*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
214*2b15cb3dSCy Schubert
215*2b15cb3dSCy SchubertDEFINE doc-sections                   :+][+:
216*2b15cb3dSCy Schubert
217*2b15cb3dSCy SchubertFOR doc-section                       :+][+:
218*2b15cb3dSCy Schubert  IF
219*2b15cb3dSCy Schubert    (define sec-type (string-upcase (get "ds-type")))
220*2b15cb3dSCy Schubert    (define sec-name (name-to-fname sec-type))
221*2b15cb3dSCy Schubert    (define cvt-fn (find-file (string-append
222*2b15cb3dSCy Schubert         (get "ds-format" "man") "2mdoc")))
223*2b15cb3dSCy Schubert    (if (not (defined? 'cvt-fn))
224*2b15cb3dSCy Schubert        (error (sprintf "Cannot locate converter for %s"
225*2b15cb3dSCy Schubert               (get "ds-format" "man"))))
226*2b15cb3dSCy Schubert
227*2b15cb3dSCy Schubert    (define sec-file (string-append tmp-dir "/" sec-name))
228*2b15cb3dSCy Schubert    (access? sec-file R_OK)           :+][+:
229*2b15cb3dSCy Schubert        (out-push-add sec-file)
230*2b15cb3dSCy Schubert        (emit ".Pp\n")                :+][+:
231*2b15cb3dSCy Schubert
232*2b15cb3dSCy Schubert  ELSE :+][+: CASE
233*2b15cb3dSCy Schubert    (out-push-new sec-file)
234*2b15cb3dSCy Schubert    sec-type :+][+:
235*2b15cb3dSCy Schubert
236*2b15cb3dSCy Schubert    == ""    :+][+: (error "unnamed doc-section") :+][+:
237*2b15cb3dSCy Schubert    *==* " " :+].Sh "[+: (. sec-type)             :+]"[+:
238*2b15cb3dSCy Schubert    *        :+].Sh [+: (. sec-type)              :+][+:
239*2b15cb3dSCy Schubert    ESAC     :+][+:
240*2b15cb3dSCy Schubert  ENDIF :+]
241*2b15cb3dSCy Schubert[+:
242*2b15cb3dSCy Schubert    (shell (string-append
243*2b15cb3dSCy Schubert      "fn='" cvt-fn "'\n"
244*2b15cb3dSCy Schubert      "test -f ${fn} || die ${fn} not found from $PWD\n"
245*2b15cb3dSCy Schubert      "${fn} <<\\_EndOfDocSection_ || die ${fn} failed in $PWD\n"
246*2b15cb3dSCy Schubert      (get "ds-text")
247*2b15cb3dSCy Schubert      "\n_EndOfDocSection_"
248*2b15cb3dSCy Schubert    ))                                :+][+:
249*2b15cb3dSCy Schubert
250*2b15cb3dSCy Schubert    CASE (emit "\n") sec-type         :+][+:
251*2b15cb3dSCy Schubert    == FILES                          :+][+:
252*2b15cb3dSCy Schubert        (if home-rc-files (emit home-rc-text))
253*2b15cb3dSCy Schubert        (set! home-rc-files #f)       :+][+:
254*2b15cb3dSCy Schubert
255*2b15cb3dSCy Schubert    == ENVIRONMENT                    :+][+:
256*2b15cb3dSCy Schubert        (if environ-init (emit environ-text))
257*2b15cb3dSCy Schubert        (set! environ-init #f)        :+][+:
258*2b15cb3dSCy Schubert    ESAC                              :+][+:
259*2b15cb3dSCy Schubert
260*2b15cb3dSCy Schubert    (out-pop)
261*2b15cb3dSCy Schubert    :+][+:
262*2b15cb3dSCy Schubert
263*2b15cb3dSCy SchubertENDFOR doc-section                    :+][+:
264*2b15cb3dSCy Schubert
265*2b15cb3dSCy SchubertENDDEF doc-sections
266*2b15cb3dSCy Schubert
267*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
268*2b15cb3dSCy Schubert.\"  A O   S E C T I O N S
269*2b15cb3dSCy Schubert.\"
270*2b15cb3dSCy Schubert.\" Emit the files for the sections that these templates augment,
271*2b15cb3dSCy Schubert.\" replace or conditionally replace
272*2b15cb3dSCy Schubert.\"
273*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
274*2b15cb3dSCy Schubert
275*2b15cb3dSCy SchubertDEFINE ao-sections              :+][+:
276*2b15cb3dSCy Schubert  IF (. command-doc)            :+][+:
277*2b15cb3dSCy Schubert    INVOKE cond-section  sec = "OPTIONS"       mode = "replace"       :+][+:
278*2b15cb3dSCy Schubert    INVOKE cond-section  sec = "EXIT STATUS"   mode = "insert"        :+][+:
279*2b15cb3dSCy Schubert
280*2b15cb3dSCy Schubert    IF (or home-rc-files environ-init)                                :+][+:
281*2b15cb3dSCy Schubert      INVOKE cond-section   sec = "OPTION PRESETS" mode = "replace"   :+][+:
282*2b15cb3dSCy Schubert
283*2b15cb3dSCy Schubert      IF (. home-rc-files)                                            :+][+:
284*2b15cb3dSCy Schubert        INVOKE cond-section sec = "FILES"          mode = "append"    :+][+:
285*2b15cb3dSCy Schubert      ENDIF                                                           :+][+:
286*2b15cb3dSCy Schubert
287*2b15cb3dSCy Schubert      IF (. environ-init)                                             :+][+:
288*2b15cb3dSCy Schubert        INVOKE cond-section sec = "ENVIRONMENT"    mode = "append"    :+][+:
289*2b15cb3dSCy Schubert      ENDIF                                                           :+][+:
290*2b15cb3dSCy Schubert    ENDIF                                                             :+][+:
291*2b15cb3dSCy Schubert
292*2b15cb3dSCy Schubert  ELSE  section 5, not command  :+][+:
293*2b15cb3dSCy Schubert    INVOKE cond-section sec = "FILES"          mode = "append"        :+][+:
294*2b15cb3dSCy Schubert  ENDIF  section 5/not          :+][+:
295*2b15cb3dSCy Schubert
296*2b15cb3dSCy Schubert  INVOKE cond-section  sec = "SYNOPSIS"        mode = "alt"           :+][+:
297*2b15cb3dSCy Schubert  INVOKE cond-section  sec = "DESCRIPTION"     mode = "append"        :+][+:
298*2b15cb3dSCy Schubert  INVOKE cond-section  sec = "AUTHORS"         mode = "alt"           :+][+:
299*2b15cb3dSCy Schubert  INVOKE cond-section  sec = "BUGS"            mode = "append"        :+][+:
300*2b15cb3dSCy Schubert  INVOKE cond-section  sec = "NOTES"           mode = "append"        :+][+:
301*2b15cb3dSCy Schubert
302*2b15cb3dSCy SchubertIF (exist? "copyright")                                               :+][+:
303*2b15cb3dSCy Schubert  INVOKE cond-section   sec = "COPYRIGHT"      mode = "alt"           :+][+:
304*2b15cb3dSCy SchubertENDIF                                                                 :+][+:
305*2b15cb3dSCy Schubert
306*2b15cb3dSCy SchubertENDDEF ao-sections
307*2b15cb3dSCy Schubert
308*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
309*2b15cb3dSCy Schubert.\"  C O N D I T I O N A L   S E C T I O N
310*2b15cb3dSCy Schubert.\"
311*2b15cb3dSCy Schubert.\" Figure out what to do for AutoOpts required sections, depending on "mode"
312*2b15cb3dSCy Schubert.\" In all cases, if the file does not exist, invoke the "mk" macro to create
313*2b15cb3dSCy Schubert.\" a new file.  If it does exist, then:
314*2b15cb3dSCy Schubert.\"
315*2b15cb3dSCy Schubert.\" alt       Alternate -- emit no text
316*2b15cb3dSCy Schubert.\" replace   throw away any pre-existing file.
317*2b15cb3dSCy Schubert.\" append    invoke the "append" macro to emit additional text
318*2b15cb3dSCy Schubert.\" insert    save the current contents, replacing the .Sh line with .Pp.
319*2b15cb3dSCy Schubert.\"           invoke the "mk" macro then emit the saved text
320*2b15cb3dSCy Schubert.\"
321*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
322*2b15cb3dSCy Schubert
323*2b15cb3dSCy SchubertDEFINE cond-section                     :+][+:
324*2b15cb3dSCy Schubert
325*2b15cb3dSCy Schubert  IF
326*2b15cb3dSCy Schubert     (set! sect-name   (string-upcase! (string-substitute
327*2b15cb3dSCy Schubert                       (get "sec") "-" " " )))
328*2b15cb3dSCy Schubert     (set! macro-name  (string-downcase! (string-substitute
329*2b15cb3dSCy Schubert                       sect-name " " "-" )))
330*2b15cb3dSCy Schubert     (set! file-name   (string-append tmp-dir "/" macro-name))
331*2b15cb3dSCy Schubert
332*2b15cb3dSCy Schubert     (not (access? file-name R_OK))     :+][+:
333*2b15cb3dSCy Schubert
334*2b15cb3dSCy Schubert     INVOKE (sect-line-fname)           :+][+:
335*2b15cb3dSCy Schubert
336*2b15cb3dSCy Schubert  ELSE file exists                      :+][+:
337*2b15cb3dSCy Schubert
338*2b15cb3dSCy Schubert     CASE (get "mode")                  :+][+:
339*2b15cb3dSCy Schubert
340*2b15cb3dSCy Schubert     ==  replace                        :+][+:
341*2b15cb3dSCy Schubert         INVOKE (sect-line-fname)       :+][+:
342*2b15cb3dSCy Schubert
343*2b15cb3dSCy Schubert     ==  append                         :+][+:
344*2b15cb3dSCy Schubert         (out-push-add file-name)       :+][+:
345*2b15cb3dSCy Schubert         INVOKE (string-append "append-" macro-name) :+][+:
346*2b15cb3dSCy Schubert
347*2b15cb3dSCy Schubert     ==  insert                         :+][+:
348*2b15cb3dSCy Schubert         (set! fname-line (shellf
349*2b15cb3dSCy Schubert           "sed '1s/.Sh .*/.Pp/' %1$s ; rm -f %1$s" file-name)) :+][+:
350*2b15cb3dSCy Schubert         INVOKE (sect-line-fname)       :+][+:
351*2b15cb3dSCy Schubert
352*2b15cb3dSCy Schubert     ==  alt                            :+][+:
353*2b15cb3dSCy Schubert         (out-push-new)                 :+][+:
354*2b15cb3dSCy Schubert
355*2b15cb3dSCy Schubert     *                                  :+][+:
356*2b15cb3dSCy Schubert         (error (sprintf "invalid section type: %s" (get "mode")))
357*2b15cb3dSCy Schubert
358*2b15cb3dSCy Schubert     :+][+:
359*2b15cb3dSCy Schubert     ESAC                               :+][+:
360*2b15cb3dSCy Schubert
361*2b15cb3dSCy Schubert  ENDIF file existence/non-existence    :+][+:
362*2b15cb3dSCy Schubert  (out-pop) :+][+: # All paths open out :+][+:
363*2b15cb3dSCy SchubertENDDEF cond-section
364*2b15cb3dSCy Schubert
365*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
366*2b15cb3dSCy Schubert.\"  M K - D E S C R I P T I O N
367*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
368*2b15cb3dSCy Schubert
369*2b15cb3dSCy SchubertDEFINE mk-description                   :+][+:
370*2b15cb3dSCy Schubert
371*2b15cb3dSCy Schubert   (out-push-new)
372*2b15cb3dSCy Schubert   (emit
373*2b15cb3dSCy Schubert     (if (exist? "prog-man-descrip")
374*2b15cb3dSCy Schubert         (stack-join "\n.Pp\n" "prog-man-descrip")
375*2b15cb3dSCy Schubert         (if (exist? "detail")
376*2b15cb3dSCy Schubert             (stack-join "\n.Pp\n" "detail")
377*2b15cb3dSCy Schubert             "There is no description for this command."
378*2b15cb3dSCy Schubert   ) )   )
379*2b15cb3dSCy Schubert   (shell "sed 's/^$/.sp/' <<\\_EODesc_\n" (out-pop #t) "\n_EODesc_")
380*2b15cb3dSCy Schubert
381*2b15cb3dSCy Schubert   :+][+:
382*2b15cb3dSCy Schubert   INVOKE append-description            :+][+:
383*2b15cb3dSCy Schubert
384*2b15cb3dSCy SchubertENDDEF mk-description
385*2b15cb3dSCy Schubert
386*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = =
387*2b15cb3dSCy Schubert.\"  A P P E N D - D E S C R I P T I O N
388*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = :+][+:
389*2b15cb3dSCy Schubert
390*2b15cb3dSCy SchubertDEFINE append-description               :+][+:
391*2b15cb3dSCy Schubert
392*2b15cb3dSCy SchubertIF (= (get "main.main-type") "for-each"):+][+:
393*2b15cb3dSCy Schubert
394*2b15cb3dSCy Schubert  CASE main.handler-type                :+][+:
395*2b15cb3dSCy Schubert  ~* ^(name|file)|.*text               \:+]
396*2b15cb3dSCy Schubert.Pp
397*2b15cb3dSCy SchubertThis program will perform its function for every file named on the command
398*2b15cb3dSCy Schubertline or every file named in a list read from stdin.  The arguments or input
399*2b15cb3dSCy Schubertnames must be pre\-existing files.  The input list may contain comments,
400*2b15cb3dSCy Schubertwhich[+:
401*2b15cb3dSCy Schubert
402*2b15cb3dSCy Schubert  !E                                   \:+]
403*2b15cb3dSCy Schubert.Pp
404*2b15cb3dSCy SchubertThis program will perform its function for every command line argument
405*2b15cb3dSCy Schubertor every non\-comment line in a list read from stdin.
406*2b15cb3dSCy SchubertThe input list comments[+:
407*2b15cb3dSCy Schubert
408*2b15cb3dSCy Schubert  *                                     :+][+:
409*2b15cb3dSCy Schubert  (error "the 'for-each' main has in invalid handler-type.") :+][+:
410*2b15cb3dSCy Schubert  ESAC                                 \:+]
411*2b15cb3dSCy Schubert are blank lines or lines beginning with a '[+:
412*2b15cb3dSCy Schubert  ?% comment-char "%s" "#" :+]' character.
413*2b15cb3dSCy Schubert[+:
414*2b15cb3dSCy Schubert
415*2b15cb3dSCy SchubertENDIF - "main" is of "for-each" type    :+][+:
416*2b15cb3dSCy Schubert
417*2b15cb3dSCy SchubertENDDEF append-description
418*2b15cb3dSCy Schubert
419*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
420*2b15cb3dSCy Schubert.\"  M K - O P T I O N S
421*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
422*2b15cb3dSCy Schubert
423*2b15cb3dSCy SchubertDEFINE mk-options
424*2b15cb3dSCy Schubert
425*2b15cb3dSCy Schubert:+][+:
426*2b15cb3dSCy Schubert
427*2b15cb3dSCy Schubert(define opt-arg       "")
428*2b15cb3dSCy Schubert(define dis-name      "")
429*2b15cb3dSCy Schubert(define opt-name      "")
430*2b15cb3dSCy Schubert(define optname-from  "A-Z_^")
431*2b15cb3dSCy Schubert(define optname-to    "a-z--")
432*2b15cb3dSCy Schubert(define cvt-cmd       "")
433*2b15cb3dSCy Schubert(define formatted-doc (exist? "option-format"))
434*2b15cb3dSCy Schubert
435*2b15cb3dSCy Schubert(if formatted-doc (begin
436*2b15cb3dSCy Schubert    (out-push-new)
437*2b15cb3dSCy Schubert    (set! cvt-cmd (string-append (get "option-format") "2mdoc"))
438*2b15cb3dSCy Schubert)   )
439*2b15cb3dSCy Schubert
440*2b15cb3dSCy Schubert(if (exist? "preserve-case")
441*2b15cb3dSCy Schubert   (begin
442*2b15cb3dSCy Schubert      (set! optname-from "_^")
443*2b15cb3dSCy Schubert      (set! optname-to   "--")
444*2b15cb3dSCy Schubert)  )
445*2b15cb3dSCy Schubert
446*2b15cb3dSCy Schubert(define fix-optname (lambda (o_nm) (begin
447*2b15cb3dSCy Schubert   (set! o_nm (string-tr o_nm optname-from optname-to))
448*2b15cb3dSCy Schubert   (set! o_nm (string-substitute o_nm "-" "\\-" ))
449*2b15cb3dSCy Schubert   o_nm )))
450*2b15cb3dSCy Schubert
451*2b15cb3dSCy Schubert(if (exist? "option-info")
452*2b15cb3dSCy Schubert    (string-append ".Pp\n" (get "option-info") "\n") )
453*2b15cb3dSCy Schubert\:+]
454*2b15cb3dSCy Schubert.Bl -tag[+:
455*2b15cb3dSCy Schubert
456*2b15cb3dSCy SchubertFOR flag                              :+][+:
457*2b15cb3dSCy Schubert  IF (not (exist? "documentation"))   :+][+:
458*2b15cb3dSCy Schubert    IF (exist? "aliases")             :+][+:
459*2b15cb3dSCy Schubert      INVOKE emit-alias-opt           :+][+:
460*2b15cb3dSCy Schubert    ELSE                              :+][+:
461*2b15cb3dSCy Schubert      INVOKE emit-flag-text           :+][+:
462*2b15cb3dSCy Schubert    ENDIF                             :+][+:
463*2b15cb3dSCy Schubert
464*2b15cb3dSCy Schubert  ELSE                                :+]
465*2b15cb3dSCy Schubert.Ss "[+: (get "descrip" "") :+]"[+:
466*2b15cb3dSCy Schubert(set! tmp-str (get "documentation" ""))
467*2b15cb3dSCy Schubert(if (> (string-length tmp-str) 3) (string-append
468*2b15cb3dSCy Schubert    "\n" tmp-str "\n" ))              :+][+:
469*2b15cb3dSCy Schubert
470*2b15cb3dSCy Schubert  ENDIF                               :+][+:
471*2b15cb3dSCy SchubertENDFOR flag
472*2b15cb3dSCy Schubert
473*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = =
474*2b15cb3dSCy Schubert.\"  help option
475*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = =
476*2b15cb3dSCy Schubert
477*2b15cb3dSCy Schubert:+]
478*2b15cb3dSCy Schubert.It [+:
479*2b15cb3dSCy Schubert  (define tmp-val (get "help-value" "\\&?"))
480*2b15cb3dSCy Schubert  (if (and use-flags (> (string-length tmp-val) 0))
481*2b15cb3dSCy Schubert      (string-append "Fl " tmp-val
482*2b15cb3dSCy Schubert            (if (exist? "long-opts") " , Fl -help" "") )
483*2b15cb3dSCy Schubert      (string-append (if (exist? "long-opts") "Fl -" "") "help" )
484*2b15cb3dSCy Schubert  )  \:+]
485*2b15cb3dSCy Schubert
486*2b15cb3dSCy SchubertDisplay usage information and exit.[+:#
487*2b15cb3dSCy Schubert
488*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = =
489*2b15cb3dSCy Schubert.\"  more-help option
490*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = :+][+:
491*2b15cb3dSCy Schubert
492*2b15cb3dSCy Schubert  IF (not (exist? "no-libopts")) :+]
493*2b15cb3dSCy Schubert.It [+:
494*2b15cb3dSCy Schubert  (define tmp-val (get "more-help-value" "\\&!"))
495*2b15cb3dSCy Schubert  (if (and use-flags (> (string-length tmp-val) 0))
496*2b15cb3dSCy Schubert      (string-append "Fl " tmp-val
497*2b15cb3dSCy Schubert            (if (exist? "long-opts") " , Fl -more-help" "") )
498*2b15cb3dSCy Schubert      (string-append (if (exist? "long-opts") "Fl -" "") "more-help" )
499*2b15cb3dSCy Schubert  )       \:+]
500*2b15cb3dSCy Schubert
501*2b15cb3dSCy SchubertPass the extended usage information through a pager.[+:
502*2b15cb3dSCy Schubert
503*2b15cb3dSCy SchubertENDIF no no-libopts
504*2b15cb3dSCy Schubert
505*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = =
506*2b15cb3dSCy Schubert.\"  save and load configuration
507*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = :+][+:
508*2b15cb3dSCy Schubert
509*2b15cb3dSCy SchubertIF (exist? "homerc") :+]
510*2b15cb3dSCy Schubert.It [+:
511*2b15cb3dSCy Schubert
512*2b15cb3dSCy Schubert  IF (not (exist? "disable-save"))    :+][+:
513*2b15cb3dSCy Schubert
514*2b15cb3dSCy Schubert  (define tmp-val (get "save-opts-value" ">"))
515*2b15cb3dSCy Schubert  (if (and use-flags (> (string-length tmp-val) 0))
516*2b15cb3dSCy Schubert      (string-append "Fl " tmp-val " Oo Ar cfgfile Oc"
517*2b15cb3dSCy Schubert            (if (exist? "long-opts")
518*2b15cb3dSCy Schubert                " , Fl -save-opts Oo Ns = Ns Ar cfgfile Oc" ) "")
519*2b15cb3dSCy Schubert      (string-append (if (exist? "long-opts") "Fl -" "")
520*2b15cb3dSCy Schubert            "save-opts Oo Ns = Ns Ar cfgfile Oc" )
521*2b15cb3dSCy Schubert  )       \:+]
522*2b15cb3dSCy Schubert
523*2b15cb3dSCy SchubertSave the option state to \fIcfgfile\fP.  The default is the \fIlast\fP
524*2b15cb3dSCy Schubertconfiguration file listed in the \fBOPTION PRESETS\fP section, below.
525*2b15cb3dSCy SchubertThe command will exit after updating the config file.
526*2b15cb3dSCy Schubert.It [+:
527*2b15cb3dSCy Schubert  ENDIF  saving not disabled          :+][+:
528*2b15cb3dSCy Schubert
529*2b15cb3dSCy Schubert  (define tmp-val (get "load-opts-value" "<"))
530*2b15cb3dSCy Schubert  (define tmp-str (if (exist? "long-opts") "Fl -" ""))
531*2b15cb3dSCy Schubert
532*2b15cb3dSCy Schubert  (if (and use-flags (> (string-length tmp-val) 0))
533*2b15cb3dSCy Schubert      (string-append "Fl " tmp-val " Ar cfgfile"
534*2b15cb3dSCy Schubert         (if (exist? "long-opts")
535*2b15cb3dSCy Schubert             (string-append " , " tmp-str "load-opts Ns = Ns Ar cfgfile"
536*2b15cb3dSCy Schubert                            " , " tmp-str "no-load-opts" )
537*2b15cb3dSCy Schubert             "") )
538*2b15cb3dSCy Schubert      (string-append tmp-str "load-opts Ns = Ns Ar cfgfile , "
539*2b15cb3dSCy Schubert                     tmp-str "no-load-opts" )
540*2b15cb3dSCy Schubert  )       \:+]
541*2b15cb3dSCy Schubert
542*2b15cb3dSCy SchubertLoad options from \fIcfgfile\fP.
543*2b15cb3dSCy SchubertThe \fIno-load-opts\fP form will disable the loading
544*2b15cb3dSCy Schubertof earlier config/rc/ini files.  \fI\-\-no-load-opts\fP is handled early,
545*2b15cb3dSCy Schubertout of order.[+:
546*2b15cb3dSCy Schubert
547*2b15cb3dSCy SchubertENDIF (exist? "homerc")
548*2b15cb3dSCy Schubert
549*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = =
550*2b15cb3dSCy Schubert.\"  version
551*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = :+][+:
552*2b15cb3dSCy Schubert
553*2b15cb3dSCy SchubertIF (exist? "version") :+]
554*2b15cb3dSCy Schubert.It [+:
555*2b15cb3dSCy Schubert
556*2b15cb3dSCy Schubert  (define tmp-val (get "version-value" "v"))
557*2b15cb3dSCy Schubert  (if (and use-flags (> (string-length tmp-val) 0))
558*2b15cb3dSCy Schubert      (string-append "Fl " tmp-val " Op Brq Ar v|c|n"
559*2b15cb3dSCy Schubert            (if (exist? "long-opts")
560*2b15cb3dSCy Schubert                "  Fl -version Op Brq Ar v|c|n" ) "")
561*2b15cb3dSCy Schubert      (string-append (if (exist? "long-opts") "Fl -" "")
562*2b15cb3dSCy Schubert            "version Op Brq Ar v|c|n" )
563*2b15cb3dSCy Schubert  )       \:+]
564*2b15cb3dSCy Schubert
565*2b15cb3dSCy SchubertOutput version of program and exit.  The default mode is `v', a simple
566*2b15cb3dSCy Schubertversion.  The `c' mode will print copyright information and `n' will
567*2b15cb3dSCy Schubertprint the full copyright notice.[+:
568*2b15cb3dSCy SchubertENDIF                                 :+]
569*2b15cb3dSCy Schubert.El
570*2b15cb3dSCy Schubert[+:
571*2b15cb3dSCy Schubert
572*2b15cb3dSCy Schubert(if formatted-doc
573*2b15cb3dSCy Schubert    (shell (string-append
574*2b15cb3dSCy Schubert    "fn='" (find-file cvt-cmd)
575*2b15cb3dSCy Schubert    "'\ntest -f ${fn} || die '" cvt-cmd " not found'\n"
576*2b15cb3dSCy Schubert    "${fn} <<\\_EndOfMdoc_ || die ${fn} failed in $PWD\n"
577*2b15cb3dSCy Schubert    (out-pop #t)
578*2b15cb3dSCy Schubert    "\n_EndOfMdoc_" )) )           :+][+:
579*2b15cb3dSCy Schubert
580*2b15cb3dSCy SchubertENDDEF mk-options
581*2b15cb3dSCy Schubert
582*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
583*2b15cb3dSCy Schubert.\"  M K - O P T I O N - P R E S E T S
584*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
585*2b15cb3dSCy Schubert
586*2b15cb3dSCy SchubertDEFINE mk-option-presets              \:+]
587*2b15cb3dSCy SchubertAny option that is not marked as \fInot presettable\fP may be preset
588*2b15cb3dSCy Schubertby loading values from [+:
589*2b15cb3dSCy Schubert  IF (. home-rc-files)
590*2b15cb3dSCy Schubert    :+]configuration ("RC" or ".INI") file(s)[+:
591*2b15cb3dSCy Schubert    IF (. environ-init) :+] and values from
592*2b15cb3dSCy Schubert[+:
593*2b15cb3dSCy Schubert    ENDIF                             :+][+:
594*2b15cb3dSCy Schubert  ENDIF                               :+][+:
595*2b15cb3dSCy Schubert  IF (. environ-init) :+]environment variables named:
596*2b15cb3dSCy Schubert.nf
597*2b15cb3dSCy Schubert  \fB[+:(. UP-PROG-NAME):+]_<option-name>\fP or \fB[+:(. UP-PROG-NAME):+]\fP
598*2b15cb3dSCy Schubert.fi
599*2b15cb3dSCy Schubert.ad[+:
600*2b15cb3dSCy Schubert    IF (. home-rc-files)              :+]
601*2b15cb3dSCy SchubertThe environmental presets take precedence (are processed later than)
602*2b15cb3dSCy Schubertthe configuration files.[+:
603*2b15cb3dSCy Schubert    ENDIF                             :+][+:
604*2b15cb3dSCy Schubert  ELSE                                :+].[+:
605*2b15cb3dSCy Schubert  ENDIF                               :+][+:
606*2b15cb3dSCy Schubert
607*2b15cb3dSCy Schubert  CASE
608*2b15cb3dSCy Schubert    (define rc-file
609*2b15cb3dSCy Schubert       (get "rcfile" (string-append "." (get "prog-name") "rc")) )
610*2b15cb3dSCy Schubert    (count "homerc")                  :+][+:
611*2b15cb3dSCy Schubert
612*2b15cb3dSCy Schubert  == "0"                              :+][+:
613*2b15cb3dSCy Schubert  == "1"                              :+][+:
614*2b15cb3dSCy Schubert
615*2b15cb3dSCy Schubert    CASE homerc                       :+][+:
616*2b15cb3dSCy Schubert    ~~ '\.|\$HOME'                    :+]
617*2b15cb3dSCy SchubertThe file "\fI[+: (string-append (get "homerc") "/" rc-file)
618*2b15cb3dSCy Schubert:+]\fP" will be used, if present.[+:
619*2b15cb3dSCy Schubert
620*2b15cb3dSCy Schubert    == ""                             :+][+:
621*2b15cb3dSCy Schubert
622*2b15cb3dSCy Schubert    *                                 :+]
623*2b15cb3dSCy SchubertThe \fIhomerc\fP file is "\fI[+:homerc:+]\fP", unless that is a directory.
624*2b15cb3dSCy SchubertIn that case, the file "\fI[+: (. rc-file) :+]\fP"
625*2b15cb3dSCy Schubertis searched for within that directory.[+:
626*2b15cb3dSCy Schubert    ESAC                              :+][+:
627*2b15cb3dSCy Schubert
628*2b15cb3dSCy Schubert  *                                   :+]
629*2b15cb3dSCy SchubertThe \fIhomerc\fP files are [+:
630*2b15cb3dSCy Schubert    FOR homerc ", "                   :+][+:
631*2b15cb3dSCy Schubert      IF (last-for?)                  :+]and [+:
632*2b15cb3dSCy Schubert      ENDIF :+]"\fI[+: homerc :+]\fP"[+: ENDFOR :+].
633*2b15cb3dSCy SchubertIf any of these are directories, then the file \fI[+: (. rc-file) :+]\fP
634*2b15cb3dSCy Schubertis searched for within those directories.[+:
635*2b15cb3dSCy Schubert  ESAC                                :+][+:
636*2b15cb3dSCy Schubert
637*2b15cb3dSCy SchubertENDDEF mk-option-presets
638*2b15cb3dSCy Schubert
639*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
640*2b15cb3dSCy Schubert.\"  M K - E X I T - S T A T U S
641*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
642*2b15cb3dSCy Schubert
643*2b15cb3dSCy SchubertDEFINE mk-exit-status                \:+]
644*2b15cb3dSCy SchubertOne of the following exit values will be returned:
645*2b15cb3dSCy Schubert.Bl -tag
646*2b15cb3dSCy Schubert[+:
647*2b15cb3dSCy Schubert(ag-fprintf 0 ".It 0 \" (EXIT_%s)\"\n%s\n"
648*2b15cb3dSCy Schubert    (string->c-name! (string-upcase (get "exit-name[0]" "SUCCESS")))
649*2b15cb3dSCy Schubert    (get "exit-desc[0]" "Successful program execution.") )
650*2b15cb3dSCy Schubert
651*2b15cb3dSCy Schubert(define need-ex-noinput  (exist? "homerc"))
652*2b15cb3dSCy Schubert(define need-ex-software #t)
653*2b15cb3dSCy Schubert
654*2b15cb3dSCy Schubert(ag-fprintf 0 ".It 1 \" (EXIT_%s)\"\n%s\n"
655*2b15cb3dSCy Schubert    (string->c-name! (string-upcase (get "exit-name[1]" "FAILURE")))
656*2b15cb3dSCy Schubert    (get "exit-desc[1]"
657*2b15cb3dSCy Schubert    "The operation failed or the command syntax was not valid.")) :+][+:
658*2b15cb3dSCy Schubert
659*2b15cb3dSCy SchubertFOR exit-desc (for-from 2)            :+][+:
660*2b15cb3dSCy Schubert  (if (= (for-index) 66)
661*2b15cb3dSCy Schubert      (set! need-ex-noinput  #f)
662*2b15cb3dSCy Schubert      (if (= (for-index) 70)
663*2b15cb3dSCy Schubert          (set! need-ex-software #f) ))
664*2b15cb3dSCy Schubert
665*2b15cb3dSCy Schubert  (set! tmp-str (get (sprintf "exit-name[%d]" (for-index)) "* unnamed *"))
666*2b15cb3dSCy Schubert  (sprintf ".It %d \" (EXIT_%s)\"\n%s\n"
667*2b15cb3dSCy Schubert    (for-index)
668*2b15cb3dSCy Schubert    (string-upcase (string->c-name! tmp-str))
669*2b15cb3dSCy Schubert    (get "exit-desc" ""))             :+][+:
670*2b15cb3dSCy SchubertENDFOR exit-desc                      :+][+:
671*2b15cb3dSCy Schubert(if need-ex-noinput
672*2b15cb3dSCy Schubert    (emit ".It 66 \" (EX_NOINPUT)\"
673*2b15cb3dSCy SchubertA specified configuration file could not be loaded.\n"))
674*2b15cb3dSCy Schubert
675*2b15cb3dSCy Schubert(if need-ex-software
676*2b15cb3dSCy Schubert    (emit ".It 70 \" (EX_SOFTWARE)\"
677*2b15cb3dSCy Schubertlibopts had an internal operational error.  Please report
678*2b15cb3dSCy Schubertit to autogen-users@lists.sourceforge.net.  Thank you.\n"))
679*2b15cb3dSCy Schubert
680*2b15cb3dSCy Schubert(if (> (string-length fname-line) 1)
681*2b15cb3dSCy Schubert    (emit fname-line))                :+]
682*2b15cb3dSCy Schubert.El
683*2b15cb3dSCy Schubert[+:
684*2b15cb3dSCy Schubert
685*2b15cb3dSCy SchubertENDDEF mk-exit-status
686*2b15cb3dSCy Schubert
687*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
688*2b15cb3dSCy Schubert.\"  M K - A U T H O R S
689*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
690*2b15cb3dSCy Schubert
691*2b15cb3dSCy SchubertDEFINE mk-authors                     :+][+:
692*2b15cb3dSCy Schubert
693*2b15cb3dSCy Schubert  (define remove-authors #t)
694*2b15cb3dSCy Schubert
695*2b15cb3dSCy Schubert  (set! tmp-val
696*2b15cb3dSCy Schubert      (if (exist? "copyright.author")
697*2b15cb3dSCy Schubert          (stack-join ",\n" "copyright.author")
698*2b15cb3dSCy Schubert          (stack-join ",\n" "copyright.owner") ))
699*2b15cb3dSCy Schubert
700*2b15cb3dSCy Schubert  (if (> (string-length tmp-val) 1)
701*2b15cb3dSCy Schubert      (string-append tmp-val "\n")
702*2b15cb3dSCy Schubert      (delete-file file-name))
703*2b15cb3dSCy Schubert
704*2b15cb3dSCy Schubert  :+][+:
705*2b15cb3dSCy Schubert
706*2b15cb3dSCy SchubertENDDEF mk-authors
707*2b15cb3dSCy Schubert
708*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
709*2b15cb3dSCy Schubert.\"  M K - B U G S
710*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
711*2b15cb3dSCy Schubert
712*2b15cb3dSCy SchubertDEFINE mk-bugs                        :+][+:
713*2b15cb3dSCy Schubert
714*2b15cb3dSCy Schubert    (set! tmp-val (get "copyright.eaddr" (get "eaddr")))
715*2b15cb3dSCy Schubert    (if (> (string-length tmp-val) 1)
716*2b15cb3dSCy Schubert        (string-append "Please send bug reports to: " tmp-val "\n")
717*2b15cb3dSCy Schubert        (delete-file file-name) )
718*2b15cb3dSCy Schubert    :+][+:
719*2b15cb3dSCy Schubert
720*2b15cb3dSCy SchubertENDDEF mk-bugs                        :+][+:
721*2b15cb3dSCy Schubert
722*2b15cb3dSCy SchubertDEFINE append-bugs                    :+][+:
723*2b15cb3dSCy Schubert
724*2b15cb3dSCy Schubert    (set! tmp-val (get "copyright.eaddr" (get "eaddr")))
725*2b15cb3dSCy Schubert    (if (> (string-length tmp-val) 1)
726*2b15cb3dSCy Schubert        (string-append "\n.Pp\nPlease send bug reports to: " tmp-val "\n") )
727*2b15cb3dSCy Schubert    :+][+:
728*2b15cb3dSCy Schubert
729*2b15cb3dSCy SchubertENDDEF append-bugs
730*2b15cb3dSCy Schubert
731*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
732*2b15cb3dSCy Schubert.\"  M K - C O P Y R I G H T  (+ licensing)
733*2b15cb3dSCy Schubert.\"
734*2b15cb3dSCy Schubert.\"  This section is guaranteed to be the last section in the man page
735*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
736*2b15cb3dSCy Schubert
737*2b15cb3dSCy SchubertDEFINE mk-copyright                    \:+]
738*2b15cb3dSCy SchubertCopyright (C) [+: copyright.date        :+] [+:
739*2b15cb3dSCy Schubert  (get "copyright.owner" (get "copyright.author" (get "copyright.eaddr")))
740*2b15cb3dSCy Schubert  :+] all rights reserved.
741*2b15cb3dSCy Schubert[+: CASE (get "copyright.type")         :+][+:
742*2b15cb3dSCy Schubert    = note  :+][+: (get "copyright.text") :+][+:
743*2b15cb3dSCy Schubert    == ''   :+]This program has an unspecified license.[+:
744*2b15cb3dSCy Schubert
745*2b15cb3dSCy Schubert    *       :+][+:
746*2b15cb3dSCy Schubert    (string-append "This program is released under the terms of "
747*2b15cb3dSCy Schubert            (license-name (get "copyright.type")) ".")    :+][+:
748*2b15cb3dSCy Schubert
749*2b15cb3dSCy Schubert  ESAC      :+]
750*2b15cb3dSCy Schubert[+:
751*2b15cb3dSCy SchubertENDDEF mk-copyright
752*2b15cb3dSCy Schubert
753*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
754*2b15cb3dSCy Schubert.\"  M K - N O T E S
755*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
756*2b15cb3dSCy Schubert
757*2b15cb3dSCy SchubertDEFINE mk-notes                       \:+]
758*2b15cb3dSCy SchubertThis manual page was \fIAutoGen\fP-erated from the \fB[+: prog-name :+]\fP
759*2b15cb3dSCy Schubertoption definitions.
760*2b15cb3dSCy Schubert[+:
761*2b15cb3dSCy Schubert
762*2b15cb3dSCy SchubertENDDEF mk-notes
763*2b15cb3dSCy Schubert
764*2b15cb3dSCy Schubert.\" = = = = = APPEND TO IT:           :+][+:
765*2b15cb3dSCy Schubert
766*2b15cb3dSCy SchubertDEFINE append-notes                   :+]
767*2b15cb3dSCy Schubert.Pp
768*2b15cb3dSCy SchubertThis manual page was \fIAutoGen\fP-erated from the \fB[+: prog-name :+]\fP
769*2b15cb3dSCy Schubertoption definitions.[+:
770*2b15cb3dSCy Schubert
771*2b15cb3dSCy SchubertENDDEF append-notes
772*2b15cb3dSCy Schubert
773*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
774*2b15cb3dSCy Schubert.\"  M K - E N V I R O N M E N T
775*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
776*2b15cb3dSCy Schubert
777*2b15cb3dSCy SchubertDEFINE mk-environment                 :+][+:
778*2b15cb3dSCy Schubert  INVOKE  append-environment          :+][+:
779*2b15cb3dSCy SchubertENDDEF mk-environment
780*2b15cb3dSCy Schubert
781*2b15cb3dSCy Schubert.\" = = = = = APPEND TO IT:           :+][+:
782*2b15cb3dSCy Schubert
783*2b15cb3dSCy SchubertDEFINE append-environment             :+]
784*2b15cb3dSCy Schubert[+:(. environ-text)                   :+][+:
785*2b15cb3dSCy SchubertENDDEF append-environment
786*2b15cb3dSCy Schubert
787*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
788*2b15cb3dSCy Schubert.\"  M K - F I L E S
789*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
790*2b15cb3dSCy Schubert
791*2b15cb3dSCy SchubertDEFINE mk-files                       :+][+:
792*2b15cb3dSCy Schubert  INVOKE  append-files                :+][+:
793*2b15cb3dSCy SchubertENDDEF mk-files
794*2b15cb3dSCy Schubert
795*2b15cb3dSCy Schubert.\" = = = = = APPEND TO IT:           :+][+:
796*2b15cb3dSCy Schubert
797*2b15cb3dSCy SchubertDEFINE append-files                   :+]
798*2b15cb3dSCy Schubert[+:(. home-rc-text)                   :+][+:
799*2b15cb3dSCy SchubertENDDEF append-files
800*2b15cb3dSCy Schubert
801*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
802*2b15cb3dSCy Schubert.\"  E M I T   A L I A S   O P T
803*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
804*2b15cb3dSCy Schubert
805*2b15cb3dSCy SchubertDEFINE emit-alias-opt                   :+]
806*2b15cb3dSCy Schubert.It [+:
807*2b15cb3dSCy Schubert  IF (exist? "value")                   :+][+:
808*2b15cb3dSCy Schubert    IF (exist? "long-opts")            \:+]
809*2b15cb3dSCy Schubert Fl [+:value:+] , Fl \-[+: name         :+][+:
810*2b15cb3dSCy Schubert    ELSE                               \:+]
811*2b15cb3dSCy Schubert Fl [+:value:+][+:
812*2b15cb3dSCy Schubert    ENDIF  (exist? "long-opts")         :+][+:
813*2b15cb3dSCy Schubert
814*2b15cb3dSCy Schubert  ELSE  value does not exist -- named option only  :+][+:
815*2b15cb3dSCy Schubert
816*2b15cb3dSCy Schubert    IF (not (exist? "long-opts"))      \:+]
817*2b15cb3dSCy Schubert [+: name :+][+:
818*2b15cb3dSCy Schubert    ELSE                               \:+]
819*2b15cb3dSCy Schubert Fl \-[+: (get "name")                   :+][+:
820*2b15cb3dSCy Schubert    ENDIF                               :+][+:
821*2b15cb3dSCy Schubert  ENDIF                                 :+]
822*2b15cb3dSCy SchubertThis is an alias for the \fI--[+: aliases :+]\fR option.[+:
823*2b15cb3dSCy Schubert  IF (exist? "deprecated")            :+]
824*2b15cb3dSCy Schubert.sp
825*2b15cb3dSCy Schubert.B
826*2b15cb3dSCy SchubertNOTE: THIS OPTION IS DEPRECATED
827*2b15cb3dSCy Schubert[+:
828*2b15cb3dSCy Schubert  ENDIF                               :+][+:
829*2b15cb3dSCy SchubertENDDEF emit-alias-opt
830*2b15cb3dSCy Schubert
831*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
832*2b15cb3dSCy Schubert.\"  E M I T   F L A G   T E X T
833*2b15cb3dSCy Schubert.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
834*2b15cb3dSCy Schubert
835*2b15cb3dSCy SchubertDEFINE emit-flag-text                 :+][+:
836*2b15cb3dSCy Schubert
837*2b15cb3dSCy Schubert  (if (exist? "enable")
838*2b15cb3dSCy Schubert      (set! opt-name (string-append (get "enable") "-" (get "name")))
839*2b15cb3dSCy Schubert      (set! opt-name (get "name")) )
840*2b15cb3dSCy Schubert  (if (exist? "disable")
841*2b15cb3dSCy Schubert      (set! dis-name (string-append (get "disable") "-" (get "name")))
842*2b15cb3dSCy Schubert      (set! dis-name "") )
843*2b15cb3dSCy Schubert
844*2b15cb3dSCy Schubert  (set! opt-name (fix-optname opt-name))
845*2b15cb3dSCy Schubert  (if (> (string-length dis-name) 0)
846*2b15cb3dSCy Schubert      (set! dis-name (fix-optname dis-name)) )
847*2b15cb3dSCy Schubert
848*2b15cb3dSCy Schubert  (if (not (exist? "arg-type"))
849*2b15cb3dSCy Schubert      (set! opt-arg "")
850*2b15cb3dSCy Schubert      (set! opt-arg (string-append "Ar "
851*2b15cb3dSCy Schubert            (fix-optname (if (exist? "arg-name")
852*2b15cb3dSCy Schubert                (get "arg-name")
853*2b15cb3dSCy Schubert                (string-downcase! (get "arg-type"))  ))
854*2b15cb3dSCy Schubert            ))
855*2b15cb3dSCy Schubert  )
856*2b15cb3dSCy Schubert
857*2b15cb3dSCy Schubert:+]
858*2b15cb3dSCy Schubert.It [+:
859*2b15cb3dSCy Schubert  IF (exist? "value")                   :+][+:
860*2b15cb3dSCy Schubert    IF (exist? "long-opts")             :+][+:
861*2b15cb3dSCy Schubert
862*2b15cb3dSCy Schubert          # * * * * * * * * * * * * * * * * * * * *
863*2b15cb3dSCy Schubert          *
864*2b15cb3dSCy Schubert          *  The option has a flag value (character) AND
865*2b15cb3dSCy Schubert          *  the program uses long options
866*2b15cb3dSCy Schubert          *
867*2b15cb3dSCy Schubert          \:+]
868*2b15cb3dSCy Schubert Fl [+:value:+][+:
869*2b15cb3dSCy Schubert      IF (not (exist? "arg-type"))      :+] , Fl -[+:
870*2b15cb3dSCy Schubert      ELSE  :+] [+:(. opt-arg):+] , Fl -[+:
871*2b15cb3dSCy Schubert      ENDIF :+][+: (. opt-name)         :+] [+:
872*2b15cb3dSCy Schubert      IF (exist? "arg-type")            :+][+:
873*2b15cb3dSCy Schubert              ? arg-optional Oo Ns = Ns
874*2b15cb3dSCy Schubert              :+] [+:  (. opt-arg)      :+] [+:
875*2b15cb3dSCy Schubert              arg-optional Oc           :+][+:
876*2b15cb3dSCy Schubert      ENDIF                             :+][+:
877*2b15cb3dSCy Schubert      IF (exist? "disable") :+] , Fl -[+:(. dis-name):+][+:
878*2b15cb3dSCy Schubert      ENDIF                             :+][+:
879*2b15cb3dSCy Schubert
880*2b15cb3dSCy Schubert    ELSE                                :+][+:
881*2b15cb3dSCy Schubert
882*2b15cb3dSCy Schubert          # * * * * * * * * * * * * * * * * * * * *
883*2b15cb3dSCy Schubert          *
884*2b15cb3dSCy Schubert          *  The option has a flag value (character) BUT
885*2b15cb3dSCy Schubert          *  the program does _NOT_ use long options
886*2b15cb3dSCy Schubert          *
887*2b15cb3dSCy Schubert          \:+]
888*2b15cb3dSCy Schubert Fl [+:value:+] [+:
889*2b15cb3dSCy Schubert      IF (exist? "arg-type")            :+][+:
890*2b15cb3dSCy Schubert            arg-optional Oo     :+] [+:(. opt-arg):+] [+:
891*2b15cb3dSCy Schubert            arg-optional Oc     :+] [+:
892*2b15cb3dSCy Schubert      ENDIF "                           :+][+:
893*2b15cb3dSCy Schubert    ENDIF  (exist? "long-opts")         :+][+:
894*2b15cb3dSCy Schubert
895*2b15cb3dSCy Schubert
896*2b15cb3dSCy Schubert  ELSE  value does not exist -- named option only  :+][+:
897*2b15cb3dSCy Schubert
898*2b15cb3dSCy Schubert    IF (not (exist? "long-opts"))       :+][+:
899*2b15cb3dSCy Schubert
900*2b15cb3dSCy Schubert          # * * * * * * * * * * * * * * * * * * * *
901*2b15cb3dSCy Schubert          *
902*2b15cb3dSCy Schubert          *  The option does not have a flag value (character).
903*2b15cb3dSCy Schubert          *  The program does _NOT_ use long options either.
904*2b15cb3dSCy Schubert          *  Special magic:  All arguments are named options.
905*2b15cb3dSCy Schubert          *
906*2b15cb3dSCy Schubert          \:+]
907*2b15cb3dSCy Schubert [+: (. opt-name) :+] [+:
908*2b15cb3dSCy Schubert      IF (exist? "arg-type")            :+] [+:
909*2b15cb3dSCy Schubert         ? arg-optional ' Oo = Ns' ' Ns = Ns '
910*2b15cb3dSCy Schubert         :+] [+:(. opt-arg)              :+] [+:
911*2b15cb3dSCy Schubert         arg-optional Oc                :+] [+:
912*2b15cb3dSCy Schubert      ENDIF:+][+:
913*2b15cb3dSCy Schubert      IF (exist? "disable") :+] , Fl -[+:(. dis-name):+][+:
914*2b15cb3dSCy Schubert      ENDIF                             :+][+:
915*2b15cb3dSCy Schubert
916*2b15cb3dSCy Schubert
917*2b15cb3dSCy Schubert    ELSE                                :+][+:
918*2b15cb3dSCy Schubert          # * * * * * * * * * * * * * * * * * * * *
919*2b15cb3dSCy Schubert          *
920*2b15cb3dSCy Schubert          *  The option does not have a flag value (character).
921*2b15cb3dSCy Schubert          *  The program, instead, only accepts long options.
922*2b15cb3dSCy Schubert          *
923*2b15cb3dSCy Schubert          \:+]
924*2b15cb3dSCy Schubert Fl -[+: (. opt-name) :+] [+:
925*2b15cb3dSCy Schubert
926*2b15cb3dSCy Schubert      IF (exist? "arg-type") :+][+:
927*2b15cb3dSCy Schubert            arg-optional Oo :+] Ns = Ns [+:(. opt-arg):+] [+:
928*2b15cb3dSCy Schubert            arg-optional Oc :+][+:
929*2b15cb3dSCy Schubert      ENDIF                             :+][+:
930*2b15cb3dSCy Schubert
931*2b15cb3dSCy Schubert      IF (exist? "disable")
932*2b15cb3dSCy Schubert        :+], " Fl \-[+:(. dis-name):+]"[+:
933*2b15cb3dSCy Schubert      ENDIF                             :+][+:
934*2b15cb3dSCy Schubert    ENDIF                               :+][+:
935*2b15cb3dSCy Schubert  ENDIF                                 :+]
936*2b15cb3dSCy Schubert[+: (get "descrip" "") :+].[+:
937*2b15cb3dSCy Schubert
938*2b15cb3dSCy Schubert  IF (exist? "min")                     :+]
939*2b15cb3dSCy SchubertThis option is required to appear.[+:
940*2b15cb3dSCy Schubert  ENDIF                                 :+][+:
941*2b15cb3dSCy Schubert
942*2b15cb3dSCy Schubert  IF (exist? "max") :+]
943*2b15cb3dSCy SchubertThis option may appear [+:
944*2b15cb3dSCy Schubert    IF % max (= "%s" "NOLIMIT")
945*2b15cb3dSCy Schubert      :+]an unlimited number of times[+:ELSE
946*2b15cb3dSCy Schubert      :+]up to [+: max :+] times[+:
947*2b15cb3dSCy Schubert    ENDIF:+].[+:
948*2b15cb3dSCy Schubert  ENDIF:+][+:
949*2b15cb3dSCy Schubert
950*2b15cb3dSCy Schubert  IF (exist? "disable")               :+]
951*2b15cb3dSCy SchubertThe \fI[+:(. dis-name):+]\fP form will [+:
952*2b15cb3dSCy Schubert    IF (exist? "stack-arg")
953*2b15cb3dSCy Schubert          :+]clear the list of option arguments[+:
954*2b15cb3dSCy Schubert    ELSE  :+]disable the option[+:
955*2b15cb3dSCy Schubert    ENDIF :+].[+:
956*2b15cb3dSCy Schubert  ENDIF:+][+:
957*2b15cb3dSCy Schubert
958*2b15cb3dSCy Schubert  IF (exist? "enabled")               :+]
959*2b15cb3dSCy SchubertThis option is enabled by default.[+:
960*2b15cb3dSCy Schubert  ENDIF                               :+][+:
961*2b15cb3dSCy Schubert
962*2b15cb3dSCy Schubert  IF (exist? "no-preset")             :+]
963*2b15cb3dSCy SchubertThis option may not be preset with environment variables
964*2b15cb3dSCy Schubertor in initialization (rc) files.[+:
965*2b15cb3dSCy Schubert  ENDIF                               :+][+:
966*2b15cb3dSCy Schubert
967*2b15cb3dSCy Schubert  IF (and (exist? "default") named-mode) :+]
968*2b15cb3dSCy SchubertThis option is the default option.[+:
969*2b15cb3dSCy Schubert  ENDIF                               :+][+:
970*2b15cb3dSCy Schubert
971*2b15cb3dSCy Schubert  IF (exist? "equivalence")           :+]
972*2b15cb3dSCy SchubertThis option is a member of the [+:equivalence:+] class of options.[+:
973*2b15cb3dSCy Schubert  ENDIF                               :+][+:
974*2b15cb3dSCy Schubert
975*2b15cb3dSCy Schubert  IF (exist? "flags-must")            :+]
976*2b15cb3dSCy SchubertThis option must appear in combination with the following options:
977*2b15cb3dSCy Schubert[+: FOR flags-must ", " :+][+:flags-must:+][+:ENDFOR:+].[+:
978*2b15cb3dSCy Schubert  ENDIF                               :+][+:
979*2b15cb3dSCy Schubert
980*2b15cb3dSCy Schubert  IF (exist? "flags-cant")            :+]
981*2b15cb3dSCy SchubertThis option must not appear in combination with any of the following options:
982*2b15cb3dSCy Schubert[+: FOR flags-cant ", " :+][+:flags-cant:+][+:ENDFOR:+].[+:
983*2b15cb3dSCy Schubert  ENDIF                               :+][+:
984*2b15cb3dSCy Schubert
985*2b15cb3dSCy Schubert
986*2b15cb3dSCy Schubert  IF (~* (get "arg-type") "key|set") :+]
987*2b15cb3dSCy SchubertThis option takes a keyword as its argument[+:
988*2b15cb3dSCy Schubert
989*2b15cb3dSCy Schubert    IF (=* (get "arg-type") "set")
990*2b15cb3dSCy Schubert
991*2b15cb3dSCy Schubert:+] list.  Each entry turns on or off
992*2b15cb3dSCy Schubertmembership bits.  The bits are set by name or numeric value and cleared
993*2b15cb3dSCy Schubertby preceding the name or number with an exclamation character ('!').
994*2b15cb3dSCy SchubertThey can all be cleared with the magic name \fInone\fR and they can all be set
995*2b15cb3dSCy Schubertwith
996*2b15cb3dSCy Schubert.IR all .
997*2b15cb3dSCy SchubertA single option will process a list of these values.[+:
998*2b15cb3dSCy Schubert
999*2b15cb3dSCy Schubert    ELSE
1000*2b15cb3dSCy Schubert
1001*2b15cb3dSCy Schubert:+].  The argument sets an enumeration value that can
1002*2b15cb3dSCy Schubertbe tested by comparing them against the option value macro.[+:
1003*2b15cb3dSCy Schubert
1004*2b15cb3dSCy Schubert    ENDIF
1005*2b15cb3dSCy Schubert
1006*2b15cb3dSCy Schubert:+]
1007*2b15cb3dSCy SchubertThe available keywords are:
1008*2b15cb3dSCy Schubert.in +4
1009*2b15cb3dSCy Schubert.nf
1010*2b15cb3dSCy Schubert.na
1011*2b15cb3dSCy Schubert[+: (shellf "${CLexe} --indent='' --spread=1 -W50 <<_EOF_\n%s\n_EOF_"
1012*2b15cb3dSCy Schubert            (join "\n" (stack "keyword"))  )   :+]
1013*2b15cb3dSCy Schubert.fi
1014*2b15cb3dSCy Schubertor their numeric equivalent.
1015*2b15cb3dSCy Schubert.in -4[+: (if (exist? "arg-default") "\n.sp" ) :+][+:
1016*2b15cb3dSCy Schubert
1017*2b15cb3dSCy Schubert  ELIF (=* (get "arg-type") "num")    :+]
1018*2b15cb3dSCy SchubertThis option takes an integer number as its argument.[+:
1019*2b15cb3dSCy Schubert
1020*2b15cb3dSCy Schubert    IF  (exist? "arg-range")          :+]
1021*2b15cb3dSCy SchubertThe value of
1022*2b15cb3dSCy Schubert.[+:(. opt-arg):+]
1023*2b15cb3dSCy Schubertis constrained to being:
1024*2b15cb3dSCy Schubert.in +4
1025*2b15cb3dSCy Schubert.nf
1026*2b15cb3dSCy Schubert.na[+:FOR arg_range ", or"            :+]
1027*2b15cb3dSCy Schubert[+: (shellf "
1028*2b15cb3dSCy Schubertrange='%s'
1029*2b15cb3dSCy Schubert
1030*2b15cb3dSCy Schubertcase \"X${range}\" in
1031*2b15cb3dSCy SchubertX'->'?*  )
1032*2b15cb3dSCy Schubert  echo \"less than or equal to\" `
1033*2b15cb3dSCy Schubert    echo $range | sed 's/->//' ` ;;
1034*2b15cb3dSCy Schubert
1035*2b15cb3dSCy SchubertX?*'->'  )
1036*2b15cb3dSCy Schubert  echo \"greater than or equal to\" `
1037*2b15cb3dSCy Schubert    echo $range | sed 's/->.*//' ` ;;
1038*2b15cb3dSCy Schubert
1039*2b15cb3dSCy SchubertX?*'->'?* )
1040*2b15cb3dSCy Schubert  echo \"in the range \" `
1041*2b15cb3dSCy Schubert    echo $range | sed 's/->/ through /' ` ;;
1042*2b15cb3dSCy Schubert
1043*2b15cb3dSCy SchubertX?* )
1044*2b15cb3dSCy Schubert  echo exactly $range ;;
1045*2b15cb3dSCy Schubert
1046*2b15cb3dSCy SchubertX* ) echo $range is indeterminate
1047*2b15cb3dSCy Schubertesac"
1048*2b15cb3dSCy Schubert
1049*2b15cb3dSCy Schubert(get "arg-range") )
1050*2b15cb3dSCy Schubert:+][+:
1051*2b15cb3dSCy Schubert      ENDFOR arg-range :+]
1052*2b15cb3dSCy Schubert.fi
1053*2b15cb3dSCy Schubert.in -4[+:
1054*2b15cb3dSCy Schubert
1055*2b15cb3dSCy Schubert    ENDIF  arg-range exists           :+][+:
1056*2b15cb3dSCy Schubert
1057*2b15cb3dSCy Schubert  ENDIF  arg-type key/set/num         :+][+:
1058*2b15cb3dSCy Schubert
1059*2b15cb3dSCy Schubert  IF (exist? "arg-default")           :+]
1060*2b15cb3dSCy SchubertThe default
1061*2b15cb3dSCy Schubert.[+: (. opt-arg) :+]
1062*2b15cb3dSCy Schubertfor this option is:
1063*2b15cb3dSCy Schubert.ti +4
1064*2b15cb3dSCy Schubert [+: (join " + " (stack "arg-default" )) :+][+:
1065*2b15cb3dSCy Schubert  ENDIF                               :+]
1066*2b15cb3dSCy Schubert.sp
1067*2b15cb3dSCy Schubert[+:
1068*2b15cb3dSCy Schubert (if (exist? "doc") (string-substitute (get "doc" "") "\n\n" "\n.sp\n")
1069*2b15cb3dSCy Schubert     "This option has not been fully documented." ) :+][+:
1070*2b15cb3dSCy Schubert  IF (exist? "deprecated")            :+]
1071*2b15cb3dSCy Schubert.sp
1072*2b15cb3dSCy Schubert.B
1073*2b15cb3dSCy SchubertNOTE: THIS OPTION IS DEPRECATED
1074*2b15cb3dSCy Schubert[+:
1075*2b15cb3dSCy Schubert  ENDIF                               :+][+:
1076*2b15cb3dSCy Schubert
1077*2b15cb3dSCy SchubertENDDEF emit-flag-text
1078*2b15cb3dSCy Schubert
1079*2b15cb3dSCy Schubert.\" cmd-doc.tlib ends here \:+]
1080