#!/bin/sh
: ; exec klone $0 "$@"
; The above line finds the klone executable in the $PATH

(setq args (getopts "USAGE: %0 [options] dirs..
print filenames non in the 8+3 MSDOS form. recurses on dirs.
If no dirs are given, work in current dir"
    ("-v" () verbose "verbose operation")
))

(setq re83 (regcomp 
    "^[^.]?[^.]?[^.]?[^.]?[^.]?[^.]?[^.]?[^.]?([.][^.]?[^.]?[^.]?)?$"))


(defun do-file-or-dir (file dir)
  (catch 'ERROR			;errors abort only current file
    (if (not (regexec re83 file))
      (print-format "%0/%1\n" dir file)
    )
    (setq ftype (file-type file))
    (if (= 'file ftype)
      (do-file file dir)
      (= 'directory ftype)
      (do-dir file dir)
)))

(defun do-dir (dir parent &aux
    (*current-directory* dir)
  )
  (verbose? "===>   entering directory %0..." *current-directory*)
  (dolist (file (directory))
    (do-file-or-dir file (+ parent "/" dir))
))

(defun do-file (file dir) ())

(if (not args) (setq args '(".")))

(defun main (&aux
  )
  (dolist (dir args)
    (with (*current-directory* dir)
      (dolist (file (directory))
	(do-file-or-dir file dir)
))))

(main)

;;; EMACS MODES
;;; Local Variables: ***
;;; mode:lisp ***
;;; End: ***

