comparison lisp/ange-ftp.el @ 23231:01c23b1e1c32

(ange-ftp-write-region): For `dumb-unix' host, do use binary mode, just as for `unix'. (ange-ftp-host-type): If HOST is nil, return `unix'.
author Karl Heuer <kwzh@gnu.org>
date Thu, 10 Sep 1998 16:01:37 +0000
parents 5eff8af4eebd
children 3741d2ab743a
comparison
equal deleted inserted replaced
23230:6e0d3186be0d 23231:01c23b1e1c32
558 ;; nil = local host type, whatever that is (probably unix). 558 ;; nil = local host type, whatever that is (probably unix).
559 ;; Think nil as in "not a remote host". This value is used by 559 ;; Think nil as in "not a remote host". This value is used by
560 ;; ange-ftp-dired-host-type for local buffers. 560 ;; ange-ftp-dired-host-type for local buffers.
561 ;; 561 ;;
562 ;; t = a remote host of unknown type. Think t as in true, it's remote. 562 ;; t = a remote host of unknown type. Think t as in true, it's remote.
563 ;; Currently, 'unix is used as the default remote host type. 563 ;; Currently, `unix' is used as the default remote host type.
564 ;; Maybe we should use t. 564 ;; Maybe we should use t.
565 ;; 565 ;;
566 ;; 'type = a remote host of TYPE type. 566 ;; TYPE = a remote host of TYPE type.
567 ;; 567 ;;
568 ;; 'type:list = a remote host of TYPE type, using a specialized ftp listing 568 ;; TYPE:LIST = a remote host of TYPE type, using a specialized ftp listing
569 ;; program called list. This is currently only used for Unix 569 ;; program called list. This is currently only used for Unix
570 ;; dl (descriptive listings), when ange-ftp-dired-host-type 570 ;; dl (descriptive listings), when ange-ftp-dired-host-type
571 ;; is set to 'unix:dl. 571 ;; is set to `unix:dl'.
572 572
573 ;; Bug report codes: 573 ;; Bug report codes:
574 ;; 574 ;;
575 ;; Because of their naive faith in this code, there are certain situations 575 ;; Because of their naive faith in this code, there are certain situations
576 ;; which the writers of this program believe could never happen. However, 576 ;; which the writers of this program believe could never happen. However,
2155 2155
2156 (defun ange-ftp-host-type (host &optional user) 2156 (defun ange-ftp-host-type (host &optional user)
2157 "Return a symbol which represents the type of the HOST given. 2157 "Return a symbol which represents the type of the HOST given.
2158 If the optional argument USER is given, attempts to guess the 2158 If the optional argument USER is given, attempts to guess the
2159 host-type by logging in as USER." 2159 host-type by logging in as USER."
2160 (if (eq host ange-ftp-host-cache) 2160 (cond ((null host) 'unix)
2161 ange-ftp-host-type-cache 2161 ;; Return `unix' if HOST is nil, since that's the most vanilla
2162 ;; Trigger an ftp connection, in case we need to guess at the host type. 2162 ;; possible return value.
2163 (if (and user (ange-ftp-get-process host user) (eq host ange-ftp-host-cache)) 2163 ((eq host ange-ftp-host-cache)
2164 ange-ftp-host-type-cache 2164 ange-ftp-host-type-cache)
2165 (setq ange-ftp-host-cache host 2165 ;; Trigger an ftp connection, in case we need to guess at the host type.
2166 ange-ftp-host-type-cache 2166 ((and user (ange-ftp-get-process host user) (eq host ange-ftp-host-cache))
2167 (cond ((ange-ftp-dumb-unix-host host) 2167 ange-ftp-host-type-cache)
2168 'dumb-unix) 2168 (t
2169 ;; ((and (fboundp 'ange-ftp-vos-host) 2169 (setq ange-ftp-host-cache host
2170 ;; (ange-ftp-vos-host host)) 2170 ange-ftp-host-type-cache
2171 ;; 'vos) 2171 (cond ((ange-ftp-dumb-unix-host host)
2172 ((and (fboundp 'ange-ftp-vms-host) 2172 'dumb-unix)
2173 (ange-ftp-vms-host host)) 2173 ;; ((and (fboundp 'ange-ftp-vos-host)
2174 'vms) 2174 ;; (ange-ftp-vos-host host))
2175 ((and (fboundp 'ange-ftp-mts-host) 2175 ;; 'vos)
2176 (ange-ftp-mts-host host)) 2176 ((and (fboundp 'ange-ftp-vms-host)
2177 'mts) 2177 (ange-ftp-vms-host host))
2178 ((and (fboundp 'ange-ftp-cms-host) 2178 'vms)
2179 (ange-ftp-cms-host host)) 2179 ((and (fboundp 'ange-ftp-mts-host)
2180 'cms) 2180 (ange-ftp-mts-host host))
2181 (t 2181 'mts)
2182 'unix)))))) 2182 ((and (fboundp 'ange-ftp-cms-host)
2183 (ange-ftp-cms-host host))
2184 'cms)
2185 (t
2186 'unix))))))
2183 2187
2184 ;; It would be nice to abstract the functions ange-ftp-TYPE-host and 2188 ;; It would be nice to abstract the functions ange-ftp-TYPE-host and
2185 ;; ange-ftp-add-TYPE-host. The trick is to abstract these functions 2189 ;; ange-ftp-add-TYPE-host. The trick is to abstract these functions
2186 ;; without sacrificing speed. Also, having separate variables 2190 ;; without sacrificing speed. Also, having separate variables
2187 ;; ange-ftp-TYPE-regexp is more user friendly then requiring the user to 2191 ;; ange-ftp-TYPE-regexp is more user friendly then requiring the user to
3141 (temp (ange-ftp-make-tmp-name host)) 3145 (temp (ange-ftp-make-tmp-name host))
3142 ;; What we REALLY need here is a way to determine if the mode 3146 ;; What we REALLY need here is a way to determine if the mode
3143 ;; of the transfer is irrelevant, i.e. we can use binary mode 3147 ;; of the transfer is irrelevant, i.e. we can use binary mode
3144 ;; regardless. Maybe a system-type to host-type lookup? 3148 ;; regardless. Maybe a system-type to host-type lookup?
3145 (binary (or (ange-ftp-binary-file filename) 3149 (binary (or (ange-ftp-binary-file filename)
3146 (eq (ange-ftp-host-type host user) 'unix))) 3150 (memq (ange-ftp-host-type host user)
3151 '(unix dumb-unix))))
3147 (cmd (if append 'append 'put)) 3152 (cmd (if append 'append 'put))
3148 (abbr (ange-ftp-abbreviate-filename filename)) 3153 (abbr (ange-ftp-abbreviate-filename filename))
3149 ;; we need to reset `last-coding-system-used' to its 3154 ;; we need to reset `last-coding-system-used' to its
3150 ;; value immediately after calling the real write-region, 3155 ;; value immediately after calling the real write-region,
3151 ;; so that `basic-save-buffer' doesn't see whatever value 3156 ;; so that `basic-save-buffer' doesn't see whatever value