changeset 39985:3a906538d254

(eshell/cat): Do a quick test if something is a regular file, before checking if it is a directory or symlink. This avoids a call to eshell-file-attributes, which can be expensive in some situations.
author John Wiegley <johnw@newartisans.com>
date Wed, 17 Oct 2001 02:00:20 +0000
parents 5e4848f89017
children c9411c9fab91
files lisp/eshell/em-unix.el
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/eshell/em-unix.el	Wed Oct 17 02:00:00 2001 +0000
+++ b/lisp/eshell/em-unix.el	Wed Oct 17 02:00:20 2001 +0000
@@ -572,9 +572,12 @@
   (if (or eshell-in-pipeline-p
 	  (catch 'special
 	    (eshell-for arg args
-	      (unless (let ((attrs (eshell-file-attributes arg)))
-			(and attrs (memq (aref (nth 8 attrs) 0)
-					 '(?d ?l ?-))))
+	      (unless (or (and (stringp arg)
+			       (> (length arg) 0)
+			       (eq (aref arg 0) ?-))
+			  (let ((attrs (eshell-file-attributes arg)))
+			    (and attrs (memq (aref (nth 8 attrs) 0)
+					     '(?d ?l ?-)))))
 		(throw 'special t)))))
       (let ((ext-cat (eshell-search-path "cat")))
 	(if ext-cat