25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
(define (args:usage . args)
(if (> (length args) 0)
(apply print "ERROR: " args))
(if (string? help)
(print help)
(print "Usage: " (car (argv)) " ... "))
(exit 0))
;; args:
(define (args:get-args args params switches arg-hash num-needed)
(let* ((numargs (length args))
(adj-num-needed (if num-needed (+ num-needed 2) #f)))
(if (< numargs (if adj-num-needed adj-num-needed 2))
(if (>= num-needed 1)
|
>
>
>
>
>
>
>
>
>
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
(define (args:usage . args)
(if (> (length args) 0)
(apply print "ERROR: " args))
(if (string? help)
(print help)
(print "Usage: " (car (argv)) " ... "))
(exit 0))
;; one-of args defined
(define (args:any-defined? . param)
(let ((res #f))
(for-each
(lambda (arg)
(if (args:get-arg arg)(set! res #t)))
param)
res))
;; args:
(define (args:get-args args params switches arg-hash num-needed)
(let* ((numargs (length args))
(adj-num-needed (if num-needed (+ num-needed 2) #f)))
(if (< numargs (if adj-num-needed adj-num-needed 2))
(if (>= num-needed 1)
|