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 >
Lisp/Scheme  |  1992-11-09  |  1KB  |  47 lines

  1. ;; cmdline.mut : process the command line
  2. ;; To install this stuff, put a call to process-command-line in the MAIN of
  3. ;;   init.mut.  This should be the last thing called.
  4. ;; Note:  Having the next-file function defined in here is a kludge.  I
  5. ;;   should have hooks in here so that nextfile.mut (or anybody else) can
  6. ;;   access the info needed.
  7. ;; C Durland    Public Domain
  8.  
  9. (include me2.h)
  10.  
  11. (small-int nth-file)        ;; file to load next
  12.  
  13.  
  14.   ;; Process command lines of the form:
  15.   ;;   me [+<line number>] [-option ...] [filename ...]
  16.   ;;     options:
  17.   ;;       -view : read files in read only form
  18. (defun process-command-line ;HIDDEN
  19. {
  20.   (int options line-number)
  21.  
  22.   (if (== (options 1) (argc)) (done))        ;; no options
  23.   (line-number 0)
  24.     ;; look for +
  25.   (if (== "+" (extract-elements (argv 1) 0 1))    ;; +<line number>
  26.   {
  27.     (line-number (convert-to NUMBER (extract-elements (argv options) 1 100)))
  28.     (+= options 1)
  29.   })
  30.     ;; process the "-" options
  31.   (while (== "-" (extract-elements (argv options) 0 1))
  32.   {
  33.     (switch (extract-elements (argv options) 1 100)
  34.       "view" (register-hook IREAD-FILE-HOOK  "read-only")
  35.       default (msg "Unknow option: " (argv options))
  36.     )
  37.     (+= options 1)
  38.   })
  39. ;  (nth-file options)
  40. ;  (next-file)
  41.   
  42. ;  (goto-line line-number)
  43. })
  44.  
  45. ;;;!!!??? ack - only want command line files read only???
  46. (defun read-only { (make-buffer-read-only) })
  47.