diff options
| author | Richard M. Stallman | 1997-05-01 02:03:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-05-01 02:03:16 +0000 |
| commit | e1b65a6bd81fe9fe3ccb409861866789f6534c83 (patch) | |
| tree | c75d89bb8d567e77250f60a4fbd5323b98c0c7c8 | |
| parent | 1dc6cfa61dbd868f5ab072e37d77fdd64ff5f251 (diff) | |
| download | emacs-e1b65a6bd81fe9fe3ccb409861866789f6534c83.tar.gz emacs-e1b65a6bd81fe9fe3ccb409861866789f6534c83.zip | |
(shell-quote-argument): Quote null string usefully.
| -rw-r--r-- | lisp/subr.el | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index edd425d33e6..70fea7691b6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -873,15 +873,17 @@ If SEPARATORS is absent, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." | |||
| 873 | argument | 873 | argument |
| 874 | (if (eq system-type 'windows-nt) | 874 | (if (eq system-type 'windows-nt) |
| 875 | (concat "\"" argument "\"") | 875 | (concat "\"" argument "\"") |
| 876 | ;; Quote everything except POSIX filename characters. | 876 | (if (equal argument "") |
| 877 | ;; This should be safe enough even for really weird shells. | 877 | "''" |
| 878 | (let ((result "") (start 0) end) | 878 | ;; Quote everything except POSIX filename characters. |
| 879 | (while (string-match "[^-0-9a-zA-Z_./]" argument start) | 879 | ;; This should be safe enough even for really weird shells. |
| 880 | (setq end (match-beginning 0) | 880 | (let ((result "") (start 0) end) |
| 881 | result (concat result (substring argument start end) | 881 | (while (string-match "[^-0-9a-zA-Z_./]" argument start) |
| 882 | "\\" (substring argument end (1+ end))) | 882 | (setq end (match-beginning 0) |
| 883 | start (1+ end))) | 883 | result (concat result (substring argument start end) |
| 884 | (concat result (substring argument start)))))) | 884 | "\\" (substring argument end (1+ end))) |
| 885 | start (1+ end))) | ||
| 886 | (concat result (substring argument start))))))) | ||
| 885 | 887 | ||
| 886 | (defun make-syntax-table (&optional oldtable) | 888 | (defun make-syntax-table (&optional oldtable) |
| 887 | "Return a new syntax table. | 889 | "Return a new syntax table. |