#!/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

Klone v%1 on-line documentation

Fill in one of these forms:


Enter the precise name you are looking for:
:

Or look for all entries containing the substring:
:
Case Sensitive Regular Expression
Search scope: All Only built-ins (C) Only autoloadable (Klone)
Colas Nahaboo
Everything is done by a Klone script that can display itself!
" (+ cgi:script-name "/form") ; %0 *version* ; %1 ) ) (defun show-manual (string &aux (result (smartdoc:help string)) ) (if result (progn (PF "Klone on-line doc: %0

Klone on-line documentation

Documentation of %0:

\n" string ) (if (> (length result) 1) (PF "%0 documentations found:

\n" (length result)) ) (dolist (text result) (PF "


%n0

\n" (html:quote-pre text)) ) (PF "


retry another search?" (+ "http://" (getenv "SERVER_NAME") ":" (getenv "SERVER_PORT") cgi:script-name ) ) ) (progn ;not found (PF "Klone on-line doc: %0

Documentation of %0 not found!

No symbol of name %0 could be found in the Klone v%1 online documentation, do you want to

\n" string *version* (+ "http://" (getenv "SERVER_NAME") ":" (getenv "SERVER_PORT") cgi:script-name ) (+ "http://" (getenv "SERVER_NAME") ":" (getenv "SERVER_PORT") cgi:script-name "/apropos?" string ) ) ) ) ) (defun show-apropos (string &key from quote case &aux (text (copy "")) (fd (open text :type :string :direction :io)) line (re (regcomp "^([^ ]*) *- *(.*)$")) (query-url (+ "http://" (getenv "SERVER_NAME") ":" (getenv "SERVER_PORT") cgi:script-name "/manual?" )) ) (with (*standard-output* fd) (apply apropos (list string :from from :quote quote :case case)) (flush ()) ) (if (/= text "") (progn (PF "Klone on-line apropos: %0

Klone on-line documentation

Apropos of %0:

\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 "Klone on-line apropos: %0

Klone on-line documentation

Apropos of %0:

nothing could be found!\n" string ) ) (PF "


retry another search?" (+ "http://" (getenv "SERVER_NAME") ":" (getenv "SERVER_PORT") cgi:script-name ) ) ) (defun show-script (path) (PF "Klone on-line doc script source

Klone v%1 on-line doc script

This is my body... Click here to see my output.


%0

" (html:quote-pre (String (open path))) ; %0 *version* ; %1 (+ "http://" (getenv "SERVER_NAME") ":" (getenv "SERVER_PORT") cgi:script-name ) ; %2 )) (main) ;;; EMACS MODES ;;; Local Variables: *** ;;; mode:lisp *** ;;; End: ***