changeset 34346:fe91911bd583

(dired-insert-directory): If file-system-info is fboundp, call it instead of invoking dired-free-space-program.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 07 Dec 2000 14:51:33 +0000
parents 39f2e2837fac
children 0d942bf6f84c
files lisp/dired.el
diffstat 1 files changed, 24 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired.el	Thu Dec 07 13:53:21 2000 +0000
+++ b/lisp/dired.el	Thu Dec 07 14:51:33 2000 +0000
@@ -686,24 +686,30 @@
 	  (goto-char (point-min))
 	  (when (re-search-forward "total [0-9]+$" nil t)
 	    (insert "  free ")
-	    (let ((beg (point)))
-              (condition-case nil
-                  (if (zerop (call-process dired-free-space-program nil t nil
-                                           dired-free-space-args
-                                           (expand-file-name dir-or-list)))
-                      (progn
-                        (goto-char beg)
-                        (forward-line 1)
-                        (skip-chars-forward "^ \t")
-                        (forward-word 2)
-                        (skip-chars-forward " \t")
-                        (delete-region beg (point))
-                        (forward-word 1)
-                        (delete-region (point)
-                                       (progn (forward-line 1) (point))))
-                    ;; The dired-free-space-program failed; delete its output
-                    (delete-region (- beg 7) (point)))
-                (error (delete-region (- beg 7) (point)))))))))
+	    ;; Non-Posix systems don't always have dired-free-space-program,
+	    ;; but might have an equivalent system call.
+	    (if (fboundp 'file-system-info)
+		(insert
+		 (format "%.0f"
+			 (/ (nth 2 (file-system-info dir-or-list)) 1024)))
+	      (let ((beg (point)))
+		(condition-case nil
+		    (if (zerop (call-process dired-free-space-program nil t nil
+					     dired-free-space-args
+					     (expand-file-name dir-or-list)))
+			(progn
+			  (goto-char beg)
+			  (forward-line 1)
+			  (skip-chars-forward "^ \t")
+			  (forward-word 2)
+			  (skip-chars-forward " \t")
+			  (delete-region beg (point))
+			  (forward-word 1)
+			  (delete-region (point)
+					 (progn (forward-line 1) (point))))
+	     ;; The dired-free-space-program failed; delete its output
+		      (delete-region (- beg 7) (point)))
+		  (error (delete-region (- beg 7) (point))))))))))
     ;; Quote certain characters, unless ls quoted them for us.
     (if (not (string-match "b" dired-actual-switches))
 	(save-excursion