home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
m
/
me_cd25.zip
/
ME2MUTT.ZIP
/
CMDLINE.MUT
< prev
next >
Wrap
Lisp/Scheme
|
1992-11-09
|
1KB
|
47 lines
;; cmdline.mut : process the command line
;; To install this stuff, put a call to process-command-line in the MAIN of
;; init.mut. This should be the last thing called.
;; Note: Having the next-file function defined in here is a kludge. I
;; should have hooks in here so that nextfile.mut (or anybody else) can
;; access the info needed.
;; C Durland Public Domain
(include me2.h)
(small-int nth-file) ;; file to load next
;; Process command lines of the form:
;; me [+<line number>] [-option ...] [filename ...]
;; options:
;; -view : read files in read only form
(defun process-command-line ;HIDDEN
{
(int options line-number)
(if (== (options 1) (argc)) (done)) ;; no options
(line-number 0)
;; look for +
(if (== "+" (extract-elements (argv 1) 0 1)) ;; +<line number>
{
(line-number (convert-to NUMBER (extract-elements (argv options) 1 100)))
(+= options 1)
})
;; process the "-" options
(while (== "-" (extract-elements (argv options) 0 1))
{
(switch (extract-elements (argv options) 1 100)
"view" (register-hook IREAD-FILE-HOOK "read-only")
default (msg "Unknow option: " (argv options))
)
(+= options 1)
})
; (nth-file options)
; (next-file)
; (goto-line line-number)
})
;;;!!!??? ack - only want command line files read only???
(defun read-only { (make-buffer-read-only) })