changeset 17610:f95fbf6f1234

(shell-quote-argument): Quote null string usefully.
author Richard M. Stallman <rms@gnu.org>
date Thu, 01 May 1997 02:03:16 +0000
parents 8c878d76d6a4
children 1b2afa6391ca
files lisp/subr.el
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Thu May 01 01:59:47 1997 +0000
+++ b/lisp/subr.el	Thu May 01 02:03:16 1997 +0000
@@ -873,15 +873,17 @@
       argument
     (if (eq system-type 'windows-nt)
 	(concat "\"" argument "\"")
-      ;; Quote everything except POSIX filename characters.
-      ;; This should be safe enough even for really weird shells.
-      (let ((result "") (start 0) end)
-	(while (string-match "[^-0-9a-zA-Z_./]" argument start)
-	  (setq end (match-beginning 0)
-		result (concat result (substring argument start end)
-			       "\\" (substring argument end (1+ end)))
-		start (1+ end)))
-	(concat result (substring argument start))))))
+      (if (equal argument "")
+	  "''"
+	;; Quote everything except POSIX filename characters.
+	;; This should be safe enough even for really weird shells.
+	(let ((result "") (start 0) end)
+	  (while (string-match "[^-0-9a-zA-Z_./]" argument start)
+	    (setq end (match-beginning 0)
+		  result (concat result (substring argument start end)
+				 "\\" (substring argument end (1+ end)))
+		  start (1+ end)))
+	  (concat result (substring argument start)))))))
 
 (defun make-syntax-table (&optional oldtable)
   "Return a new syntax table.