anchor.diff:                (t (error "Invalid option ~A" opt))))
         (dolist (entry
                   (sort
  -                 (DELETE-DUPLICATES
  +                 (delete-duplicates
                     ;; SBCL RETURNS DIRECTORIES FOR "*" AS WELL AS FOR "*/".
                     (mapcan
                      (lambda (path) (handler-case (directory path) (error () nil)))
  
positive.code:   (apply (function more) :page nil paths))
    
  
  (DEFVAR *DIRECTORY-STACK* NIL)
  
  
  (DEFUN CD (&OPTIONAL PATH)
    "COMMAND
  DO:         Change the working directory.
  ARGUMENTS:  The path of the new working directory.
              If not given, then change to the user home directory.
  "
    (CHANGE-WORKING-DIRECTORY
     (if path
         (resolve path  :directory t)
         (USER-HOMEDIR-PATHNAME))))
  
  
  (DEFUN PWD   ()
    "COMMAND
  DO:         Returns the current working directory.
  "
    (WORKING-DIRECTORY))
  
  
  (DEFUN POPD  ()
    "COMMAND
  DO:         Unstack the working directory from the stack.
  "
    (IF *DIRECTORY-STACK*
        (CONS (CHANGE-WORKING-DIRECTORY (POP *DIRECTORY-STACK*)) *DIRECTORY-STACK*)
        (LIST (WORKING-DIRECTORY))))
  
  
  (DEFUN PUSHD (&OPTIONAL PATH)
    "COMMAND
  DO:         Push the current working directory onto the stack, and
              change the working directory to the path (or home directory).
  SEE;        POPD, CD.
  "
    (IF PATH
        (PROGN
          (PUSH (WORKING-DIRECTORY) *DIRECTORY-STACK*)
          (CONS (CD PATH) *DIRECTORY-STACK*))
        (LET ((TOP (POP *DIRECTORY-STACK*)))
          (PUSH (WORKING-DIRECTORY) *DIRECTORY-STACK*)
          (CONS (CD TOP)  *DIRECTORY-STACK*))))
  
  
  ;;;; THE END ;;;;
  
negative.code:                              path nil))))
  
  
  (defun change-working-directory (path)
    (multiple-value-bind (exists-p dirpath) (check-directories-exist path)
      (if exists-p
          (progn
            ;; (print (list path dirpath (truename dirpath)))
            (setf *working-directory* (truename dirpath))
            (dolist (hook *change-directory-hook*)
              (let ((*working-directory* *working-directory*))
                (funcall hook *working-directory*))))
          (error "nonexistent directory: ~S" dirpath)))
    *working-directory*)
  
  
    
  (defun parent-directory (dirpath)
    (make-pathname :directory (let ((dir (pathname-directory dirpath)))
                                (cons (car dir) (butlast (cdr dir))))
                   :defaults dirpath))
  
  
  (defun subdirectories (dirpath)
    (directory
     (merge-pathnames (make-pathname :directory '(:relative :wild)) dirpath)))
  
  
  (defun filter-out-dots (list)
    (delete-if
     (lambda (path)
       (char= (character ".")
              (aref (or (pathname-name path)
                        (car (last (pathname-directory path)))) 0)))
     list))
  
  
  (defun subdirectories-names (dirpath &key (keep-dot-files *keep-dot-files*))
    (let ((subs (subdirectories dirpath)))
      (unless keep-dot-files  (setf subs (filter-out-dots subs)))
      (mapcar (lambda (path) (car (last (pathname-directory path)))) subs)))
  
  
  (defun child-directory (dirpath child)
    (merge-pathnames (make-pathname :directory (list :relative child)) dirpath))
  
  
  (defun files (dirpath &key (type :wild) (keep-dot-files *keep-dot-files*))
    (let ((files (directory
                  (make-pathname :name :wild :type type :defaults dirpath))))
      (unless keep-dot-files (setf files (filter-out-dots files)))
      (mapcar (lambda (path) (cons (pathname-name path) path)) files)))
  
  
  (defparameter *screen-width* 80)
  
  (defun print-list (stream list offset &key (index-width 2))
    (let* ((item-width (reduce (function max) list :key (function length)))
           (max-width (+ index-width 3 item-width))
           (col-count (truncate *screen-width* max-width))
           (row-count (truncate (+ (length list) col-count -1) col-count))
           (table (make-array (list col-count row-count) :initial-element ""))
           (x 0) (y 0))
      (dolist (item list)
        (setf (aref table x y)
              (format nil "~V,D) ~V,A" index-width offset item-width item))
        (incf offset)
        (incf y)
        (if (<= row-count y)
            (setf x (1+ x) y 0)))
      (dotimes (y row-count)
        (dotimes (x (1- col-count))
          (princ (aref table x y) stream)
          (princ " " stream))
        (princ (aref table (1- col-count) y) stream)
        (terpri stream))))
  
  
  (defun browse ()
    "COMMAND
  DO:         Displays the contents of the working directory and
              allows the user to navigate in the directory tree and
              to load files.
  "
    (loop
       (let* ((subdirs     (sort (subdirectories-names (working-directory))
                                 (function string<)))
              (files       (sort (files (working-directory) :type "lisp")
                                 (lambda (a b) (string< (car a) (car b)))))
              (item-count  (+ (length subdirs) (length files)))
              (count-width (if (= 0 item-count) 1 (ceiling (log item-count 10)))))
         (format t "~&")
         (format t "--- current directory ----------------------------~%")
         (format t "~V,A  ~A~%" count-width "" (working-directory))
         (format t "--- parent directory ----------------------------~%")
         (format t "~V,D) ~A~%"
                 count-width 0 (parent-directory (working-directory)))
         (when subdirs
           (format t "--- subdirectories -------------------------------~%")
           (print-list t subdirs 1 :index-width count-width))
         (when files
           (format t "--- files ----------------------------------------~%")
           (print-list t (mapcar (function car) files)
                       (1+ (length subdirs)) :index-width count-width))
         (format t "--------------------------------------------------~%")
         (let ((answer
                (block :answer
                  (loop
                     (format t "~&Change directory number, ~
                              load file number, or -1 to quit: ")
                     (finish-output)
                     (let ((answer (read t nil nil)))
                       (typecase answer
                         (integer (if (<= -1 answer item-count)
                                      (return-from :answer answer)
                                      (format t "~&Input out of range.~%")))
                         (otherwise (format t "~&Bad input type.~%"))))))))
           (cond
             ((= -1 answer) (return))
             ((= 0 answer)
              (change-working-directory (parent-directory (working-directory))))
             ((<= answer (length subdirs))
              (change-working-directory 
               (child-directory (working-directory) (elt subdirs (1- answer)))))
             (t (load (cdr (elt files (- answer (length subdirs) 1)))
                      :verbose t)))))))
      
  
  (defun resolve (path &key (directory nil))
  