1275970Scy[+: -*- Mode: nroff -*- 2275970Scy 3275970Scy AutoGen5 template man 4275970Scy 5275970Scy# cmd-doc.tlib -- Template for command line man/mdoc pages 6275970Scy# 7275970Scy# This file is part of AutoOpts, a companion to AutoGen. 8275970Scy# AutoOpts is free software. 9275970Scy# Copyright (C) 1992-2013 Bruce Korb - all rights reserved 10275970Scy# 11275970Scy# AutoOpts is available under any one of two licenses. The license 12275970Scy# in use must be one of these two and the choice is under the control 13275970Scy# of the user of the license. 14275970Scy# 15275970Scy# The GNU Lesser General Public License, version 3 or later 16275970Scy# See the files "COPYING.lgplv3" and "COPYING.gplv3" 17275970Scy# 18275970Scy# The Modified Berkeley Software Distribution License 19275970Scy# See the file "COPYING.mbsd" 20275970Scy# 21275970Scy# These files have the following sha256 sums: 22275970Scy# 23275970Scy# 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 24275970Scy# 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 25275970Scy# 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd 26275970Scy 27275970Scy# Produce a man page for section 1, 5, 6 or 8 commands. Which is 28275970Scy# selected via: -DMAN_SECTION=n. "n" may have a suffix, if desired. 29275970Scy# These sections have default section names that may be overridden 30275970Scy# with -DSECTIN_NAME=XX, also passed to the autogen invocation. 31275970Scy# 32275970Scy:+][+: 33275970Scy 34275970Scy ;;# START-BUILDTREE-ISMS 35275970Scy ;; 36275970Scy (shell "CLexe=${AGexe%/agen5/*}/columns/columns 37275970Scy test -x \"${CLexe}\" || { 38275970Scy CLexe=${AGexe%/autogen}/columns 39275970Scy test -x \"${CLexe}\" || die 'columns program is not findable' 40275970Scy }") 41275970Scy 42275970Scy:+][+: # END-BUILDTREE-ISMS 43275970Scy 44275970Scy(shell "CLexe=`echo ${AGexe} | sed 's@/autogen@/columns@'` 45275970Scy test -x \"${CLexe}\" || CLexe=`which columns`") 46275970Scy 47275970Scy# END-INSTALL-ONLY-CODE :+][+: 48275970Scy 49275970Scy(define down-prog-name (string-downcase! (get "prog-name"))) 50275970Scy(define UP-PROG-NAME (get-up-name "prog-name")) 51275970Scy 52275970Scy(define command-doc #t) 53275970Scy(define tmp-val (getenv "MAN_SECTION")) 54275970Scy(define man-sect (if (exist? "cmd-section") (get "cmd-section") "1")) 55275970Scy(define file-name "") 56275970Scy(define sect-name "") 57275970Scy(define macro-name "") 58275970Scy(define tmp-str "") 59275970Scy(define fname-line "") 60275970Scy(define use-flags (exist? "flag.value")) 61275970Scy(define named-mode (not (or use-flags (exist? "long-opts") ))) 62275970Scy 63275970Scy(if (defined? 'tmp-val) 64275970Scy (if (string? tmp-val) 65275970Scy (set! man-sect tmp-val))) 66275970Scy 67275970Scy(define section-name 68275970Scy (if (=* man-sect "1") "User Commands" 69275970Scy (if (=* man-sect "5") "File Formats" 70275970Scy (if (=* man-sect "6") "Games" 71275970Scy (if (=* man-sect "8") "System Management" 72275970Scy (error 73275970Scy "the agman-cmd template only produces section 1, 5, 6 and 8 man pages") 74275970Scy))))) 75275970Scy(set! tmp-val (getenv "SECTION_NAME")) 76275970Scy(if (defined? 'tmp-val) (if (string? tmp-val) 77275970Scy (set! section-name tmp-val) )) 78275970Scy 79275970Scy(define package-text "") 80275970Scy(define package+version (and (exist? "package") (exist? "version"))) 81275970Scy 82275970Scy(if (or (exist? "package") (exist? "version")) (begin 83275970Scy (set! package-text (string-append 84275970Scy (get "package") 85275970Scy (if package+version " (" "") 86275970Scy (get "version") 87275970Scy (if package+version ")" "") )) 88275970Scy) ) 89275970Scy 90275970Scy(define name-to-fname (lambda (nm) 91275970Scy (string-tr (string-downcase nm) " " "-") )) 92275970Scy 93275970Scy(define sect-line-fname (lambda () (begin 94275970Scy (out-push-new file-name) 95275970Scy (emit (string-append ".Sh \"" sect-name "\"\n")) 96275970Scy (string-append "mk-" macro-name) ))) 97275970Scy 98275970Scy(make-tmp-dir) 99275970Scy 100275970Scy(define home-rc-files (exist? "homerc")) 101275970Scy(define home-rc-text 102275970Scy "\nSee \\fBOPTION PRESETS\\fP for configuration files.") 103275970Scy 104275970Scy(define environ-init (exist? "environrc")) 105275970Scy(define environ-text 106275970Scy "\nSee \\fBOPTION PRESETS\\fP for configuration environment variables.") 107275970Scy 108275970Scy(emit (head-line)) 109275970Scy(dne ".\\\" ") :+] 110275970Scy.Sh NAME 111275970Scy.Nm [+: prog-name :+] 112275970Scy.Nd [+: prog-title :+] 113275970Scy[+: INCLUDE "tpl-config.tlib" :+][+:# 114275970Scy 115275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 116275970Scy.\" B U I L D D O C 117275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 118275970Scy 119275970ScyDEFINE build-doc :+][+: 120275970Scy 121275970Scy(if (not command-doc) (begin 122275970Scy (set! home-rc-files #f) 123275970Scy (set! home-rc-text "") 124275970Scy) ) :+][+: 125275970Scy 126275970ScyINVOKE doc-sections :+][+: 127275970ScyINVOKE ao-sections :+][+: 128275970ScyINVOKE assemble-sections :+][+: 129275970Scy 130275970ScyENDDEF build-doc 131275970Scy 132275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 133275970Scy.\" A S S E M B L E S E C T I O N S 134275970Scy.\" 135275970Scy.\" Emit the files for each section that was provided, and do conversions 136275970Scy.\" 137275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 138275970Scy 139275970ScyDEFINE assemble-sections :+][+: 140275970Scy 141275970Scy(out-push-new) 142275970Scy 143275970Scy:+][+: 144275970Scy#.\" Insert the sections in the prescribed order 145275970Scy#.\" Ensure a newline between them all. We strip blank lines, 146275970Scy#.\" so extra blank lines get removed. 147275970Scy#:+] 148275970Scycvt_prog='[+: 149275970Scy 150275970Scy (define target-form (if man-page "man" "mdoc")) 151275970Scy (define source-form (get "option-format" "texi")) 152275970Scy (define converter (string-append source-form "2" target-form )) 153275970Scy (set! tmp-str (find-file converter)) 154275970Scy 155275970Scy (if (not (defined? 'tmp-str)) 156275970Scy (error (string-append "cannot locate " converter))) 157275970Scy tmp-str 158275970Scy:+]' 159275970Scycvt_prog=`cd \`dirname "$cvt_prog"\` >/dev/null && pwd 160275970Scy `/`basename "$cvt_prog"` 161275970Scycd $tmp_dir 162275970Scytest -x "$cvt_prog" || die "'$cvt_prog' is not executable" 163275970Scy{ 164275970Scy list='synopsis description options option-presets' 165275970Scy for f in $list ; do cat $f ; echo ; done 166275970Scy rm -f $list name 167275970Scy list='implementation-notes environment files examples exit-status errors 168275970Scy compatibility see-also conforming-to history authors copyright bugs 169275970Scy notes' 170275970Scy for f in $list ; do cat $f ; echo ; done > .end-doc 171275970Scy rm -f $list 172275970Scy list=`ls -1 *`' .end-doc' 173275970Scy for f in $list ; do cat $f ; echo ; done 174275970Scy rm -f $list 175275970Scy} 1>.doc 2>/dev/null 176275970Scy[+: 177275970ScyIF (exist? "doc-sub") :+][+: 178275970Scy (out-push-new (string-append tmp-dir "/.cmds")) :+][+: 179275970Scy FOR doc-sub :+][+: 180275970Scy 181275970Scy IF (define field-name (get "sub-type" target-form)) 182275970Scy (~~ target-form field-name) :+][+: 183275970Scy 184275970Scy (set! field-name (get "sub-name")) 185275970Scy (define rep-string (string-append "<<" field-name ">>")) 186275970Scy (emit (string-substitute (get "sub-text") rep-string (get field-name))) 187275970Scy "\n" 188275970Scy 189275970Scy :+][+: ENDIF :+][+: 190275970Scy 191275970Scy ENDFOR doc-sub :+][+: 192275970Scy 193275970Scy (out-pop) 194275970Scy (define post-proc-cmd (string-append 195275970Scy (get "doc-sub-cmd" "sed -f %s %s") " | " 196275970Scy egrep-prog " -v '^[ ]*$' | $cvt_prog")) 197275970Scy (sprintf post-proc-cmd ".cmds" ".doc") 198275970Scy :+][+: 199275970ScyELSE \:+] 200275970Scy[+:(. egrep-prog):+] -v '^[ ]*$' .doc | $cvt_prog[+: 201275970ScyENDIF doc-sub exists :+][+: 202275970Scy 203275970Scy(shell (out-pop #t)) :+][+: 204275970Scy 205275970ScyENDDEF assemble-sections 206275970Scy 207275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 208275970Scy.\" D O C S E C T I O N S 209275970Scy.\" 210275970Scy.\" Emit the files for each section that was provided. 211275970Scy.\" If multiple sections exist, they get glued together with ".Pp" 212275970Scy.\" between them. 213275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 214275970Scy 215275970ScyDEFINE doc-sections :+][+: 216275970Scy 217275970ScyFOR doc-section :+][+: 218275970Scy IF 219275970Scy (define sec-type (string-upcase (get "ds-type"))) 220275970Scy (define sec-name (name-to-fname sec-type)) 221275970Scy (define cvt-fn (find-file (string-append 222275970Scy (get "ds-format" "man") "2mdoc"))) 223275970Scy (if (not (defined? 'cvt-fn)) 224275970Scy (error (sprintf "Cannot locate converter for %s" 225275970Scy (get "ds-format" "man")))) 226275970Scy 227275970Scy (define sec-file (string-append tmp-dir "/" sec-name)) 228275970Scy (access? sec-file R_OK) :+][+: 229275970Scy (out-push-add sec-file) 230275970Scy (emit ".Pp\n") :+][+: 231275970Scy 232275970Scy ELSE :+][+: CASE 233275970Scy (out-push-new sec-file) 234275970Scy sec-type :+][+: 235275970Scy 236275970Scy == "" :+][+: (error "unnamed doc-section") :+][+: 237275970Scy *==* " " :+].Sh "[+: (. sec-type) :+]"[+: 238275970Scy * :+].Sh [+: (. sec-type) :+][+: 239275970Scy ESAC :+][+: 240275970Scy ENDIF :+] 241275970Scy[+: 242275970Scy (shell (string-append 243275970Scy "fn='" cvt-fn "'\n" 244275970Scy "test -f ${fn} || die ${fn} not found from $PWD\n" 245275970Scy "${fn} <<\\_EndOfDocSection_ || die ${fn} failed in $PWD\n" 246275970Scy (get "ds-text") 247275970Scy "\n_EndOfDocSection_" 248275970Scy )) :+][+: 249275970Scy 250275970Scy CASE (emit "\n") sec-type :+][+: 251275970Scy == FILES :+][+: 252275970Scy (if home-rc-files (emit home-rc-text)) 253275970Scy (set! home-rc-files #f) :+][+: 254275970Scy 255275970Scy == ENVIRONMENT :+][+: 256275970Scy (if environ-init (emit environ-text)) 257275970Scy (set! environ-init #f) :+][+: 258275970Scy ESAC :+][+: 259275970Scy 260275970Scy (out-pop) 261275970Scy :+][+: 262275970Scy 263275970ScyENDFOR doc-section :+][+: 264275970Scy 265275970ScyENDDEF doc-sections 266275970Scy 267275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 268275970Scy.\" A O S E C T I O N S 269275970Scy.\" 270275970Scy.\" Emit the files for the sections that these templates augment, 271275970Scy.\" replace or conditionally replace 272275970Scy.\" 273275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 274275970Scy 275275970ScyDEFINE ao-sections :+][+: 276275970Scy IF (. command-doc) :+][+: 277275970Scy INVOKE cond-section sec = "OPTIONS" mode = "replace" :+][+: 278275970Scy INVOKE cond-section sec = "EXIT STATUS" mode = "insert" :+][+: 279275970Scy 280275970Scy IF (or home-rc-files environ-init) :+][+: 281275970Scy INVOKE cond-section sec = "OPTION PRESETS" mode = "replace" :+][+: 282275970Scy 283275970Scy IF (. home-rc-files) :+][+: 284275970Scy INVOKE cond-section sec = "FILES" mode = "append" :+][+: 285275970Scy ENDIF :+][+: 286275970Scy 287275970Scy IF (. environ-init) :+][+: 288275970Scy INVOKE cond-section sec = "ENVIRONMENT" mode = "append" :+][+: 289275970Scy ENDIF :+][+: 290275970Scy ENDIF :+][+: 291275970Scy 292275970Scy ELSE section 5, not command :+][+: 293275970Scy INVOKE cond-section sec = "FILES" mode = "append" :+][+: 294275970Scy ENDIF section 5/not :+][+: 295275970Scy 296275970Scy INVOKE cond-section sec = "SYNOPSIS" mode = "alt" :+][+: 297275970Scy INVOKE cond-section sec = "DESCRIPTION" mode = "append" :+][+: 298275970Scy INVOKE cond-section sec = "AUTHORS" mode = "alt" :+][+: 299275970Scy INVOKE cond-section sec = "BUGS" mode = "append" :+][+: 300275970Scy INVOKE cond-section sec = "NOTES" mode = "append" :+][+: 301275970Scy 302275970ScyIF (exist? "copyright") :+][+: 303275970Scy INVOKE cond-section sec = "COPYRIGHT" mode = "alt" :+][+: 304275970ScyENDIF :+][+: 305275970Scy 306275970ScyENDDEF ao-sections 307275970Scy 308275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 309275970Scy.\" C O N D I T I O N A L S E C T I O N 310275970Scy.\" 311275970Scy.\" Figure out what to do for AutoOpts required sections, depending on "mode" 312275970Scy.\" In all cases, if the file does not exist, invoke the "mk" macro to create 313275970Scy.\" a new file. If it does exist, then: 314275970Scy.\" 315275970Scy.\" alt Alternate -- emit no text 316275970Scy.\" replace throw away any pre-existing file. 317275970Scy.\" append invoke the "append" macro to emit additional text 318275970Scy.\" insert save the current contents, replacing the .Sh line with .Pp. 319275970Scy.\" invoke the "mk" macro then emit the saved text 320275970Scy.\" 321275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 322275970Scy 323275970ScyDEFINE cond-section :+][+: 324275970Scy 325275970Scy IF 326275970Scy (set! sect-name (string-upcase! (string-substitute 327275970Scy (get "sec") "-" " " ))) 328275970Scy (set! macro-name (string-downcase! (string-substitute 329275970Scy sect-name " " "-" ))) 330275970Scy (set! file-name (string-append tmp-dir "/" macro-name)) 331275970Scy 332275970Scy (not (access? file-name R_OK)) :+][+: 333275970Scy 334275970Scy INVOKE (sect-line-fname) :+][+: 335275970Scy 336275970Scy ELSE file exists :+][+: 337275970Scy 338275970Scy CASE (get "mode") :+][+: 339275970Scy 340275970Scy == replace :+][+: 341275970Scy INVOKE (sect-line-fname) :+][+: 342275970Scy 343275970Scy == append :+][+: 344275970Scy (out-push-add file-name) :+][+: 345275970Scy INVOKE (string-append "append-" macro-name) :+][+: 346275970Scy 347275970Scy == insert :+][+: 348275970Scy (set! fname-line (shellf 349275970Scy "sed '1s/.Sh .*/.Pp/' %1$s ; rm -f %1$s" file-name)) :+][+: 350275970Scy INVOKE (sect-line-fname) :+][+: 351275970Scy 352275970Scy == alt :+][+: 353275970Scy (out-push-new) :+][+: 354275970Scy 355275970Scy * :+][+: 356275970Scy (error (sprintf "invalid section type: %s" (get "mode"))) 357275970Scy 358275970Scy :+][+: 359275970Scy ESAC :+][+: 360275970Scy 361275970Scy ENDIF file existence/non-existence :+][+: 362275970Scy (out-pop) :+][+: # All paths open out :+][+: 363275970ScyENDDEF cond-section 364275970Scy 365275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 366275970Scy.\" M K - D E S C R I P T I O N 367275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 368275970Scy 369275970ScyDEFINE mk-description :+][+: 370275970Scy 371275970Scy (out-push-new) 372275970Scy (emit 373275970Scy (if (exist? "prog-man-descrip") 374275970Scy (stack-join "\n.Pp\n" "prog-man-descrip") 375275970Scy (if (exist? "detail") 376275970Scy (stack-join "\n.Pp\n" "detail") 377275970Scy "There is no description for this command." 378275970Scy ) ) ) 379275970Scy (shell "sed 's/^$/.sp/' <<\\_EODesc_\n" (out-pop #t) "\n_EODesc_") 380275970Scy 381275970Scy :+][+: 382275970Scy INVOKE append-description :+][+: 383275970Scy 384275970ScyENDDEF mk-description 385275970Scy 386275970Scy.\" = = = = = = = = = = = = = = = = = = 387275970Scy.\" A P P E N D - D E S C R I P T I O N 388275970Scy.\" = = = = = = = = = = = = = = = = = = :+][+: 389275970Scy 390275970ScyDEFINE append-description :+][+: 391275970Scy 392275970ScyIF (= (get "main.main-type") "for-each"):+][+: 393275970Scy 394275970Scy CASE main.handler-type :+][+: 395275970Scy ~* ^(name|file)|.*text \:+] 396275970Scy.Pp 397275970ScyThis program will perform its function for every file named on the command 398275970Scyline or every file named in a list read from stdin. The arguments or input 399275970Scynames must be pre\-existing files. The input list may contain comments, 400275970Scywhich[+: 401275970Scy 402275970Scy !E \:+] 403275970Scy.Pp 404275970ScyThis program will perform its function for every command line argument 405275970Scyor every non\-comment line in a list read from stdin. 406275970ScyThe input list comments[+: 407275970Scy 408275970Scy * :+][+: 409275970Scy (error "the 'for-each' main has in invalid handler-type.") :+][+: 410275970Scy ESAC \:+] 411275970Scy are blank lines or lines beginning with a '[+: 412275970Scy ?% comment-char "%s" "#" :+]' character. 413275970Scy[+: 414275970Scy 415275970ScyENDIF - "main" is of "for-each" type :+][+: 416275970Scy 417275970ScyENDDEF append-description 418275970Scy 419275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 420275970Scy.\" M K - O P T I O N S 421275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 422275970Scy 423275970ScyDEFINE mk-options 424275970Scy 425275970Scy:+][+: 426275970Scy 427275970Scy(define opt-arg "") 428275970Scy(define dis-name "") 429275970Scy(define opt-name "") 430275970Scy(define optname-from "A-Z_^") 431275970Scy(define optname-to "a-z--") 432275970Scy(define cvt-cmd "") 433275970Scy(define formatted-doc (exist? "option-format")) 434275970Scy 435275970Scy(if formatted-doc (begin 436275970Scy (out-push-new) 437275970Scy (set! cvt-cmd (string-append (get "option-format") "2mdoc")) 438275970Scy) ) 439275970Scy 440275970Scy(if (exist? "preserve-case") 441275970Scy (begin 442275970Scy (set! optname-from "_^") 443275970Scy (set! optname-to "--") 444275970Scy) ) 445275970Scy 446275970Scy(define fix-optname (lambda (o_nm) (begin 447275970Scy (set! o_nm (string-tr o_nm optname-from optname-to)) 448275970Scy (set! o_nm (string-substitute o_nm "-" "\\-" )) 449275970Scy o_nm ))) 450275970Scy 451275970Scy(if (exist? "option-info") 452275970Scy (string-append ".Pp\n" (get "option-info") "\n") ) 453275970Scy\:+] 454275970Scy.Bl -tag[+: 455275970Scy 456275970ScyFOR flag :+][+: 457275970Scy IF (not (exist? "documentation")) :+][+: 458275970Scy IF (exist? "aliases") :+][+: 459275970Scy INVOKE emit-alias-opt :+][+: 460275970Scy ELSE :+][+: 461275970Scy INVOKE emit-flag-text :+][+: 462275970Scy ENDIF :+][+: 463275970Scy 464275970Scy ELSE :+] 465275970Scy.Ss "[+: (get "descrip" "") :+]"[+: 466275970Scy(set! tmp-str (get "documentation" "")) 467275970Scy(if (> (string-length tmp-str) 3) (string-append 468275970Scy "\n" tmp-str "\n" )) :+][+: 469275970Scy 470275970Scy ENDIF :+][+: 471275970ScyENDFOR flag 472275970Scy 473275970Scy.\" = = = = = = = = = = = = = = = = = 474275970Scy.\" help option 475275970Scy.\" = = = = = = = = = = = = = = = = = 476275970Scy 477275970Scy:+] 478275970Scy.It [+: 479275970Scy (define tmp-val (get "help-value" "\\&?")) 480275970Scy (if (and use-flags (> (string-length tmp-val) 0)) 481275970Scy (string-append "Fl " tmp-val 482275970Scy (if (exist? "long-opts") " , Fl -help" "") ) 483275970Scy (string-append (if (exist? "long-opts") "Fl -" "") "help" ) 484275970Scy ) \:+] 485275970Scy 486275970ScyDisplay usage information and exit.[+:# 487275970Scy 488275970Scy.\" = = = = = = = = = = = = = = = = = 489275970Scy.\" more-help option 490275970Scy.\" = = = = = = = = = = = = = = = = = :+][+: 491275970Scy 492275970Scy IF (not (exist? "no-libopts")) :+] 493275970Scy.It [+: 494275970Scy (define tmp-val (get "more-help-value" "\\&!")) 495275970Scy (if (and use-flags (> (string-length tmp-val) 0)) 496275970Scy (string-append "Fl " tmp-val 497275970Scy (if (exist? "long-opts") " , Fl -more-help" "") ) 498275970Scy (string-append (if (exist? "long-opts") "Fl -" "") "more-help" ) 499275970Scy ) \:+] 500275970Scy 501275970ScyPass the extended usage information through a pager.[+: 502275970Scy 503275970ScyENDIF no no-libopts 504275970Scy 505275970Scy.\" = = = = = = = = = = = = = = = = = 506275970Scy.\" save and load configuration 507275970Scy.\" = = = = = = = = = = = = = = = = = :+][+: 508275970Scy 509275970ScyIF (exist? "homerc") :+] 510275970Scy.It [+: 511275970Scy 512275970Scy IF (not (exist? "disable-save")) :+][+: 513275970Scy 514275970Scy (define tmp-val (get "save-opts-value" ">")) 515275970Scy (if (and use-flags (> (string-length tmp-val) 0)) 516275970Scy (string-append "Fl " tmp-val " Oo Ar cfgfile Oc" 517275970Scy (if (exist? "long-opts") 518275970Scy " , Fl -save-opts Oo Ns = Ns Ar cfgfile Oc" ) "") 519275970Scy (string-append (if (exist? "long-opts") "Fl -" "") 520275970Scy "save-opts Oo Ns = Ns Ar cfgfile Oc" ) 521275970Scy ) \:+] 522275970Scy 523275970ScySave the option state to \fIcfgfile\fP. The default is the \fIlast\fP 524275970Scyconfiguration file listed in the \fBOPTION PRESETS\fP section, below. 525275970ScyThe command will exit after updating the config file. 526275970Scy.It [+: 527275970Scy ENDIF saving not disabled :+][+: 528275970Scy 529275970Scy (define tmp-val (get "load-opts-value" "<")) 530275970Scy (define tmp-str (if (exist? "long-opts") "Fl -" "")) 531275970Scy 532275970Scy (if (and use-flags (> (string-length tmp-val) 0)) 533275970Scy (string-append "Fl " tmp-val " Ar cfgfile" 534275970Scy (if (exist? "long-opts") 535275970Scy (string-append " , " tmp-str "load-opts Ns = Ns Ar cfgfile" 536275970Scy " , " tmp-str "no-load-opts" ) 537275970Scy "") ) 538275970Scy (string-append tmp-str "load-opts Ns = Ns Ar cfgfile , " 539275970Scy tmp-str "no-load-opts" ) 540275970Scy ) \:+] 541275970Scy 542275970ScyLoad options from \fIcfgfile\fP. 543275970ScyThe \fIno-load-opts\fP form will disable the loading 544275970Scyof earlier config/rc/ini files. \fI\-\-no-load-opts\fP is handled early, 545275970Scyout of order.[+: 546275970Scy 547275970ScyENDIF (exist? "homerc") 548275970Scy 549275970Scy.\" = = = = = = = = = = = = = = = = = 550275970Scy.\" version 551275970Scy.\" = = = = = = = = = = = = = = = = = :+][+: 552275970Scy 553275970ScyIF (exist? "version") :+] 554275970Scy.It [+: 555275970Scy 556275970Scy (define tmp-val (get "version-value" "v")) 557275970Scy (if (and use-flags (> (string-length tmp-val) 0)) 558275970Scy (string-append "Fl " tmp-val " Op Brq Ar v|c|n" 559275970Scy (if (exist? "long-opts") 560275970Scy " Fl -version Op Brq Ar v|c|n" ) "") 561275970Scy (string-append (if (exist? "long-opts") "Fl -" "") 562275970Scy "version Op Brq Ar v|c|n" ) 563275970Scy ) \:+] 564275970Scy 565275970ScyOutput version of program and exit. The default mode is `v', a simple 566275970Scyversion. The `c' mode will print copyright information and `n' will 567275970Scyprint the full copyright notice.[+: 568275970ScyENDIF :+] 569275970Scy.El 570275970Scy[+: 571275970Scy 572275970Scy(if formatted-doc 573275970Scy (shell (string-append 574275970Scy "fn='" (find-file cvt-cmd) 575275970Scy "'\ntest -f ${fn} || die '" cvt-cmd " not found'\n" 576275970Scy "${fn} <<\\_EndOfMdoc_ || die ${fn} failed in $PWD\n" 577275970Scy (out-pop #t) 578275970Scy "\n_EndOfMdoc_" )) ) :+][+: 579275970Scy 580275970ScyENDDEF mk-options 581275970Scy 582275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 583275970Scy.\" M K - O P T I O N - P R E S E T S 584275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 585275970Scy 586275970ScyDEFINE mk-option-presets \:+] 587275970ScyAny option that is not marked as \fInot presettable\fP may be preset 588275970Scyby loading values from [+: 589275970Scy IF (. home-rc-files) 590275970Scy :+]configuration ("RC" or ".INI") file(s)[+: 591275970Scy IF (. environ-init) :+] and values from 592275970Scy[+: 593275970Scy ENDIF :+][+: 594275970Scy ENDIF :+][+: 595275970Scy IF (. environ-init) :+]environment variables named: 596275970Scy.nf 597275970Scy \fB[+:(. UP-PROG-NAME):+]_<option-name>\fP or \fB[+:(. UP-PROG-NAME):+]\fP 598275970Scy.fi 599275970Scy.ad[+: 600275970Scy IF (. home-rc-files) :+] 601275970ScyThe environmental presets take precedence (are processed later than) 602275970Scythe configuration files.[+: 603275970Scy ENDIF :+][+: 604275970Scy ELSE :+].[+: 605275970Scy ENDIF :+][+: 606275970Scy 607275970Scy CASE 608275970Scy (define rc-file 609275970Scy (get "rcfile" (string-append "." (get "prog-name") "rc")) ) 610275970Scy (count "homerc") :+][+: 611275970Scy 612275970Scy == "0" :+][+: 613275970Scy == "1" :+][+: 614275970Scy 615275970Scy CASE homerc :+][+: 616275970Scy ~~ '\.|\$HOME' :+] 617275970ScyThe file "\fI[+: (string-append (get "homerc") "/" rc-file) 618275970Scy:+]\fP" will be used, if present.[+: 619275970Scy 620275970Scy == "" :+][+: 621275970Scy 622275970Scy * :+] 623275970ScyThe \fIhomerc\fP file is "\fI[+:homerc:+]\fP", unless that is a directory. 624275970ScyIn that case, the file "\fI[+: (. rc-file) :+]\fP" 625275970Scyis searched for within that directory.[+: 626275970Scy ESAC :+][+: 627275970Scy 628275970Scy * :+] 629275970ScyThe \fIhomerc\fP files are [+: 630275970Scy FOR homerc ", " :+][+: 631275970Scy IF (last-for?) :+]and [+: 632275970Scy ENDIF :+]"\fI[+: homerc :+]\fP"[+: ENDFOR :+]. 633275970ScyIf any of these are directories, then the file \fI[+: (. rc-file) :+]\fP 634275970Scyis searched for within those directories.[+: 635275970Scy ESAC :+][+: 636275970Scy 637275970ScyENDDEF mk-option-presets 638275970Scy 639275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 640275970Scy.\" M K - E X I T - S T A T U S 641275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 642275970Scy 643275970ScyDEFINE mk-exit-status \:+] 644275970ScyOne of the following exit values will be returned: 645275970Scy.Bl -tag 646275970Scy[+: 647275970Scy(ag-fprintf 0 ".It 0 \" (EXIT_%s)\"\n%s\n" 648275970Scy (string->c-name! (string-upcase (get "exit-name[0]" "SUCCESS"))) 649275970Scy (get "exit-desc[0]" "Successful program execution.") ) 650275970Scy 651275970Scy(define need-ex-noinput (exist? "homerc")) 652275970Scy(define need-ex-software #t) 653275970Scy 654275970Scy(ag-fprintf 0 ".It 1 \" (EXIT_%s)\"\n%s\n" 655275970Scy (string->c-name! (string-upcase (get "exit-name[1]" "FAILURE"))) 656275970Scy (get "exit-desc[1]" 657275970Scy "The operation failed or the command syntax was not valid.")) :+][+: 658275970Scy 659275970ScyFOR exit-desc (for-from 2) :+][+: 660275970Scy (if (= (for-index) 66) 661275970Scy (set! need-ex-noinput #f) 662275970Scy (if (= (for-index) 70) 663275970Scy (set! need-ex-software #f) )) 664275970Scy 665275970Scy (set! tmp-str (get (sprintf "exit-name[%d]" (for-index)) "* unnamed *")) 666275970Scy (sprintf ".It %d \" (EXIT_%s)\"\n%s\n" 667275970Scy (for-index) 668275970Scy (string-upcase (string->c-name! tmp-str)) 669275970Scy (get "exit-desc" "")) :+][+: 670275970ScyENDFOR exit-desc :+][+: 671275970Scy(if need-ex-noinput 672275970Scy (emit ".It 66 \" (EX_NOINPUT)\" 673275970ScyA specified configuration file could not be loaded.\n")) 674275970Scy 675275970Scy(if need-ex-software 676275970Scy (emit ".It 70 \" (EX_SOFTWARE)\" 677275970Scylibopts had an internal operational error. Please report 678275970Scyit to autogen-users@lists.sourceforge.net. Thank you.\n")) 679275970Scy 680275970Scy(if (> (string-length fname-line) 1) 681275970Scy (emit fname-line)) :+] 682275970Scy.El 683275970Scy[+: 684275970Scy 685275970ScyENDDEF mk-exit-status 686275970Scy 687275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 688275970Scy.\" M K - A U T H O R S 689275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 690275970Scy 691275970ScyDEFINE mk-authors :+][+: 692275970Scy 693275970Scy (define remove-authors #t) 694275970Scy 695275970Scy (set! tmp-val 696275970Scy (if (exist? "copyright.author") 697275970Scy (stack-join ",\n" "copyright.author") 698275970Scy (stack-join ",\n" "copyright.owner") )) 699275970Scy 700275970Scy (if (> (string-length tmp-val) 1) 701275970Scy (string-append tmp-val "\n") 702275970Scy (delete-file file-name)) 703275970Scy 704275970Scy :+][+: 705275970Scy 706275970ScyENDDEF mk-authors 707275970Scy 708275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 709275970Scy.\" M K - B U G S 710275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 711275970Scy 712275970ScyDEFINE mk-bugs :+][+: 713275970Scy 714275970Scy (set! tmp-val (get "copyright.eaddr" (get "eaddr"))) 715275970Scy (if (> (string-length tmp-val) 1) 716275970Scy (string-append "Please send bug reports to: " tmp-val "\n") 717275970Scy (delete-file file-name) ) 718275970Scy :+][+: 719275970Scy 720275970ScyENDDEF mk-bugs :+][+: 721275970Scy 722275970ScyDEFINE append-bugs :+][+: 723275970Scy 724275970Scy (set! tmp-val (get "copyright.eaddr" (get "eaddr"))) 725275970Scy (if (> (string-length tmp-val) 1) 726275970Scy (string-append "\n.Pp\nPlease send bug reports to: " tmp-val "\n") ) 727275970Scy :+][+: 728275970Scy 729275970ScyENDDEF append-bugs 730275970Scy 731275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 732275970Scy.\" M K - C O P Y R I G H T (+ licensing) 733275970Scy.\" 734275970Scy.\" This section is guaranteed to be the last section in the man page 735275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 736275970Scy 737275970ScyDEFINE mk-copyright \:+] 738275970ScyCopyright (C) [+: copyright.date :+] [+: 739275970Scy (get "copyright.owner" (get "copyright.author" (get "copyright.eaddr"))) 740275970Scy :+] all rights reserved. 741275970Scy[+: CASE (get "copyright.type") :+][+: 742275970Scy = note :+][+: (get "copyright.text") :+][+: 743275970Scy == '' :+]This program has an unspecified license.[+: 744275970Scy 745275970Scy * :+][+: 746275970Scy (string-append "This program is released under the terms of " 747275970Scy (license-name (get "copyright.type")) ".") :+][+: 748275970Scy 749275970Scy ESAC :+] 750275970Scy[+: 751275970ScyENDDEF mk-copyright 752275970Scy 753275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 754275970Scy.\" M K - N O T E S 755275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 756275970Scy 757275970ScyDEFINE mk-notes \:+] 758275970ScyThis manual page was \fIAutoGen\fP-erated from the \fB[+: prog-name :+]\fP 759275970Scyoption definitions. 760275970Scy[+: 761275970Scy 762275970ScyENDDEF mk-notes 763275970Scy 764275970Scy.\" = = = = = APPEND TO IT: :+][+: 765275970Scy 766275970ScyDEFINE append-notes :+] 767275970Scy.Pp 768275970ScyThis manual page was \fIAutoGen\fP-erated from the \fB[+: prog-name :+]\fP 769275970Scyoption definitions.[+: 770275970Scy 771275970ScyENDDEF append-notes 772275970Scy 773275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 774275970Scy.\" M K - E N V I R O N M E N T 775275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 776275970Scy 777275970ScyDEFINE mk-environment :+][+: 778275970Scy INVOKE append-environment :+][+: 779275970ScyENDDEF mk-environment 780275970Scy 781275970Scy.\" = = = = = APPEND TO IT: :+][+: 782275970Scy 783275970ScyDEFINE append-environment :+] 784275970Scy[+:(. environ-text) :+][+: 785275970ScyENDDEF append-environment 786275970Scy 787275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 788275970Scy.\" M K - F I L E S 789275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 790275970Scy 791275970ScyDEFINE mk-files :+][+: 792275970Scy INVOKE append-files :+][+: 793275970ScyENDDEF mk-files 794275970Scy 795275970Scy.\" = = = = = APPEND TO IT: :+][+: 796275970Scy 797275970ScyDEFINE append-files :+] 798275970Scy[+:(. home-rc-text) :+][+: 799275970ScyENDDEF append-files 800275970Scy 801275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 802275970Scy.\" E M I T A L I A S O P T 803275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 804275970Scy 805275970ScyDEFINE emit-alias-opt :+] 806275970Scy.It [+: 807275970Scy IF (exist? "value") :+][+: 808275970Scy IF (exist? "long-opts") \:+] 809275970Scy Fl [+:value:+] , Fl \-[+: name :+][+: 810275970Scy ELSE \:+] 811275970Scy Fl [+:value:+][+: 812275970Scy ENDIF (exist? "long-opts") :+][+: 813275970Scy 814275970Scy ELSE value does not exist -- named option only :+][+: 815275970Scy 816275970Scy IF (not (exist? "long-opts")) \:+] 817275970Scy [+: name :+][+: 818275970Scy ELSE \:+] 819275970Scy Fl \-[+: (get "name") :+][+: 820275970Scy ENDIF :+][+: 821275970Scy ENDIF :+] 822275970ScyThis is an alias for the \fI--[+: aliases :+]\fR option.[+: 823275970Scy IF (exist? "deprecated") :+] 824275970Scy.sp 825275970Scy.B 826275970ScyNOTE: THIS OPTION IS DEPRECATED 827275970Scy[+: 828275970Scy ENDIF :+][+: 829275970ScyENDDEF emit-alias-opt 830275970Scy 831275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 832275970Scy.\" E M I T F L A G T E X T 833275970Scy.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+: 834275970Scy 835275970ScyDEFINE emit-flag-text :+][+: 836275970Scy 837275970Scy (if (exist? "enable") 838275970Scy (set! opt-name (string-append (get "enable") "-" (get "name"))) 839275970Scy (set! opt-name (get "name")) ) 840275970Scy (if (exist? "disable") 841275970Scy (set! dis-name (string-append (get "disable") "-" (get "name"))) 842275970Scy (set! dis-name "") ) 843275970Scy 844275970Scy (set! opt-name (fix-optname opt-name)) 845275970Scy (if (> (string-length dis-name) 0) 846275970Scy (set! dis-name (fix-optname dis-name)) ) 847275970Scy 848275970Scy (if (not (exist? "arg-type")) 849275970Scy (set! opt-arg "") 850275970Scy (set! opt-arg (string-append "Ar " 851275970Scy (fix-optname (if (exist? "arg-name") 852275970Scy (get "arg-name") 853275970Scy (string-downcase! (get "arg-type")) )) 854275970Scy )) 855275970Scy ) 856275970Scy 857275970Scy:+] 858275970Scy.It [+: 859275970Scy IF (exist? "value") :+][+: 860275970Scy IF (exist? "long-opts") :+][+: 861275970Scy 862275970Scy # * * * * * * * * * * * * * * * * * * * * 863275970Scy * 864275970Scy * The option has a flag value (character) AND 865275970Scy * the program uses long options 866275970Scy * 867275970Scy \:+] 868275970Scy Fl [+:value:+][+: 869275970Scy IF (not (exist? "arg-type")) :+] , Fl -[+: 870275970Scy ELSE :+] [+:(. opt-arg):+] , Fl -[+: 871275970Scy ENDIF :+][+: (. opt-name) :+] [+: 872275970Scy IF (exist? "arg-type") :+][+: 873275970Scy ? arg-optional Oo Ns = Ns 874275970Scy :+] [+: (. opt-arg) :+] [+: 875275970Scy arg-optional Oc :+][+: 876275970Scy ENDIF :+][+: 877275970Scy IF (exist? "disable") :+] , Fl -[+:(. dis-name):+][+: 878275970Scy ENDIF :+][+: 879275970Scy 880275970Scy ELSE :+][+: 881275970Scy 882275970Scy # * * * * * * * * * * * * * * * * * * * * 883275970Scy * 884275970Scy * The option has a flag value (character) BUT 885275970Scy * the program does _NOT_ use long options 886275970Scy * 887275970Scy \:+] 888275970Scy Fl [+:value:+] [+: 889275970Scy IF (exist? "arg-type") :+][+: 890275970Scy arg-optional Oo :+] [+:(. opt-arg):+] [+: 891275970Scy arg-optional Oc :+] [+: 892275970Scy ENDIF " :+][+: 893275970Scy ENDIF (exist? "long-opts") :+][+: 894275970Scy 895275970Scy 896275970Scy ELSE value does not exist -- named option only :+][+: 897275970Scy 898275970Scy IF (not (exist? "long-opts")) :+][+: 899275970Scy 900275970Scy # * * * * * * * * * * * * * * * * * * * * 901275970Scy * 902275970Scy * The option does not have a flag value (character). 903275970Scy * The program does _NOT_ use long options either. 904275970Scy * Special magic: All arguments are named options. 905275970Scy * 906275970Scy \:+] 907275970Scy [+: (. opt-name) :+] [+: 908275970Scy IF (exist? "arg-type") :+] [+: 909275970Scy ? arg-optional ' Oo = Ns' ' Ns = Ns ' 910275970Scy :+] [+:(. opt-arg) :+] [+: 911275970Scy arg-optional Oc :+] [+: 912275970Scy ENDIF:+][+: 913275970Scy IF (exist? "disable") :+] , Fl -[+:(. dis-name):+][+: 914275970Scy ENDIF :+][+: 915275970Scy 916275970Scy 917275970Scy ELSE :+][+: 918275970Scy # * * * * * * * * * * * * * * * * * * * * 919275970Scy * 920275970Scy * The option does not have a flag value (character). 921275970Scy * The program, instead, only accepts long options. 922275970Scy * 923275970Scy \:+] 924275970Scy Fl -[+: (. opt-name) :+] [+: 925275970Scy 926275970Scy IF (exist? "arg-type") :+][+: 927275970Scy arg-optional Oo :+] Ns = Ns [+:(. opt-arg):+] [+: 928275970Scy arg-optional Oc :+][+: 929275970Scy ENDIF :+][+: 930275970Scy 931275970Scy IF (exist? "disable") 932275970Scy :+], " Fl \-[+:(. dis-name):+]"[+: 933275970Scy ENDIF :+][+: 934275970Scy ENDIF :+][+: 935275970Scy ENDIF :+] 936275970Scy[+: (get "descrip" "") :+].[+: 937275970Scy 938275970Scy IF (exist? "min") :+] 939275970ScyThis option is required to appear.[+: 940275970Scy ENDIF :+][+: 941275970Scy 942275970Scy IF (exist? "max") :+] 943275970ScyThis option may appear [+: 944275970Scy IF % max (= "%s" "NOLIMIT") 945275970Scy :+]an unlimited number of times[+:ELSE 946275970Scy :+]up to [+: max :+] times[+: 947275970Scy ENDIF:+].[+: 948275970Scy ENDIF:+][+: 949275970Scy 950275970Scy IF (exist? "disable") :+] 951275970ScyThe \fI[+:(. dis-name):+]\fP form will [+: 952275970Scy IF (exist? "stack-arg") 953275970Scy :+]clear the list of option arguments[+: 954275970Scy ELSE :+]disable the option[+: 955275970Scy ENDIF :+].[+: 956275970Scy ENDIF:+][+: 957275970Scy 958275970Scy IF (exist? "enabled") :+] 959275970ScyThis option is enabled by default.[+: 960275970Scy ENDIF :+][+: 961275970Scy 962275970Scy IF (exist? "no-preset") :+] 963275970ScyThis option may not be preset with environment variables 964275970Scyor in initialization (rc) files.[+: 965275970Scy ENDIF :+][+: 966275970Scy 967275970Scy IF (and (exist? "default") named-mode) :+] 968275970ScyThis option is the default option.[+: 969275970Scy ENDIF :+][+: 970275970Scy 971275970Scy IF (exist? "equivalence") :+] 972275970ScyThis option is a member of the [+:equivalence:+] class of options.[+: 973275970Scy ENDIF :+][+: 974275970Scy 975275970Scy IF (exist? "flags-must") :+] 976275970ScyThis option must appear in combination with the following options: 977275970Scy[+: FOR flags-must ", " :+][+:flags-must:+][+:ENDFOR:+].[+: 978275970Scy ENDIF :+][+: 979275970Scy 980275970Scy IF (exist? "flags-cant") :+] 981275970ScyThis option must not appear in combination with any of the following options: 982275970Scy[+: FOR flags-cant ", " :+][+:flags-cant:+][+:ENDFOR:+].[+: 983275970Scy ENDIF :+][+: 984275970Scy 985275970Scy 986275970Scy IF (~* (get "arg-type") "key|set") :+] 987275970ScyThis option takes a keyword as its argument[+: 988275970Scy 989275970Scy IF (=* (get "arg-type") "set") 990275970Scy 991275970Scy:+] list. Each entry turns on or off 992275970Scymembership bits. The bits are set by name or numeric value and cleared 993275970Scyby preceding the name or number with an exclamation character ('!'). 994275970ScyThey can all be cleared with the magic name \fInone\fR and they can all be set 995275970Scywith 996275970Scy.IR all . 997275970ScyA single option will process a list of these values.[+: 998275970Scy 999275970Scy ELSE 1000275970Scy 1001275970Scy:+]. The argument sets an enumeration value that can 1002275970Scybe tested by comparing them against the option value macro.[+: 1003275970Scy 1004275970Scy ENDIF 1005275970Scy 1006275970Scy:+] 1007275970ScyThe available keywords are: 1008275970Scy.in +4 1009275970Scy.nf 1010275970Scy.na 1011275970Scy[+: (shellf "${CLexe} --indent='' --spread=1 -W50 <<_EOF_\n%s\n_EOF_" 1012275970Scy (join "\n" (stack "keyword")) ) :+] 1013275970Scy.fi 1014275970Scyor their numeric equivalent. 1015275970Scy.in -4[+: (if (exist? "arg-default") "\n.sp" ) :+][+: 1016275970Scy 1017275970Scy ELIF (=* (get "arg-type") "num") :+] 1018275970ScyThis option takes an integer number as its argument.[+: 1019275970Scy 1020275970Scy IF (exist? "arg-range") :+] 1021275970ScyThe value of 1022275970Scy.[+:(. opt-arg):+] 1023275970Scyis constrained to being: 1024275970Scy.in +4 1025275970Scy.nf 1026275970Scy.na[+:FOR arg_range ", or" :+] 1027275970Scy[+: (shellf " 1028275970Scyrange='%s' 1029275970Scy 1030275970Scycase \"X${range}\" in 1031275970ScyX'->'?* ) 1032275970Scy echo \"less than or equal to\" ` 1033275970Scy echo $range | sed 's/->//' ` ;; 1034275970Scy 1035275970ScyX?*'->' ) 1036275970Scy echo \"greater than or equal to\" ` 1037275970Scy echo $range | sed 's/->.*//' ` ;; 1038275970Scy 1039275970ScyX?*'->'?* ) 1040275970Scy echo \"in the range \" ` 1041275970Scy echo $range | sed 's/->/ through /' ` ;; 1042275970Scy 1043275970ScyX?* ) 1044275970Scy echo exactly $range ;; 1045275970Scy 1046275970ScyX* ) echo $range is indeterminate 1047275970Scyesac" 1048275970Scy 1049275970Scy(get "arg-range") ) 1050275970Scy:+][+: 1051275970Scy ENDFOR arg-range :+] 1052275970Scy.fi 1053275970Scy.in -4[+: 1054275970Scy 1055275970Scy ENDIF arg-range exists :+][+: 1056275970Scy 1057275970Scy ENDIF arg-type key/set/num :+][+: 1058275970Scy 1059275970Scy IF (exist? "arg-default") :+] 1060275970ScyThe default 1061275970Scy.[+: (. opt-arg) :+] 1062275970Scyfor this option is: 1063275970Scy.ti +4 1064275970Scy [+: (join " + " (stack "arg-default" )) :+][+: 1065275970Scy ENDIF :+] 1066275970Scy.sp 1067275970Scy[+: 1068275970Scy (if (exist? "doc") (string-substitute (get "doc" "") "\n\n" "\n.sp\n") 1069275970Scy "This option has not been fully documented." ) :+][+: 1070275970Scy IF (exist? "deprecated") :+] 1071275970Scy.sp 1072275970Scy.B 1073275970ScyNOTE: THIS OPTION IS DEPRECATED 1074275970Scy[+: 1075275970Scy ENDIF :+][+: 1076275970Scy 1077275970ScyENDDEF emit-flag-text 1078275970Scy 1079275970Scy.\" cmd-doc.tlib ends here \:+] 1080