Source

xemacsweb / batch-psgml-validate.el

Diff from to

batch-psgml-validate.el

             (setq file-or-dir (expand-file-name (car command-line-args-left)))
             (batch-psgml-validate file-or-dir)
             (setq command-line-args-left (cdr command-line-args-left)))))
-    (dolist (file (directory-files file-or-dir t nil nil nil))
-      (cond
-       ((member (file-name-nondirectory file) (list "." ".."))
-        nil)
-       ((file-directory-p file)
-        (if (member (file-name-nondirectory file)
-                    psgml-validate-ignore-directories)
-            (message "ignoring directory %s" file)
-          (batch-psgml-validate file)))
-       ((and
-         (member (file-name-extension file) (list "htm" "html"))
-         (null
-          (backup-file-name-p file)))
-        (message "validating %s" file)
-        (batch-psgml-validate-file file t t))))
+    (if (file-directory-p file-or-dir)
+        (dolist (file (directory-files file-or-dir t nil nil nil))
+          (cond
+           ((member (file-name-nondirectory file) (list "." ".."))
+            nil)
+           ((file-directory-p file)
+            (if (member (file-name-nondirectory file)
+                        psgml-validate-ignore-directories)
+                (message "ignoring directory %s" file)
+              (batch-psgml-validate file)))
+           ((and
+             (member (file-name-extension file) (list "htm" "html"))
+             (null
+              (backup-file-name-p file)))
+            (message "validating %s" file)
+            (batch-psgml-validate-file file t t))))
+      (batch-psgml-validate-file file-or-dir t t))
     (message "batch-psgml-validate %s is done" file-or-dir)))
 
 (defun batch-psgml-validate-file (file &optional insert-result indent)