/usr/bin/s9help is in scheme9 2010.11.13-2.
This file is owned by root:root, with mode 0o755.
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 | #! /usr/bin/s9 -f
; s9help -- find and display S9fES help pages
; by Nils M Holm, 2010
; See the LICENSE file of the S9fES package for terms of use
;
; Usage: s9help [-als] topic ...
;
; Options:
;
; -a find any match (default: full words only)
; -l long results (including context)
; -s search help pages (default: display)
(load-from-library "find-help.scm")
(load-from-library "name-to-file-name.scm")
(load-from-library "read-line.scm")
(load-from-library "parse-optionsb.scm")
(define search (option #\s #f))
(define long (option #\l #f))
(define any-match (option #\a #f))
(define show-help (option #\h #f))
(define options `(,search
,long
,any-match
,show-help))
(define (usage)
(display "Usage: s9help [-als] topic ...")
(newline))
(define (display-help topic)
(let ((path (string-append (find-help-path)
"/"
(name->file-name topic))))
(if (not (file-exists? path))
(begin (display* "s9: " topic ": help file not found" #\newline)
(sys:exit 1)))
(with-input-from-file
path
(lambda ()
(newline)
(let print ((line (read-line)))
(if (eof-object? line)
(newline)
(begin (display line)
(newline)
(print (read-line)))))))))
(let ((topic* (parse-options! (sys:command-line) options usage)))
(if (opt-val show-help)
(begin (display-usage
`(""
,usage
""
"Find and display S9fES help pages"
""
"-a find any match (default: full words only)"
"-l long results (including context)"
"-s search help pages (default: display)"
""))
(sys:exit 0)))
(let ((topic* (if (null? topic*)
(begin (usage)
(sys:exit 1))
topic*)))
(for-each (lambda (topic)
(if (opt-val search)
(find-help topic
(string-append
"p"
(if (opt-val long) "l" "")
(if (opt-val any-match) "a" "")))
(display-help topic)))
topic*)))
|