;;; Get the first non-ignored word from a list.
(defun dun-firstword (list)
- (if (not (car list))
- nil
- (while (and list (member (intern (car list)) dun-ignore))
+ (when (car list)
+ (while (and list (memq (intern (car list)) dun-ignore))
(setq list (cdr list)))
(car list)))
(defun dun-firstwordl (list)
- (if (not (car list))
- nil
- (while (and list (member (intern (car list)) dun-ignore))
+ (when (car list)
+ (while (and list (memq (intern (car list)) dun-ignore))
(setq list (cdr list)))
list))
(setq dun-badcd t))
(defun dun-cat (args)
- (let (doto checklist)
- (if (not (setq args (car args)))
- (dun-mprincl "Usage: cat <ascii-file-name>")
- (if (string-match "/" args)
- (dun-mprincl "cat: only files in current directory allowed.")
- (if (and (> dun-cdroom 0) (string= args "description"))
- (dun-mprincl (car (nth dun-cdroom dun-rooms)))
- (if (setq doto (string-match "\\.o" args))
- (progn
- (if (= dun-cdroom -10)
- (setq checklist dun-inventory)
- (setq checklist (nth dun-cdroom dun-room-objects)))
- (if (not (member (cdr
- (assq (intern
- (substring args 0 doto))
- dun-objnames))
- checklist))
- (dun-mprincl "File not found.")
- (dun-mprincl "Ascii files only.")))
- (if (assq (intern args) dun-unix-verbs)
- (dun-mprincl "Ascii files only.")
- (dun-mprincl "File not found."))))))))
+ (cond
+ ((null (setq args (car args)))
+ (dun-mprincl "Usage: cat <ascii-file-name>"))
+ ((string-match-p "/" args)
+ (dun-mprincl "cat: only files in current directory allowed."))
+ ((and (> dun-cdroom 0) (string= args "description"))
+ (dun-mprincl (car (nth dun-cdroom dun-rooms))))
+ ((string-match "\\.o" args)
+ (let ((doto (match-beginning 0)) checklist)
+ (if (= dun-cdroom -10)
+ (setq checklist dun-inventory)
+ (setq checklist (nth dun-cdroom dun-room-objects)))
+ (if (member (cdr (assq (intern (substring args 0 doto)) dun-objnames))
+ checklist)
+ (dun-mprincl "Ascii files only.")
+ (dun-mprincl "File not found."))))
+ ((assq (intern args) dun-unix-verbs)
+ (dun-mprincl "Ascii files only."))
+ (t (dun-mprincl "File not found."))))
(defun dun-rlogin-endgame ()
(if (not (= (dun-score nil) 90))