Mercurial > emacs
comparison lisp/net/ange-ftp.el @ 91814:c1e1558393ba
* net/ange-ftp.el (ange-ftp-quote-string): Use
`shell-quote-argument'. This DTRT even on w32 machines.
(ange-ftp-cf1): Quote FILENAME.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Wed, 13 Feb 2008 17:27:38 +0000 |
parents | 846fe57f9c57 |
children | 93cf29ed1d24 |
comparison
equal
deleted
inserted
replaced
91813:ca1e1298a3d8 | 91814:c1e1558393ba |
---|---|
1521 (user (nth 1 parsed))) | 1521 (user (nth 1 parsed))) |
1522 (kill-buffer (get-buffer (ange-ftp-ftp-process-buffer host user))))))))) | 1522 (kill-buffer (get-buffer (ange-ftp-ftp-process-buffer host user))))))))) |
1523 | 1523 |
1524 (defun ange-ftp-quote-string (string) | 1524 (defun ange-ftp-quote-string (string) |
1525 "Quote any characters in STRING that may confuse the ftp process." | 1525 "Quote any characters in STRING that may confuse the ftp process." |
1526 (apply 'concat | 1526 ;; This is said to be wrong; ftp is said to need quoting only for ", |
1527 (mapcar (lambda (char) | 1527 ;; and that by doubling it. But experiment says UNIX-style kind of |
1528 ;; This is said to be wrong; ftp is said to | 1528 ;; quoting is correct when talking to ftp on GNU/Linux systems, and |
1529 ;; need quoting only for ", and that by doubling it. | 1529 ;; W32-style kind of quoting on, yes, W32 systems. |
1530 ;; But experiment says this kind of quoting is correct | 1530 (when (stringp string) (shell-quote-argument string))) |
1531 ;; when talking to ftp on GNU/Linux systems. | |
1532 (if (or (<= char ? ) | |
1533 (> char ?\~) | |
1534 (= char ?\") | |
1535 (= char ?\\)) | |
1536 (vector ?\\ char) | |
1537 (vector char))) | |
1538 string))) | |
1539 | 1531 |
1540 (defun ange-ftp-barf-if-not-directory (directory) | 1532 (defun ange-ftp-barf-if-not-directory (directory) |
1541 (or (file-directory-p directory) | 1533 (or (file-directory-p directory) |
1542 (signal 'file-error | 1534 (signal 'file-error |
1543 (list "Opening directory" | 1535 (list "Opening directory" |
3764 (ange-ftp-set-xfer-size t-host t-user (nth 7 attr)))) | 3756 (ange-ftp-set-xfer-size t-host t-user (nth 7 attr)))) |
3765 | 3757 |
3766 (ange-ftp-send-cmd | 3758 (ange-ftp-send-cmd |
3767 t-host | 3759 t-host |
3768 t-user | 3760 t-user |
3769 (list 'put (or temp2 filename) t-name) | 3761 (list 'put (or temp2 (ange-ftp-quote-string filename)) t-name) |
3770 (or msg | 3762 (or msg |
3771 (if (and temp2 f-parsed) | 3763 (if (and temp2 f-parsed) |
3772 (format "Putting %s" newname) | 3764 (format "Putting %s" newname) |
3773 (format "Copying %s to %s" f-abbr t-abbr))) | 3765 (format "Copying %s to %s" f-abbr t-abbr))) |
3774 (list 'ange-ftp-cf2 | 3766 (list 'ange-ftp-cf2 |