/usr/share/guile/app/gwave/std-args.scm is in gwave 20090213-6.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | ;
; module providing gwave's standard command-line argument parsing.
;
(define-module (app gwave std-args)
:use-module (ice-9 getopt-long)
:use-module (ice-9 common-list)
:use-module (app gwave cmds)
:use-module (app gwave export)
)
(debug-enable 'debug)
(read-enable 'positions)
(dbprint "std-args.scm running\n")
;
; TODO: better checking of option arguments;
; make sure numeric ones are numbers, and within valid range.
;
(define opts
(catch 'misc-error
(lambda ()
(getopt-long (program-arguments)
`((nobacktrace (single-char #\n))
(panels (single-char #\p) (value #t))
(script (single-char #\s) (value #t))
(verbose (single-char #\v))
(debug (single-char #\x))
)))
(lambda (key args . rest)
(apply display-error #f (current-error-port) args rest)
; todo: usage message
(exit 1)
)))
(define verbose
(let ((a (assq 'verbose opts)))
(if a
(cdr a)
#f)))
(let ((a (assq 'panels opts)))
(if a
(set! initial-panels (string->number (cdr a)))))
(define startup-script #f)
(let ((s (assq 'script opts)))
(if s
(if (string? (cdr s))
(set! startup-script (cdr s)))))
(define cmdline-files (pick string? (assq '() opts)))
;(display "opts:") (display opts) (newline)
;(display "script:") (display startup-script)(newline)
;(display "args: verbose=")(display verbose)
;(display " npanels=")(display npanels)
;(display " files=")
;(for-each (lambda (f)
; (begin (display f) (display " ")))
; cmdline-files)
;(newline)
;
; wave window hook to load files listed on the command line and
; create initial panels.
; We use append-hook so that the menubar is already created; this way
; the view->variable list menu item works properly for these.
(append-hook!
new-wavewin-hook
(lambda ()
(dbprint "in std-args new-wavewin-hook\n")
; load files listed on the command line
(for-each (lambda (f)
(load-wavefile! f))
cmdline-files)
; add the initial set of panels
(do ((i 0 (+ i 1))) ((>= i initial-panels))
(wtable-insert-typed-panel! #f default-wavepanel-type))
; execute script specified with -s
(if startup-script
(load startup-script))
))
(dbprint "std-args.scm done\n")
|