/[emacs]/emacs/lisp/net/ange-ftp.el
ViewVC logotype

Diff of /emacs/lisp/net/ange-ftp.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14.4.3 by rms, Sat Dec 29 20:43:15 2001 UTC revision 1.14.4.4 by monnier, Mon Jan 14 12:45:35 2002 UTC
# Line 2092  Create a new process if needed." Line 2092  Create a new process if needed."
2092          ;; grab a suitable process.          ;; grab a suitable process.
2093          (setq proc (ange-ftp-start-process host user name))          (setq proc (ange-ftp-start-process host user name))
2094    
2095          ;; login to FTP server.          (save-match-data
2096          (if (and (ange-ftp-use-smart-gateway-p host)            ;; login to FTP server.
2097                   ange-ftp-gateway-host)            (if (and (ange-ftp-use-smart-gateway-p host)
2098              (ange-ftp-smart-login host user pass account proc)                     ange-ftp-gateway-host)
2099            (ange-ftp-normal-login host user pass account proc))                (ange-ftp-smart-login host user pass account proc)
2100                (ange-ftp-normal-login host user pass account proc))
2101          ;; Tell client to send back hash-marks as progress.  It isn't usually  
2102          ;; fatal if this command fails.            ;; Tell client to send back hash-marks as progress.  It isn't usually
2103          (ange-ftp-guess-hash-mark-size proc)            ;; fatal if this command fails.
2104              (ange-ftp-guess-hash-mark-size proc)
2105          ;; Guess at the host type.  
2106          (ange-ftp-guess-host-type host user)            ;; Guess at the host type.
2107              (ange-ftp-guess-host-type host user)
2108          ;; Try to use passive mode if asked to.  
2109          (when ange-ftp-try-passive-mode            ;; Try to use passive mode if asked to.
2110            (let ((answer (cdr (ange-ftp-raw-send-cmd            (when ange-ftp-try-passive-mode
2111                                proc "passive" "Trying passive mode..." nil))))              (let ((answer (cdr (ange-ftp-raw-send-cmd
2112              (if (string-match "\\?\\|refused" answer)                                  proc "passive" "Trying passive mode..." nil))))
2113                  (message "Trying passive mode...ok")                (if (string-match "\\?\\|refused" answer)
2114                (message "Trying passive mode...failed"))))                    (message "Trying passive mode...ok")
2115                    (message "Trying passive mode...failed"))))
2116          ;; Run any user-specified hooks.  Note that proc, host and user are  
2117          ;; dynamically bound at this point.            ;; Run any user-specified hooks.  Note that proc, host and user are
2118          (run-hooks 'ange-ftp-process-startup-hook))            ;; dynamically bound at this point.
2119              (run-hooks 'ange-ftp-process-startup-hook)))
2120        proc)))        proc)))
2121    
2122  ;; Variables for caching host and host-type  ;; Variables for caching host and host-type
# Line 2211  and NOWAIT." Line 2212  and NOWAIT."
2212               host-type (ange-ftp-host-type host user))               host-type (ange-ftp-host-type host user))
2213         ;; This will trigger an FTP login, if one doesn't exist         ;; This will trigger an FTP login, if one doesn't exist
2214         (eq cmd0 'dir))         (eq cmd0 'dir))
2215        (setq cmd1 (funcall        (save-match-data
2216                    (or (cdr (assq host-type ange-ftp-fix-dir-name-func-alist))          (setq cmd1 (funcall
2217                        'identity)                      (or (cdr (assq host-type ange-ftp-fix-dir-name-func-alist))
2218                    cmd1)                          'identity)
2219              cmd3 (nth 3 cmd))                      cmd1)
2220        ;; Need to deal with the HP-UX ftp bug. This should also allow                cmd3 (nth 3 cmd))
2221        ;; us to resolve symlinks to directories on SysV machines. (Sebastian will          ;; Need to deal with the HP-UX ftp bug. This should also allow
2222        ;; be happy.)          ;; us to resolve symlinks to directories on SysV machines. (Sebastian will
2223        (and (eq host-type 'unix)          ;; be happy.)
2224             (string-match "/$" cmd1)          (and (eq host-type 'unix)
2225             (not (string-match "R" cmd3))               (string-match "/$" cmd1)
2226             (setq cmd1 (concat cmd1 ".")))               (not (string-match "R" cmd3))
2227                 (setq cmd1 (concat cmd1 ".")))
2228        ;; If the dir name contains a space, some ftp servers will  
2229        ;; refuse to list it.  We instead change directory to the          ;; If the dir name contains a space, some ftp servers will
2230        ;; directory in question and ls ".".          ;; refuse to list it.  We instead change directory to the
2231        (when (string-match " " cmd1)          ;; directory in question and ls ".".
2232          (ange-ftp-cd host user (nth 1 cmd))          (when (string-match " " cmd1)
2233          (setq cmd1 "."))            (ange-ftp-cd host user (nth 1 cmd))
2234              (setq cmd1 "."))
2235        ;; If the remote ls can take switches, put them in  
2236        (or (memq host-type ange-ftp-dumb-host-types)          ;; If the remote ls can take switches, put them in
2237            (setq cmd0 'ls          (or (memq host-type ange-ftp-dumb-host-types)
2238                  cmd1 (format "\"%s %s\"" cmd3 cmd1))))              (setq cmd0 'ls
2239                      cmd1 (format "\"%s %s\"" cmd3 cmd1)))))
2240    
2241       ;; First argument is the remote name       ;; First argument is the remote name
2242       ((progn       ((progn
# Line 3847  Value is (0 0) if the modification time Line 3849  Value is (0 0) if the modification time
3849               completions)))               completions)))
3850    
3851        (if (or (and (eq system-type 'windows-nt)        (if (or (and (eq system-type 'windows-nt)
3852                     (string-match "^[a-zA-Z]:[/\\]$" ange-ftp-this-dir))                     (save-match-data
3853                         (string-match "^[a-zA-Z]:[/\\]$" ange-ftp-this-dir)))
3854                (string-equal "/" ange-ftp-this-dir))                (string-equal "/" ange-ftp-this-dir))
3855            (nconc (all-completions file (ange-ftp-generate-root-prefixes))            (nconc (all-completions file (ange-ftp-generate-root-prefixes))
3856                   (ange-ftp-real-file-name-all-completions file                   (ange-ftp-real-file-name-all-completions file
# Line 3879  Value is (0 0) if the modification time Line 3882  Value is (0 0) if the modification time
3882                       (function ange-ftp-file-entry-active-p)))))))                       (function ange-ftp-file-entry-active-p)))))))
3883    
3884        (if (or (and (eq system-type 'windows-nt)        (if (or (and (eq system-type 'windows-nt)
3885                     (string-match "^[a-zA-Z]:[/\\]$" ange-ftp-this-dir))                     (save-match-data
3886                         (string-match "^[a-zA-Z]:[/\\]$" ange-ftp-this-dir)))
3887                (string-equal "/" ange-ftp-this-dir))                (string-equal "/" ange-ftp-this-dir))
3888            (try-completion            (try-completion
3889             file             file
# Line 4324  NEWNAME should be the name to give the n Line 4328  NEWNAME should be the name to give the n
4328  ;; So the format conversion should be all that is needed.  ;; So the format conversion should be all that is needed.
4329    
4330  (defun ange-ftp-insert-directory (file switches &optional wildcard full)  (defun ange-ftp-insert-directory (file switches &optional wildcard full)
4331    (let ((short (ange-ftp-abbreviate-filename file))    (save-match-data
4332          (parsed (ange-ftp-ftp-name (expand-file-name file)))      (let ((short (ange-ftp-abbreviate-filename file))
4333          tem)            (parsed (ange-ftp-ftp-name (expand-file-name file)))
4334      (if parsed            tem)
4335          (if (and (not wildcard)        (if parsed
4336                   (setq tem (file-symlink-p (directory-file-name file))))            (if (and (not wildcard)
4337              (ange-ftp-insert-directory                     (setq tem (file-symlink-p (directory-file-name file))))
4338               (ange-ftp-replace-name-component file tem)                (ange-ftp-insert-directory
4339               switches wildcard full)                 (ange-ftp-replace-name-component file tem)
4340            (insert                 switches wildcard full)
4341             (if wildcard              (insert
4342                 (let ((default-directory (file-name-directory file)))               (if wildcard
4343                   (ange-ftp-ls (file-name-nondirectory file) switches nil nil t))                   (let ((default-directory (file-name-directory file)))
4344               (ange-ftp-ls file switches full))))q                     (ange-ftp-ls (file-name-nondirectory file)
4345        (ange-ftp-real-insert-directory file switches wildcard full))))                                  switches nil nil t))
4346                   (ange-ftp-ls file switches full))))
4347                   (ange-ftp-real-insert-directory file switches wildcard full)))))
4348    
4349  (defun ange-ftp-dired-uncache (dir)  (defun ange-ftp-dired-uncache (dir)
4350    (if (ange-ftp-ftp-name (expand-file-name dir))    (if (ange-ftp-ftp-name (expand-file-name dir))
# Line 4368  NEWNAME should be the name to give the n Line 4374  NEWNAME should be the name to give the n
4374          (ange-ftp-real-shell-command command output-buffer error-buffer)          (ange-ftp-real-shell-command command output-buffer error-buffer)
4375        (if (> (length name) 0)           ; else it's $HOME        (if (> (length name) 0)           ; else it's $HOME
4376            (setq command (concat "cd " name "; " command)))            (setq command (concat "cd " name "; " command)))
4377          ;; Remove port from the hostname.
4378          (save-match-data
4379            (when (string-match "\\(.*\\)#" host)
4380              (setq host (match-string 1 host))))
4381        (setq command        (setq command
4382              (format  "%s %s \"%s\""     ; remsh -l USER does not work well              (format  "%s %s \"%s\""     ; remsh -l USER does not work well
4383                                          ; on a hp-ux machine I tried                                          ; on a hp-ux machine I tried

Legend:
Removed from v.1.14.4.3  
changed lines
  Added in v.1.14.4.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26