#!/bin/sh
: ; exec klone $0 "$@"
; The above line finds the klone executable in the $PATH
(setq max-level *maxint*)
;;verbose error dump
(mail-stack-dump-on-error-to "colas@sa.inria.fr" 0
'(PF "
ERROR
Sorry, there was an error in the script!
Details are being mailed to maintainer..
"))
;;(kdb t)
;(:= args (getopts "USAGE:"
; ("-v" () verbose "verbose operation")
;))
;; add here the path of the klone library accesible for cgi scripts:
;;(insert *load-pathname* 0 "/users/colas/Klone/src/kl")
;; a sample script to access the klone documentation
(defun main (&aux
)
(cgi:init :error "/u/koala/0/koala/colas/t/colas-klone-cgi-errors")
;; first, decide what want the user?
(if
(= cgi:path-info "") ;no subpart? mainpage
(show-main-page)
(= cgi:path-info "/manual") ;a query from an URL (from apropos)
(show-manual cgi:query-string)
(= cgi:path-info "/apropos") ;a query from an URL (from manual)
(show-apropos cgi:query-string)
(= cgi:path-info "/form-manual") ; a query from tha form (manual)
(show-manual #[cgi:arguments "manual"])
(= cgi:path-info "/form-apropos") ;a query from tha form (apropos)
(show-apropos #[cgi:arguments "apropos"]
:from #[cgi:arguments "from"]
:quote (not #[cgi:arguments "regexp"])
:case #[cgi:arguments "case_sensitive"]
)
(= cgi:path-info "/form-script") ; a query from tha form (manual)
(show-script #[*arguments* 0])
(PF "Unknown command!\n") ;there is a ball in the soup
)
(cgi:end :validity 15)
)
(defun show-main-page ()
(PF "Klone on-line documentation
\n"
string
)
(file-position fd 0)
(while (setq line (read-line fd ()))
(if (regexec re line)
(PF " %1%2\n"
(+ query-url (regsub re 1)) (regsub re 1) (regsub re 2)
)
(PF " could not parse: %0\n" line)
)))
;; not found
(PF "