1 |
;;; -*- mode: Emacs-Lisp; coding: iso-8859-1; -*- |
;;; -*- mode: Emacs-Lisp; coding: iso-2022-7bit; -*- |
2 |
;;; tramp.el --- Transparent Remote Access, Multiple Protocol |
;;; tramp.el --- Transparent Remote Access, Multiple Protocol |
3 |
|
|
4 |
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
87 |
(unless (fboundp 'uudecode-decode-region) |
(unless (fboundp 'uudecode-decode-region) |
88 |
(autoload 'uudecode-decode-region "uudecode")) |
(autoload 'uudecode-decode-region "uudecode")) |
89 |
|
|
90 |
;; ;; It does not work to load EFS after loading TRAMP. |
;; XEmacs is distributed with few Lisp packages. Further packages are |
91 |
;; (when (fboundp 'efs-file-handler-function) |
;; installed using EFS. If we use a unified filename format, then |
92 |
;; (require 'efs)) |
;; Tramp is required in addition to EFS. (But why can't Tramp just |
93 |
|
;; disable EFS when Tramp is loaded? Then XEmacs can ship with EFS |
94 |
|
;; just like before.) Another reason for using a separate filename |
95 |
|
;; syntax on XEmacs is that EFS hooks into XEmacs in many places, but |
96 |
|
;; Tramp only knows how to deal with `file-name-handler-alist', not |
97 |
|
;; the other places. |
98 |
|
;;;###autoload |
99 |
|
(defvar tramp-unified-filenames (not (featurep 'xemacs)) |
100 |
|
"Non-nil means to use unified Ange-FTP/Tramp filename syntax. |
101 |
|
Nil means to use a separate filename syntax for Tramp.") |
102 |
|
|
103 |
;; Load foreign methods. Because they do require Tramp internally, this |
;; Load foreign methods. Because they do require Tramp internally, this |
104 |
;; must be done with the `eval-after-load' trick. |
;; must be done with the `eval-after-load' trick. |
107 |
(unless (featurep 'xemacs) |
(unless (featurep 'xemacs) |
108 |
(eval-after-load "tramp" |
(eval-after-load "tramp" |
109 |
'(require 'tramp-ftp))) |
'(require 'tramp-ftp))) |
110 |
|
(when (and tramp-unified-filenames (featurep 'xemacs)) |
111 |
|
(eval-after-load "tramp" |
112 |
|
'(require 'tramp-efs))) |
113 |
|
|
114 |
;; tramp-smb uses "smbclient" from Samba. |
;; tramp-smb uses "smbclient" from Samba. |
115 |
;; Not available under Cygwin and Windows, because they don't offer |
;; Not available under Cygwin and Windows, because they don't offer |
135 |
(when (fboundp 'byte-compiler-options) |
(when (fboundp 'byte-compiler-options) |
136 |
(byte-compiler-options (warnings (- unused-vars))))) |
(byte-compiler-options (warnings (- unused-vars))))) |
137 |
|
|
|
;; XEmacs is distributed with few Lisp packages. Further packages are |
|
|
;; installed using EFS. If we use a unified filename format, then |
|
|
;; Tramp is required in addition to EFS. (But why can't Tramp just |
|
|
;; disable EFS when Tramp is loaded? Then XEmacs can ship with EFS |
|
|
;; just like before.) Another reason for using a separate filename |
|
|
;; syntax on XEmacs is that EFS hooks into XEmacs in many places, but |
|
|
;; Tramp only knows how to deal with `file-name-handler-alist', not |
|
|
;; the other places. |
|
|
;;;###autoload |
|
|
(defvar tramp-unified-filenames (not (featurep 'xemacs)) |
|
|
"Non-nil means to use unified Ange-FTP/Tramp filename syntax. |
|
|
Nil means to use a separate filename syntax for Tramp.") |
|
|
|
|
138 |
;;; User Customizable Internal Variables: |
;;; User Customizable Internal Variables: |
139 |
|
|
140 |
(defgroup tramp nil |
(defgroup tramp nil |
233 |
|
|
234 |
(defcustom tramp-methods |
(defcustom tramp-methods |
235 |
'( ("rcp" (tramp-connection-function tramp-open-connection-rsh) |
'( ("rcp" (tramp-connection-function tramp-open-connection-rsh) |
236 |
(tramp-rsh-program "rsh") |
(tramp-login-program "rsh") |
237 |
(tramp-rcp-program "rcp") |
(tramp-copy-program "rcp") |
238 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
239 |
(tramp-rsh-args nil) |
(tramp-login-args nil) |
240 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
241 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
242 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
243 |
("scp" (tramp-connection-function tramp-open-connection-rsh) |
("scp" (tramp-connection-function tramp-open-connection-rsh) |
244 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
245 |
(tramp-rcp-program "scp") |
(tramp-copy-program "scp") |
246 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
247 |
(tramp-rsh-args ("-e" "none")) |
(tramp-login-args ("-e" "none")) |
248 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
249 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
250 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
251 |
("scp1" (tramp-connection-function tramp-open-connection-rsh) |
("scp1" (tramp-connection-function tramp-open-connection-rsh) |
252 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
253 |
(tramp-rcp-program "scp") |
(tramp-copy-program "scp") |
254 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
255 |
(tramp-rsh-args ("-1" "-e" "none")) |
(tramp-login-args ("-1" "-e" "none")) |
256 |
(tramp-rcp-args ("-1")) |
(tramp-copy-args ("-1")) |
257 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
258 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
259 |
("scp2" (tramp-connection-function tramp-open-connection-rsh) |
("scp2" (tramp-connection-function tramp-open-connection-rsh) |
260 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
261 |
(tramp-rcp-program "scp") |
(tramp-copy-program "scp") |
262 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
263 |
(tramp-rsh-args ("-2" "-e" "none")) |
(tramp-login-args ("-2" "-e" "none")) |
264 |
(tramp-rcp-args ("-2")) |
(tramp-copy-args ("-2")) |
265 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
266 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
267 |
("scp1_old" |
("scp1_old" |
268 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
269 |
(tramp-rsh-program "ssh1") |
(tramp-login-program "ssh1") |
270 |
(tramp-rcp-program "scp1") |
(tramp-copy-program "scp1") |
271 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
272 |
(tramp-rsh-args ("-e" "none")) |
(tramp-login-args ("-e" "none")) |
273 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
274 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
275 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
276 |
("scp2_old" |
("scp2_old" |
277 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
278 |
(tramp-rsh-program "ssh2") |
(tramp-login-program "ssh2") |
279 |
(tramp-rcp-program "scp2") |
(tramp-copy-program "scp2") |
280 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
281 |
(tramp-rsh-args ("-e" "none")) |
(tramp-login-args ("-e" "none")) |
282 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
283 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
284 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
285 |
("rsync" (tramp-connection-function tramp-open-connection-rsh) |
("rsync" (tramp-connection-function tramp-open-connection-rsh) |
286 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
287 |
(tramp-rcp-program "rsync") |
(tramp-copy-program "rsync") |
288 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
289 |
(tramp-rsh-args ("-e" "none")) |
(tramp-login-args ("-e" "none")) |
290 |
(tramp-rcp-args ("-e" "ssh")) |
(tramp-copy-args ("-e" "ssh")) |
291 |
(tramp-rcp-keep-date-arg "-t") |
(tramp-copy-keep-date-arg "-t") |
292 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
293 |
(tramp-su-args nil) |
("remcp" (tramp-connection-function tramp-open-connection-rsh) |
294 |
(tramp-telnet-program nil) |
(tramp-login-program "remsh") |
295 |
(tramp-telnet-args nil)) |
(tramp-copy-program "rcp") |
296 |
|
(tramp-remote-sh "/bin/sh") |
297 |
|
(tramp-login-args nil) |
298 |
|
(tramp-copy-args nil) |
299 |
|
(tramp-copy-keep-date-arg "-p") |
300 |
|
(tramp-password-end-of-line nil)) |
301 |
("rsh" (tramp-connection-function tramp-open-connection-rsh) |
("rsh" (tramp-connection-function tramp-open-connection-rsh) |
302 |
(tramp-rsh-program "rsh") |
(tramp-login-program "rsh") |
303 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
304 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
305 |
(tramp-rsh-args nil) |
(tramp-login-args nil) |
306 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
307 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
308 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
309 |
("ssh" (tramp-connection-function tramp-open-connection-rsh) |
("ssh" (tramp-connection-function tramp-open-connection-rsh) |
310 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
311 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
312 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
313 |
(tramp-rsh-args ("-e" "none")) |
(tramp-login-args ("-e" "none")) |
314 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
315 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
316 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
317 |
("ssh1" (tramp-connection-function tramp-open-connection-rsh) |
("ssh1" (tramp-connection-function tramp-open-connection-rsh) |
318 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
319 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
320 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
321 |
(tramp-rsh-args ("-1" "-e" "none")) |
(tramp-login-args ("-1" "-e" "none")) |
322 |
(tramp-rcp-args ("-1")) |
(tramp-copy-args ("-1")) |
323 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
324 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
325 |
("ssh2" (tramp-connection-function tramp-open-connection-rsh) |
("ssh2" (tramp-connection-function tramp-open-connection-rsh) |
326 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
327 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
328 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
329 |
(tramp-rsh-args ("-2" "-e" "none")) |
(tramp-login-args ("-2" "-e" "none")) |
330 |
(tramp-rcp-args ("-2")) |
(tramp-copy-args ("-2")) |
331 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
332 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
333 |
("ssh1_old" |
("ssh1_old" |
334 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
335 |
(tramp-rsh-program "ssh1") |
(tramp-login-program "ssh1") |
336 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
337 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
338 |
(tramp-rsh-args ("-e" "none")) |
(tramp-login-args ("-e" "none")) |
339 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
340 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
341 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
342 |
("ssh2_old" |
("ssh2_old" |
343 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
344 |
(tramp-rsh-program "ssh2") |
(tramp-login-program "ssh2") |
345 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
346 |
|
(tramp-remote-sh "/bin/sh") |
347 |
|
(tramp-login-args ("-e" "none")) |
348 |
|
(tramp-copy-args nil) |
349 |
|
(tramp-copy-keep-date-arg nil) |
350 |
|
(tramp-password-end-of-line nil)) |
351 |
|
("remsh" (tramp-connection-function tramp-open-connection-rsh) |
352 |
|
(tramp-login-program "remsh") |
353 |
|
(tramp-copy-program nil) |
354 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
355 |
(tramp-rsh-args ("-e" "none")) |
(tramp-login-args nil) |
356 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
357 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
358 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
359 |
("telnet" |
("telnet" |
360 |
(tramp-connection-function tramp-open-connection-telnet) |
(tramp-connection-function tramp-open-connection-telnet) |
361 |
(tramp-rsh-program nil) |
(tramp-login-program "telnet") |
362 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
363 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
364 |
(tramp-rsh-args nil) |
(tramp-login-args nil) |
365 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
366 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
367 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program "telnet") |
|
|
(tramp-telnet-args nil)) |
|
368 |
("su" (tramp-connection-function tramp-open-connection-su) |
("su" (tramp-connection-function tramp-open-connection-su) |
369 |
(tramp-rsh-program nil) |
(tramp-login-program "su") |
370 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
371 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
372 |
(tramp-rsh-args nil) |
(tramp-login-args ("-" "%u")) |
373 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
374 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
375 |
(tramp-su-program "su") |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args ("-" "%u")) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
376 |
("sudo" (tramp-connection-function tramp-open-connection-su) |
("sudo" (tramp-connection-function tramp-open-connection-su) |
377 |
(tramp-rsh-program nil) |
(tramp-login-program "sudo") |
378 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
379 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
380 |
(tramp-rsh-args nil) |
(tramp-login-args ("-u" "%u" "-s" |
381 |
(tramp-rcp-args nil) |
"-p" "Password:")) |
382 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-args nil) |
383 |
(tramp-su-program "sudo") |
(tramp-copy-keep-date-arg nil) |
384 |
(tramp-su-args ("-u" "%u" "-s")) |
(tramp-password-end-of-line nil)) |
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
385 |
("multi" (tramp-connection-function tramp-open-connection-multi) |
("multi" (tramp-connection-function tramp-open-connection-multi) |
386 |
(tramp-rsh-program nil) |
(tramp-login-program nil) |
387 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
388 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
389 |
(tramp-rsh-args nil) |
(tramp-login-args nil) |
390 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
391 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
392 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
393 |
("scpx" (tramp-connection-function tramp-open-connection-rsh) |
("scpx" (tramp-connection-function tramp-open-connection-rsh) |
394 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
395 |
(tramp-rcp-program "scp") |
(tramp-copy-program "scp") |
396 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
397 |
(tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) |
(tramp-login-args ("-e" "none" "-t" "-t" "/bin/sh")) |
398 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
399 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
400 |
(tramp-telnet-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-telnet-args nil)) |
|
401 |
("sshx" (tramp-connection-function tramp-open-connection-rsh) |
("sshx" (tramp-connection-function tramp-open-connection-rsh) |
402 |
(tramp-rsh-program "ssh") |
(tramp-login-program "ssh") |
403 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
404 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
405 |
(tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) |
(tramp-login-args ("-e" "none" "-t" "-t" "/bin/sh")) |
406 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
407 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
408 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
409 |
("krlogin" |
("krlogin" |
410 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
411 |
(tramp-rsh-program "krlogin") |
(tramp-login-program "krlogin") |
412 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
413 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
414 |
(tramp-rsh-args ("-x")) |
(tramp-login-args ("-x")) |
415 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
416 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
417 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
418 |
("plink" |
("plink" |
419 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
420 |
(tramp-rsh-program "plink") |
(tramp-login-program "plink") |
421 |
(tramp-rcp-program nil) |
(tramp-copy-program nil) |
422 |
|
(tramp-remote-sh "/bin/sh") |
423 |
|
(tramp-login-args ("-ssh")) ;optionally add "-v" |
424 |
|
(tramp-copy-args nil) |
425 |
|
(tramp-copy-keep-date-arg nil) |
426 |
|
(tramp-password-end-of-line "xy")) ;see docstring for "xy" |
427 |
|
("plink1" |
428 |
|
(tramp-connection-function tramp-open-connection-rsh) |
429 |
|
(tramp-login-program "plink") |
430 |
|
(tramp-copy-program nil) |
431 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
432 |
(tramp-rsh-args ("-ssh")) ;optionally add "-v" |
(tramp-login-args ("-1" "-ssh")) ;optionally add "-v" |
433 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
434 |
(tramp-rcp-keep-date-arg nil) |
(tramp-copy-keep-date-arg nil) |
435 |
(tramp-su-program nil) |
(tramp-password-end-of-line "xy")) ;see docstring for "xy" |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
436 |
("pscp" |
("pscp" |
437 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
438 |
(tramp-rsh-program "plink") |
(tramp-login-program "plink") |
439 |
(tramp-rcp-program "pscp") |
(tramp-copy-program "pscp") |
440 |
(tramp-remote-sh "/bin/sh") |
(tramp-remote-sh "/bin/sh") |
441 |
(tramp-rsh-args ("-ssh")) |
(tramp-login-args ("-ssh")) |
442 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
443 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
444 |
(tramp-su-program nil) |
(tramp-password-end-of-line "xy")) ;see docstring for "xy" |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
445 |
("fcp" |
("fcp" |
446 |
(tramp-connection-function tramp-open-connection-rsh) |
(tramp-connection-function tramp-open-connection-rsh) |
447 |
(tramp-rsh-program "fsh") |
(tramp-login-program "fsh") |
448 |
(tramp-rcp-program "fcp") |
(tramp-copy-program "fcp") |
449 |
(tramp-remote-sh "/bin/sh -i") |
(tramp-remote-sh "/bin/sh -i") |
450 |
(tramp-rsh-args ("sh" "-i")) |
(tramp-login-args ("sh" "-i")) |
451 |
(tramp-rcp-args nil) |
(tramp-copy-args nil) |
452 |
(tramp-rcp-keep-date-arg "-p") |
(tramp-copy-keep-date-arg "-p") |
453 |
(tramp-su-program nil) |
(tramp-password-end-of-line nil)) |
|
(tramp-su-args nil) |
|
|
(tramp-telnet-program nil) |
|
|
(tramp-telnet-args nil)) |
|
454 |
) |
) |
455 |
"*Alist of methods for remote files. |
"*Alist of methods for remote files. |
456 |
This is a list of entries of the form (NAME PARAM1 PARAM2 ...). |
This is a list of entries of the form (NAME PARAM1 PARAM2 ...). |
468 |
which groks tilde expansion, but it can search for it. Also note |
which groks tilde expansion, but it can search for it. Also note |
469 |
that \"/bin/sh\" exists on all Unixen, this might not be true for |
that \"/bin/sh\" exists on all Unixen, this might not be true for |
470 |
the value that you decide to use. You Have Been Warned. |
the value that you decide to use. You Have Been Warned. |
471 |
* `tramp-rsh-program' |
* `tramp-login-program' |
472 |
This specifies the name of the program to use for rsh; this might be |
This specifies the name of the program to use for logging in to the |
473 |
the absolute filename of rsh or the name of a workalike program. |
remote host. Depending on `tramp-connection-function', this may be |
474 |
* `tramp-rsh-args' |
the name of rsh or a workalike program (when |
475 |
|
`tramp-connection-function' is `tramp-open-connection-rsh'), or the |
476 |
|
name of telnet or a workalike (for `tramp-open-connection-telnet'), |
477 |
|
or the name of su or a workalike (for `tramp-open-connection-su'). |
478 |
|
* `tramp-login-args' |
479 |
This specifies the list of arguments to pass to the above |
This specifies the list of arguments to pass to the above |
480 |
mentioned program. Please note that this is a list of arguments, |
mentioned program. Please note that this is a list of arguments, |
481 |
that is, normally you don't want to put \"-a -b\" or \"-f foo\" |
that is, normally you don't want to put \"-a -b\" or \"-f foo\" |
482 |
here. Instead, you want two list elements, one for \"-a\" and one |
here. Instead, you want two list elements, one for \"-a\" and one |
483 |
for \"-b\", or one for \"-f\" and one for \"foo\". |
for \"-b\", or one for \"-f\" and one for \"foo\". |
484 |
* `tramp-rcp-program' |
If `tramp-connection-function' is `tramp-open-connection-su', then |
485 |
This specifies the name of the program to use for rcp; this might be |
\"%u\" in this list is replaced by the user name, and \"%%\" can |
486 |
the absolute filename of rcp or the name of a workalike program. |
be used to obtain a literal percent character. |
487 |
* `tramp-rcp-args' |
* `tramp-copy-program' |
488 |
|
This specifies the name of the program to use for remotely copying |
489 |
|
the file; this might be the absolute filename of rcp or the name of |
490 |
|
a workalike program. |
491 |
|
* `tramp-copy-args' |
492 |
This specifies the list of parameters to pass to the above mentioned |
This specifies the list of parameters to pass to the above mentioned |
493 |
program, the hints for `tramp-rsh-args' also apply here. |
program, the hints for `tramp-login-args' also apply here. |
494 |
* `tramp-rcp-keep-date-arg' |
* `tramp-copy-keep-date-arg' |
495 |
This specifies the parameter to use for `rcp' when the timestamp |
This specifies the parameter to use for the copying program when the |
496 |
of the original file should be kept. For `rcp', use `-p', for |
timestamp of the original file should be kept. For `rcp', use `-p', for |
497 |
`rsync', use `-t'. |
`rsync', use `-t'. |
498 |
* `tramp-su-program' |
* `tramp-password-end-of-line' |
499 |
This specifies the name of the program to use for `su'. |
This specifies the string to use for terminating the line after |
500 |
* `tramp-su-args' |
submitting the password. If this method parameter is nil, then the |
501 |
This specifies the list of arguments to pass to `su'. |
value of the normal variable `tramp-default-password-end-of-line' |
502 |
\"%u\" is replaced by the user name, use \"%%\" for a literal |
is used. This parameter is necessary because the \"plink\" program |
503 |
percent character. |
requires any two characters after sending the password. These do |
504 |
* `tramp-telnet-program' |
not have to be newline or carriage return characters. Other login |
505 |
Specifies the telnet program to use when using |
programs are happy with just one character, the newline character. |
506 |
`tramp-open-connection-telnet' to log in. |
We use \"xy\" as the value for methods using \"plink\". |
507 |
* `tramp-telnet-args' |
|
508 |
Specifies list of arguments to pass to `telnet'. The hints for |
What does all this mean? Well, you should specify `tramp-login-program' |
509 |
`tramp-rsh-args' also apply here. |
for all methods; this program is used to log in to the remote site. Then, |
510 |
|
there are two ways to actually transfer the files between the local and the |
511 |
What does all this mean? Well, you should specify `tramp-rsh-program', |
remote side. One way is using an additional rcp-like program. If you want |
512 |
`tramp-telnet-program' or `tramp-su-program' for all methods; this program |
to do this, set `tramp-copy-program' in the method. |
|
is used to log in to the remote site. Then, there are two ways to |
|
|
actually transfer the files between the local and the remote side. |
|
|
One way is using an additional rcp-like program. If you want to do |
|
|
this, set `tramp-rcp-program' in the method. |
|
513 |
|
|
514 |
Another possibility for file transfer is inline transfer, i.e. the |
Another possibility for file transfer is inline transfer, i.e. the |
515 |
file is passed through the same buffer used by `tramp-rsh-program'. In |
file is passed through the same buffer used by `tramp-login-program'. In |
516 |
this case, the file contents need to be protected since the |
this case, the file contents need to be protected since the |
517 |
`tramp-rsh-program' might use escape codes or the connection might not |
`tramp-login-program' might use escape codes or the connection might not |
518 |
be eight-bit clean. Therefore, file contents are encoded for transit. |
be eight-bit clean. Therefore, file contents are encoded for transit. |
519 |
See the variable `tramp-coding-commands' for details. |
See the variable `tramp-coding-commands' for details. |
520 |
|
|
521 |
So, to summarize: if the method is an out-of-band method, then you |
So, to summarize: if the method is an out-of-band method, then you |
522 |
must specify `tramp-rcp-program' and `tramp-rcp-args'. If it is an |
must specify `tramp-copy-program' and `tramp-copy-args'. If it is an |
523 |
inline method, then these two parameters should be nil. Every method, |
inline method, then these two parameters should be nil. Every method, |
524 |
inline or out of band, must specify `tramp-connection-function' plus |
inline or out of band, must specify `tramp-connection-function' plus |
525 |
the associated arguments (for example, the telnet program if you chose |
the associated arguments (for example, the login program if you chose |
526 |
`tramp-open-connection-telnet'). |
`tramp-open-connection-telnet'). |
527 |
|
|
528 |
Notes: |
Notes: |
536 |
:type '(repeat |
:type '(repeat |
537 |
(cons string |
(cons string |
538 |
(set (list (const tramp-connection-function) function) |
(set (list (const tramp-connection-function) function) |
539 |
(list (const tramp-rsh-program) |
(list (const tramp-login-program) |
540 |
(choice (const nil) string)) |
(choice (const nil) string)) |
541 |
(list (const tramp-rcp-program) |
(list (const tramp-copy-program) |
542 |
(choice (const nil) string)) |
(choice (const nil) string)) |
543 |
(list (const tramp-remote-sh) |
(list (const tramp-remote-sh) |
544 |
(choice (const nil) string)) |
(choice (const nil) string)) |
545 |
(list (const tramp-rsh-args) (repeat string)) |
(list (const tramp-login-args) (repeat string)) |
546 |
(list (const tramp-rcp-args) (repeat string)) |
(list (const tramp-copy-args) (repeat string)) |
547 |
(list (const tramp-rcp-keep-date-arg) |
(list (const tramp-copy-keep-date-arg) |
|
(choice (const nil) string)) |
|
|
(list (const tramp-su-program) |
|
548 |
(choice (const nil) string)) |
(choice (const nil) string)) |
|
(list (const tramp-su-args) (repeat string)) |
|
549 |
(list (const tramp-encoding-command) |
(list (const tramp-encoding-command) |
550 |
(choice (const nil) string)) |
(choice (const nil) string)) |
551 |
(list (const tramp-decoding-command) |
(list (const tramp-decoding-command) |
554 |
(choice (const nil) function)) |
(choice (const nil) function)) |
555 |
(list (const tramp-decoding-function) |
(list (const tramp-decoding-function) |
556 |
(choice (const nil) function)) |
(choice (const nil) function)) |
557 |
(list (const tramp-telnet-program) |
(list (const tramp-password-end-of-line) |
558 |
(choice (const nil) string)) |
(choice (const nil) string)))))) |
|
(list (const tramp-telnet-args) (repeat string)))))) |
|
559 |
|
|
560 |
(defcustom tramp-multi-methods '("multi" "multiu") |
(defcustom tramp-multi-methods '("multi" "multiu") |
561 |
"*List of multi-hop methods. |
"*List of multi-hop methods. |
567 |
(defcustom tramp-multi-connection-function-alist |
(defcustom tramp-multi-connection-function-alist |
568 |
'(("telnet" tramp-multi-connect-telnet "telnet %h%n") |
'(("telnet" tramp-multi-connect-telnet "telnet %h%n") |
569 |
("rsh" tramp-multi-connect-rlogin "rsh %h -l %u%n") |
("rsh" tramp-multi-connect-rlogin "rsh %h -l %u%n") |
570 |
|
("remsh" tramp-multi-connect-rlogin "remsh %h -l %u%n") |
571 |
("ssh" tramp-multi-connect-rlogin "ssh %h -l %u%n") |
("ssh" tramp-multi-connect-rlogin "ssh %h -l %u%n") |
572 |
("su" tramp-multi-connect-su "su - %u%n") |
("su" tramp-multi-connect-su "su - %u%n") |
573 |
("sudo" tramp-multi-connect-su "sudo -u %u -s%n")) |
("sudo" tramp-multi-connect-su "sudo -u %u -s -p Password:%n")) |
574 |
"*List of connection functions for multi-hop methods. |
"*List of connection functions for multi-hop methods. |
575 |
Each list item is a list of three items (METHOD FUNCTION COMMAND), |
Each list item is a list of three items (METHOD FUNCTION COMMAND), |
576 |
where METHOD is the name as used in the file name, FUNCTION is the |
where METHOD is the name as used in the file name, FUNCTION is the |
588 |
:group 'tramp |
:group 'tramp |
589 |
:type '(repeat (list string function string))) |
:type '(repeat (list string function string))) |
590 |
|
|
591 |
(defcustom tramp-default-method "ssh" |
(defcustom tramp-default-method |
592 |
|
(if (and (fboundp 'executable-find) |
593 |
|
(executable-find "plink")) |
594 |
|
"plink" |
595 |
|
"ssh") |
596 |
"*Default method to use for transferring files. |
"*Default method to use for transferring files. |
597 |
See `tramp-methods' for possibilities. |
See `tramp-methods' for possibilities. |
598 |
Also see `tramp-default-method-alist'." |
Also see `tramp-default-method-alist'." |
622 |
(unless (memq system-type '(windows-nt)) |
(unless (memq system-type '(windows-nt)) |
623 |
'((tramp-parse-rhosts "/etc/hosts.equiv") |
'((tramp-parse-rhosts "/etc/hosts.equiv") |
624 |
(tramp-parse-rhosts "~/.rhosts"))) |
(tramp-parse-rhosts "~/.rhosts"))) |
625 |
"Default list of (FUNCTION FILE) pairs to be examined for rsh methods." |
"Default list of (FUNCTION FILE) pairs to be examined for rsh methods.") |
|
) |
|
626 |
|
|
627 |
;; Default values for non-Unices seeked |
;; Default values for non-Unices seeked |
628 |
(defconst tramp-completion-function-alist-ssh |
(defconst tramp-completion-function-alist-ssh |
635 |
(tramp-parse-rhosts "~/.shosts") |
(tramp-parse-rhosts "~/.shosts") |
636 |
(tramp-parse-shosts "~/.ssh/known_hosts") |
(tramp-parse-shosts "~/.ssh/known_hosts") |
637 |
(tramp-parse-sconfig "~/.ssh/config"))) |
(tramp-parse-sconfig "~/.ssh/config"))) |
638 |
"Default list of (FUNCTION FILE) pairs to be examined for ssh methods." |
"Default list of (FUNCTION FILE) pairs to be examined for ssh methods.") |
|
) |
|
639 |
|
|
640 |
;; Default values for non-Unices seeked |
;; Default values for non-Unices seeked |
641 |
(defconst tramp-completion-function-alist-telnet |
(defconst tramp-completion-function-alist-telnet |
642 |
(unless (memq system-type '(windows-nt)) |
(unless (memq system-type '(windows-nt)) |
643 |
'((tramp-parse-hosts "/etc/hosts"))) |
'((tramp-parse-hosts "/etc/hosts"))) |
644 |
"Default list of (FUNCTION FILE) pairs to be examined for telnet methods." |
"Default list of (FUNCTION FILE) pairs to be examined for telnet methods.") |
|
) |
|
645 |
|
|
646 |
;; Default values for non-Unices seeked |
;; Default values for non-Unices seeked |
647 |
(defconst tramp-completion-function-alist-su |
(defconst tramp-completion-function-alist-su |
648 |
(unless (memq system-type '(windows-nt)) |
(unless (memq system-type '(windows-nt)) |
649 |
'((tramp-parse-passwd "/etc/passwd"))) |
'((tramp-parse-passwd "/etc/passwd"))) |
650 |
"Default list of (FUNCTION FILE) pairs to be examined for su methods." |
"Default list of (FUNCTION FILE) pairs to be examined for su methods.") |
|
) |
|
651 |
|
|
652 |
(defcustom tramp-completion-function-alist |
(defcustom tramp-completion-function-alist |
653 |
(list (cons "rcp" tramp-completion-function-alist-rsh) |
(list (cons "rcp" tramp-completion-function-alist-rsh) |
657 |
(cons "scp1_old" tramp-completion-function-alist-ssh) |
(cons "scp1_old" tramp-completion-function-alist-ssh) |
658 |
(cons "scp2_old" tramp-completion-function-alist-ssh) |
(cons "scp2_old" tramp-completion-function-alist-ssh) |
659 |
(cons "rsync" tramp-completion-function-alist-rsh) |
(cons "rsync" tramp-completion-function-alist-rsh) |
660 |
|
(cons "remcp" tramp-completion-function-alist-rsh) |
661 |
(cons "rsh" tramp-completion-function-alist-rsh) |
(cons "rsh" tramp-completion-function-alist-rsh) |
662 |
(cons "ssh" tramp-completion-function-alist-ssh) |
(cons "ssh" tramp-completion-function-alist-ssh) |
663 |
(cons "ssh1" tramp-completion-function-alist-ssh) |
(cons "ssh1" tramp-completion-function-alist-ssh) |
664 |
(cons "ssh2" tramp-completion-function-alist-ssh) |
(cons "ssh2" tramp-completion-function-alist-ssh) |
665 |
(cons "ssh1_old" tramp-completion-function-alist-ssh) |
(cons "ssh1_old" tramp-completion-function-alist-ssh) |
666 |
(cons "ssh2_old" tramp-completion-function-alist-ssh) |
(cons "ssh2_old" tramp-completion-function-alist-ssh) |
667 |
|
(cons "remsh" tramp-completion-function-alist-rsh) |
668 |
(cons "telnet" tramp-completion-function-alist-telnet) |
(cons "telnet" tramp-completion-function-alist-telnet) |
669 |
(cons "su" tramp-completion-function-alist-su) |
(cons "su" tramp-completion-function-alist-su) |
670 |
(cons "sudo" tramp-completion-function-alist-su) |
(cons "sudo" tramp-completion-function-alist-su) |
673 |
(cons "sshx" tramp-completion-function-alist-ssh) |
(cons "sshx" tramp-completion-function-alist-ssh) |
674 |
(cons "krlogin" tramp-completion-function-alist-rsh) |
(cons "krlogin" tramp-completion-function-alist-rsh) |
675 |
(cons "plink" tramp-completion-function-alist-ssh) |
(cons "plink" tramp-completion-function-alist-ssh) |
676 |
|
(cons "plink1" tramp-completion-function-alist-ssh) |
677 |
(cons "pscp" tramp-completion-function-alist-ssh) |
(cons "pscp" tramp-completion-function-alist-ssh) |
678 |
(cons "fcp" tramp-completion-function-alist-ssh) |
(cons "fcp" tramp-completion-function-alist-ssh) |
679 |
) |
) |
701 |
"*String used for end of line in rsh connections. |
"*String used for end of line in rsh connections. |
702 |
I don't think this ever needs to be changed, so please tell me about it |
I don't think this ever needs to be changed, so please tell me about it |
703 |
if you need to change this. |
if you need to change this. |
704 |
Also see `tramp-password-end-of-line'." |
Also see the method parameter `tramp-password-end-of-line' and the normal |
705 |
|
variable `tramp-default-password-end-of-line'." |
706 |
:group 'tramp |
:group 'tramp |
707 |
:type 'string) |
:type 'string) |
708 |
|
|
709 |
(defcustom tramp-password-end-of-line tramp-rsh-end-of-line |
(defcustom tramp-default-password-end-of-line |
710 |
|
tramp-rsh-end-of-line |
711 |
"*String used for end of line after sending a password. |
"*String used for end of line after sending a password. |
712 |
|
This variable provides the default value for the method parameter |
713 |
|
`tramp-password-end-of-line', see `tramp-methods' for more details. |
714 |
|
|
715 |
It seems that people using plink under Windows need to send |
It seems that people using plink under Windows need to send |
716 |
\"\\r\\n\" (carriage-return, then newline) after a password, but just |
\"\\r\\n\" (carriage-return, then newline) after a password, but just |
717 |
\"\\n\" after all other lines. This variable can be used for the |
\"\\n\" after all other lines. This variable can be used for the |
741 |
:type 'regexp) |
:type 'regexp) |
742 |
|
|
743 |
(defcustom tramp-shell-prompt-pattern |
(defcustom tramp-shell-prompt-pattern |
744 |
"^[^#$%>\n]*[#$%>] *" |
"^[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*" |
745 |
"Regexp to match prompts from remote shell. |
"Regexp to match prompts from remote shell. |
746 |
Normally, Tramp expects you to configure `shell-prompt-pattern' |
Normally, Tramp expects you to configure `shell-prompt-pattern' |
747 |
correctly, but sometimes it happens that you are connecting to a |
correctly, but sometimes it happens that you are connecting to a |
748 |
remote host which sends a different kind of shell prompt. Therefore, |
remote host which sends a different kind of shell prompt. Therefore, |
749 |
Tramp recognizes things matched by `shell-prompt-pattern' as prompt, |
Tramp recognizes things matched by `shell-prompt-pattern' as prompt, |
750 |
and also things matched by this variable. The default value of this |
and also things matched by this variable. The default value of this |
751 |
variable is the same as the default value of `shell-prompt-pattern', |
variable is similar to the default value of `shell-prompt-pattern', |
752 |
which should work well in many cases." |
which should work well in many cases." |
753 |
:group 'tramp |
:group 'tramp |
754 |
:type 'regexp) |
:type 'regexp) |
843 |
for tilde expansion. The extra arguments should typically prevent the |
for tilde expansion. The extra arguments should typically prevent the |
844 |
shell from reading its init file." |
shell from reading its init file." |
845 |
:group 'tramp |
:group 'tramp |
846 |
:type '(alist :key-type string :value-type string)) |
;; This might be the wrong way to test whether the widget type |
847 |
|
;; `alist' is available. Who knows the right way to test it? |
848 |
|
:type (if (get 'alist 'widget-type) |
849 |
|
'(alist :key-type string :value-type string) |
850 |
|
'(repeat (cons string string)))) |
851 |
|
|
852 |
(defcustom tramp-prefix-format |
(defcustom tramp-prefix-format |
853 |
(if tramp-unified-filenames "/" "/[") |
(if tramp-unified-filenames "/" "/[") |
1212 |
:group 'tramp |
:group 'tramp |
1213 |
:type '(repeat (list variable function))) |
:type '(repeat (list variable function))) |
1214 |
|
|
1215 |
|
(defcustom tramp-initial-commands |
1216 |
|
'("unset correct" |
1217 |
|
"unset autocorrect") |
1218 |
|
"List of commands to send to the first remote shell that we see. |
1219 |
|
These commands will be sent to any shell, and thus they should be |
1220 |
|
designed to work in such circumstances. Also, restrict the commands |
1221 |
|
to the bare necessity for getting the remote shell into a state |
1222 |
|
where it is possible to execute the Bourne-ish shell. |
1223 |
|
|
1224 |
|
At the moment, the command to execute the Bourne-ish shell uses strange |
1225 |
|
quoting which `tcsh' tries to correct, so we send the command \"unset |
1226 |
|
autocorrect\" to the remote host." |
1227 |
|
:group 'tramp |
1228 |
|
:type '(repeat string)) |
1229 |
|
|
1230 |
;; Chunked sending kluge. We set this to 500 for black-listed constellations |
;; Chunked sending kluge. We set this to 500 for black-listed constellations |
1231 |
;; known to have a bug in `process-send-string'; some ssh connections appear |
;; known to have a bug in `process-send-string'; some ssh connections appear |
1232 |
;; to drop bytes when data is sent too quickly. |
;; to drop bytes when data is sent too quickly. |
1301 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1302 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1303 |
|
|
1304 |
(defvar tramp-rsh-program nil |
(defvar tramp-login-program nil |
1305 |
"This internal variable holds a parameter for `tramp-methods'. |
"This internal variable holds a parameter for `tramp-methods'. |
1306 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1307 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1308 |
|
|
1309 |
(defvar tramp-rsh-args nil |
(defvar tramp-login-args nil |
1310 |
"This internal variable holds a parameter for `tramp-methods'. |
"This internal variable holds a parameter for `tramp-methods'. |
1311 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1312 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1313 |
|
|
1314 |
(defvar tramp-rcp-program nil |
(defvar tramp-copy-program nil |
1315 |
"This internal variable holds a parameter for `tramp-methods'. |
"This internal variable holds a parameter for `tramp-methods'. |
1316 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1317 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1318 |
|
|
1319 |
(defvar tramp-rcp-args nil |
(defvar tramp-copy-args nil |
1320 |
"This internal variable holds a parameter for `tramp-methods'. |
"This internal variable holds a parameter for `tramp-methods'. |
1321 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1322 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1323 |
|
|
1324 |
(defvar tramp-rcp-keep-date-arg nil |
(defvar tramp-copy-keep-date-arg nil |
1325 |
"This internal variable holds a parameter for `tramp-methods'. |
"This internal variable holds a parameter for `tramp-methods'. |
1326 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1327 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1346 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1347 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1348 |
|
|
1349 |
(defvar tramp-telnet-program nil |
(defvar tramp-password-end-of-line nil |
|
"This internal variable holds a parameter for `tramp-methods'. |
|
|
In the connection buffer, this variable has the value of the like-named |
|
|
method parameter, as specified in `tramp-methods' (which see).") |
|
|
|
|
|
(defvar tramp-telnet-args nil |
|
|
"This internal variable holds a parameter for `tramp-methods'. |
|
|
In the connection buffer, this variable has the value of the like-named |
|
|
method parameter, as specified in `tramp-methods' (which see).") |
|
|
|
|
|
(defvar tramp-su-program nil |
|
1350 |
"This internal variable holds a parameter for `tramp-methods'. |
"This internal variable holds a parameter for `tramp-methods'. |
1351 |
In the connection buffer, this variable has the value of the like-named |
In the connection buffer, this variable has the value of the like-named |
1352 |
method parameter, as specified in `tramp-methods' (which see).") |
method parameter, as specified in `tramp-methods' (which see).") |
1649 |
normal Emacs functions.") |
normal Emacs functions.") |
1650 |
|
|
1651 |
;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
1652 |
(defvar tramp-foreign-file-name-handler-alist nil |
(defvar tramp-foreign-file-name-handler-alist |
1653 |
|
;; (identity . tramp-sh-file-name-handler) should always be the last |
1654 |
|
;; entry, since `identity' always matches. |
1655 |
|
'((identity . tramp-sh-file-name-handler)) |
1656 |
"Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. |
"Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. |
1657 |
If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by |
If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by |
1658 |
calling HANDLER.") |
calling HANDLER.") |
1923 |
(setq numchase (1+ numchase)) |
(setq numchase (1+ numchase)) |
1924 |
(when (file-name-absolute-p symlink-target) |
(when (file-name-absolute-p symlink-target) |
1925 |
(setq result nil)) |
(setq result nil)) |
1926 |
|
;; If the symlink was absolute, we'll get a string like |
1927 |
|
;; "/user@host:/some/target"; extract the |
1928 |
|
;; "/some/target" part from it. |
1929 |
|
(when (tramp-tramp-file-p symlink-target) |
1930 |
|
(with-parsed-tramp-file-name symlink-target sym |
1931 |
|
(unless (equal (list multi-method method user host) |
1932 |
|
(list sym-multi-method sym-method |
1933 |
|
sym-user sym-host)) |
1934 |
|
(error "Symlink target `%s' on wrong host" |
1935 |
|
symlink-target)) |
1936 |
|
(setq symlink-target localname))) |
1937 |
(setq steps |
(setq steps |
1938 |
(append (tramp-split-string symlink-target "/") steps))) |
(append (tramp-split-string symlink-target "/") steps))) |
1939 |
(t |
(t |
2240 |
(fa2 (file-attributes file2))) |
(fa2 (file-attributes file2))) |
2241 |
(if (and (not (equal (nth 5 fa1) '(0 0))) |
(if (and (not (equal (nth 5 fa1) '(0 0))) |
2242 |
(not (equal (nth 5 fa2) '(0 0)))) |
(not (equal (nth 5 fa2) '(0 0)))) |
2243 |
(> 0 (car (tramp-time-diff (nth 5 fa1) (nth 5 fa2)))) |
(> 0 (tramp-time-diff (nth 5 fa1) (nth 5 fa2))) |
2244 |
;; If one of them is the dont-know value, then we can |
;; If one of them is the dont-know value, then we can |
2245 |
;; still try to run a shell command on the remote host. |
;; still try to run a shell command on the remote host. |
2246 |
;; However, this only works if both files are Tramp |
;; However, this only works if both files are Tramp |
2311 |
"Like `file-symlink-p' for tramp files." |
"Like `file-symlink-p' for tramp files." |
2312 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2313 |
(let ((x (car (tramp-handle-file-attributes filename)))) |
(let ((x (car (tramp-handle-file-attributes filename)))) |
2314 |
(when (stringp x) x)))) |
(when (stringp x) |
2315 |
|
;; When Tramp is running on VMS, then `file-name-absolute-p' |
2316 |
|
;; might do weird things. |
2317 |
|
(if (file-name-absolute-p x) |
2318 |
|
(tramp-make-tramp-file-name |
2319 |
|
multi-method method user host x) |
2320 |
|
x))))) |
2321 |
|
|
2322 |
(defun tramp-handle-file-writable-p (filename) |
(defun tramp-handle-file-writable-p (filename) |
2323 |
"Like `file-writable-p' for tramp files." |
"Like `file-writable-p' for tramp files." |
2340 |
|
|
2341 |
;; Other file name ops. |
;; Other file name ops. |
2342 |
|
|
2343 |
;; ;; Matthias Köppe <mkoeppe@mail.math.uni-magdeburg.de> |
;; ;; Matthias K,Av(Bppe <mkoeppe@mail.math.uni-magdeburg.de> |
2344 |
;; (defun tramp-handle-directory-file-name (directory) |
;; (defun tramp-handle-directory-file-name (directory) |
2345 |
;; "Like `directory-file-name' for tramp files." |
;; "Like `directory-file-name' for tramp files." |
2346 |
;; (if (and (eq (aref directory (- (length directory) 1)) ?/) |
;; (if (and (eq (aref directory (- (length directory) 1)) ?/) |
2530 |
;; At least one file a tramp file? |
;; At least one file a tramp file? |
2531 |
(if (or (tramp-tramp-file-p filename) |
(if (or (tramp-tramp-file-p filename) |
2532 |
(tramp-tramp-file-p newname)) |
(tramp-tramp-file-p newname)) |
2533 |
(tramp-do-copy-or-rename-file |
(let ((modes (file-modes filename))) |
2534 |
'copy filename newname ok-if-already-exists keep-date) |
(tramp-do-copy-or-rename-file |
2535 |
|
'copy filename newname ok-if-already-exists keep-date) |
2536 |
|
(set-file-modes newname modes)) |
2537 |
(tramp-run-real-handler |
(tramp-run-real-handler |
2538 |
'copy-file |
'copy-file |
2539 |
(list filename newname ok-if-already-exists keep-date)))) |
(list filename newname ok-if-already-exists keep-date)))) |
2602 |
;; source and target file. |
;; source and target file. |
2603 |
|
|
2604 |
;; CCC: If both source and target are Tramp files, |
;; CCC: If both source and target are Tramp files, |
2605 |
;; and both are using the same rcp-program, then we |
;; and both are using the same copy-program, then we |
2606 |
;; can invoke rcp directly. Note that |
;; can invoke rcp directly. Note that |
2607 |
;; default-directory should point to a local |
;; default-directory should point to a local |
2608 |
;; directory if we want to invoke rcp. |
;; directory if we want to invoke rcp. |
2629 |
(save-excursion |
(save-excursion |
2630 |
(set-buffer trampbuf) (erase-buffer) |
(set-buffer trampbuf) (erase-buffer) |
2631 |
(insert-file-contents-literally filename) |
(insert-file-contents-literally filename) |
2632 |
(let ((coding-system-for-write 'no-conversion)) |
;; We don't want the target file to be compressed, so we let-bind |
2633 |
|
;; `jka-compr-inhibit' to t. |
2634 |
|
(let ((coding-system-for-write 'binary) |
2635 |
|
(jka-compr-inhibit t)) |
2636 |
(write-region (point-min) (point-max) newname))) |
(write-region (point-min) (point-max) newname))) |
2637 |
;; If the operation was `rename', delete the original file. |
;; If the operation was `rename', delete the original file. |
2638 |
(unless (eq op 'copy) |
(unless (eq op 'copy) |
2923 |
;; would otherwise use backslash. |
;; would otherwise use backslash. |
2924 |
(let ((directory-sep-char ?/)) |
(let ((directory-sep-char ?/)) |
2925 |
(tramp-make-tramp-file-name |
(tramp-make-tramp-file-name |
2926 |
multi-method method user host |
multi-method (or method (tramp-find-default-method user host)) |
2927 |
|
user host |
2928 |
(tramp-drop-volume-letter |
(tramp-drop-volume-letter |
2929 |
(tramp-run-real-handler 'expand-file-name |
(tramp-run-real-handler 'expand-file-name |
2930 |
(list localname))))))))) |
(list localname))))))))) |
2957 |
(let (status) |
(let (status) |
2958 |
(when (string-match "&[ \t]*\\'" command) |
(when (string-match "&[ \t]*\\'" command) |
2959 |
(error "Tramp doesn't grok asynchronous shell commands, yet")) |
(error "Tramp doesn't grok asynchronous shell commands, yet")) |
2960 |
(when error-buffer |
;; (when error-buffer |
2961 |
(error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet")) |
;; (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet")) |
2962 |
(save-excursion |
(save-excursion |
2963 |
(tramp-barf-unless-okay |
(tramp-barf-unless-okay |
2964 |
multi-method method user host |
multi-method method user host |
2966 |
nil 'file-error |
nil 'file-error |
2967 |
"tramp-handle-shell-command: Couldn't `cd %s'" |
"tramp-handle-shell-command: Couldn't `cd %s'" |
2968 |
(tramp-shell-quote-argument localname)) |
(tramp-shell-quote-argument localname)) |
2969 |
(tramp-send-command multi-method method user host |
(tramp-send-command |
2970 |
(concat command "; tramp_old_status=$?")) |
multi-method method user host |
2971 |
|
(if error-buffer |
2972 |
|
(format "( %s ) 2>/tmp/tramp.$$.err; tramp_old_status=$?" |
2973 |
|
command) |
2974 |
|
(format "%s ;tramp_old_status=$?" command))) |
2975 |
;; This will break if the shell command prints "/////" |
;; This will break if the shell command prints "/////" |
2976 |
;; somewhere. Let's just hope for the best... |
;; somewhere. Let's just hope for the best... |
2977 |
(tramp-wait-for-output)) |
(tramp-wait-for-output)) |
2983 |
(setq output-buffer (current-buffer))) |
(setq output-buffer (current-buffer))) |
2984 |
(set-buffer output-buffer) |
(set-buffer output-buffer) |
2985 |
(insert-buffer (tramp-get-buffer multi-method method user host)) |
(insert-buffer (tramp-get-buffer multi-method method user host)) |
2986 |
|
(when error-buffer |
2987 |
|
(save-excursion |
2988 |
|
(unless (bufferp error-buffer) |
2989 |
|
(setq error-buffer (get-buffer-create error-buffer))) |
2990 |
|
(tramp-send-command |
2991 |
|
multi-method method user host |
2992 |
|
"cat /tmp/tramp.$$.err") |
2993 |
|
(tramp-wait-for-output) |
2994 |
|
(set-buffer error-buffer) |
2995 |
|
(insert-buffer (tramp-get-buffer multi-method method user host)) |
2996 |
|
(tramp-send-command-and-check |
2997 |
|
multi-method method user host "rm -f /tmp/tramp.$$.err"))) |
2998 |
(save-excursion |
(save-excursion |
2999 |
(tramp-send-command multi-method method user host "cd") |
(tramp-send-command multi-method method user host "cd") |
3000 |
(tramp-wait-for-output) |
(tramp-wait-for-output) |
3030 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
3031 |
(let ((output-buf (get-buffer-create "*tramp output*")) |
(let ((output-buf (get-buffer-create "*tramp output*")) |
3032 |
(tramp-buf (tramp-get-buffer multi-method method user host)) |
(tramp-buf (tramp-get-buffer multi-method method user host)) |
3033 |
(rcp-program (tramp-get-rcp-program |
(copy-program (tramp-get-copy-program |
3034 |
multi-method |
multi-method |
3035 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
3036 |
user host)) |
user host)) |
3037 |
(rcp-args (tramp-get-rcp-args |
(copy-args (tramp-get-copy-args |
3038 |
multi-method |
multi-method |
3039 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
3040 |
user host)) |
user host)) |
3041 |
;; We used to bind the following as late as possible. |
;; We used to bind the following as late as possible. |
3042 |
;; loc-enc and loc-dec were bound directly before the if |
;; loc-enc and loc-dec were bound directly before the if |
3043 |
;; statement that checks them. But the functions |
;; statement that checks them. But the functions |
3053 |
(error "Cannot make local copy of non-existing file `%s'" |
(error "Cannot make local copy of non-existing file `%s'" |
3054 |
filename)) |
filename)) |
3055 |
(setq tmpfil (tramp-make-temp-file)) |
(setq tmpfil (tramp-make-temp-file)) |
3056 |
(cond (rcp-program |
(cond (copy-program |
3057 |
|
;; The following should be changed. We need a more general |
3058 |
|
;; mechanism to parse extra host args. |
3059 |
|
(when (string-match "\\([^#]*\\)#\\(.*\\)" host) |
3060 |
|
(setq copy-args (cons "-p" (cons (match-string 2 host) |
3061 |
|
rsh-args))) |
3062 |
|
(setq host (match-string 1 host))) |
3063 |
;; Use rcp-like program for file transfer. |
;; Use rcp-like program for file transfer. |
3064 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
3065 |
multi-method method user host |
multi-method method user host |
3068 |
(unless (equal |
(unless (equal |
3069 |
0 |
0 |
3070 |
(apply #'call-process |
(apply #'call-process |
3071 |
rcp-program |
copy-program |
3072 |
nil output-buf nil |
nil output-buf nil |
3073 |
(append rcp-args |
(append copy-args |
3074 |
(list |
(list |
3075 |
(tramp-make-rcp-program-file-name |
(tramp-make-copy-program-file-name |
3076 |
user host |
user host |
3077 |
(tramp-shell-quote-argument localname)) |
(tramp-shell-quote-argument localname)) |
3078 |
tmpfil)))) |
tmpfil)))) |
3080 |
(error |
(error |
3081 |
(concat "tramp-handle-file-local-copy: `%s' didn't work, " |
(concat "tramp-handle-file-local-copy: `%s' didn't work, " |
3082 |
"see buffer `%s' for details") |
"see buffer `%s' for details") |
3083 |
rcp-program output-buf)) |
copy-program output-buf)) |
3084 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
3085 |
multi-method method user host |
multi-method method user host |
3086 |
5 "Fetching %s to tmp file %s...done" filename tmpfil)) |
5 "Fetching %s to tmp file %s...done" filename tmpfil)) |
3120 |
;; line from the output here. Go to point-max, |
;; line from the output here. Go to point-max, |
3121 |
;; search backward for tramp_exit_status, delete |
;; search backward for tramp_exit_status, delete |
3122 |
;; between point and point-max if found. |
;; between point and point-max if found. |
3123 |
(let ((coding-system-for-write 'no-conversion)) |
(let ((coding-system-for-write 'binary)) |
3124 |
(funcall loc-dec (point-min) (point-max)) |
(funcall loc-dec (point-min) (point-max)) |
3125 |
(write-region (point-min) (point-max) tmpfil)) |
(write-region (point-min) (point-max) tmpfil)) |
3126 |
(kill-buffer tmpbuf)) |
(kill-buffer tmpbuf)) |
3157 |
(signal 'file-error |
(signal 'file-error |
3158 |
(format "File `%s' not found on remote host" filename)) |
(format "File `%s' not found on remote host" filename)) |
3159 |
(list (expand-file-name filename) 0)) |
(list (expand-file-name filename) 0)) |
3160 |
(let ((local-copy (file-local-copy filename)) |
;; `insert-file-contents-literally' takes care to avoid calling |
3161 |
|
;; jka-compr. By let-binding inhibit-file-name-operation, we |
3162 |
|
;; propagate that care to the file-local-copy operation. |
3163 |
|
(let ((local-copy |
3164 |
|
(let ((inhibit-file-name-operation |
3165 |
|
(when (eq inhibit-file-name-operation |
3166 |
|
'insert-file-contents) |
3167 |
|
'file-local-copy))) |
3168 |
|
(file-local-copy filename))) |
3169 |
(coding-system-used nil) |
(coding-system-used nil) |
3170 |
(result nil)) |
(result nil)) |
3171 |
(when visit |
(when visit |
3212 |
(error "File not overwritten"))) |
(error "File not overwritten"))) |
3213 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
3214 |
(let ((curbuf (current-buffer)) |
(let ((curbuf (current-buffer)) |
3215 |
(rcp-program (tramp-get-rcp-program |
(copy-program (tramp-get-copy-program |
3216 |
multi-method (tramp-find-method multi-method method user host) |
multi-method |
3217 |
user host)) |
(tramp-find-method multi-method method user host) |
3218 |
(rcp-args (tramp-get-rcp-args |
user host)) |
3219 |
|
(copy-args (tramp-get-copy-args |
3220 |
multi-method |
multi-method |
3221 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
3222 |
user host)) |
user host)) |
3254 |
;; decoding command must be specified. However, if the method |
;; decoding command must be specified. However, if the method |
3255 |
;; _also_ specifies an encoding function, then that is used for |
;; _also_ specifies an encoding function, then that is used for |
3256 |
;; encoding the contents of the tmp file. |
;; encoding the contents of the tmp file. |
3257 |
(cond (rcp-program |
(cond (copy-program |
3258 |
|
;; The following should be changed. We need a more general |
3259 |
|
;; mechanism to parse extra host args. |
3260 |
|
(when (string-match "\\([^#]*\\)#\\(.*\\)" host) |
3261 |
|
(setq copy-args (cons "-p" (cons (match-string 2 host) |
3262 |
|
rsh-args))) |
3263 |
|
(setq host (match-string 1 host))) |
3264 |
|
|
3265 |
;; use rcp-like program for file transfer |
;; use rcp-like program for file transfer |
3266 |
(let ((argl (append rcp-args |
(let ((argl (append copy-args |
3267 |
(list |
(list |
3268 |
tmpfil |
tmpfil |
3269 |
(tramp-make-rcp-program-file-name |
(tramp-make-copy-program-file-name |
3270 |
user host |
user host |
3271 |
(tramp-shell-quote-argument localname)))))) |
(tramp-shell-quote-argument localname)))))) |
3272 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
3273 |
multi-method method user host |
multi-method method user host |
3274 |
6 "Writing tmp file using `%s'..." rcp-program) |
6 "Writing tmp file using `%s'..." copy-program) |
3275 |
(save-excursion (set-buffer trampbuf) (erase-buffer)) |
(save-excursion (set-buffer trampbuf) (erase-buffer)) |
3276 |
(when tramp-debug-buffer |
(when tramp-debug-buffer |
3277 |
(save-excursion |
(save-excursion |
3279 |
method user host)) |
method user host)) |
3280 |
(goto-char (point-max)) |
(goto-char (point-max)) |
3281 |
(tramp-insert-with-face |
(tramp-insert-with-face |
3282 |
'bold (format "$ %s %s\n" rcp-program |
'bold (format "$ %s %s\n" copy-program |
3283 |
(mapconcat 'identity argl " "))))) |
(mapconcat 'identity argl " "))))) |
3284 |
(unless (equal 0 |
(unless (equal 0 |
3285 |
(apply #'call-process |
(apply #'call-process |
3286 |
rcp-program nil trampbuf nil argl)) |
copy-program nil trampbuf nil argl)) |
3287 |
(pop-to-buffer trampbuf) |
(pop-to-buffer trampbuf) |
3288 |
(error |
(error |
3289 |
"Cannot write region to file `%s', command `%s' failed" |
"Cannot write region to file `%s', command `%s' failed" |
3290 |
filename rcp-program)) |
filename copy-program)) |
3291 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
3292 |
multi-method method user host |
multi-method method user host |
3293 |
6 "Transferring file using `%s'...done" |
6 "Transferring file using `%s'...done" |
3294 |
rcp-program))) |
copy-program))) |
3295 |
((and rem-enc rem-dec) |
((and rem-enc rem-dec) |
3296 |
;; Use inline file transfer |
;; Use inline file transfer |
3297 |
(let ((tmpbuf (get-buffer-create " *tramp file transfer*"))) |
(let ((tmpbuf (get-buffer-create " *tramp file transfer*"))) |
3525 |
(defun tramp-find-foreign-file-name-handler (filename) |
(defun tramp-find-foreign-file-name-handler (filename) |
3526 |
"Return foreign file name handler if exists." |
"Return foreign file name handler if exists." |
3527 |
(when (tramp-tramp-file-p filename) |
(when (tramp-tramp-file-p filename) |
3528 |
(let (elt res) |
(let (elt |
3529 |
(dolist (elt tramp-foreign-file-name-handler-alist res) |
res |
3530 |
|
(handler-alist tramp-foreign-file-name-handler-alist)) |
3531 |
|
(while handler-alist |
3532 |
|
(setq elt (car handler-alist) |
3533 |
|
handler-alist (cdr handler-alist)) |
3534 |
(when (funcall (car elt) filename) |
(when (funcall (car elt) filename) |
3535 |
|
(setq handler-alist nil) |
3536 |
(setq res (cdr elt)))) |
(setq res (cdr elt)))) |
3537 |
res))) |
res))) |
3538 |
|
|
3539 |
;; Main function. |
;; Main function. |
3540 |
;;;###autoload |
;;;###autoload |
3541 |
(defun tramp-file-name-handler (operation &rest args) |
(defun tramp-file-name-handler (operation &rest args) |
3542 |
"Invoke tramp file name handler. |
"Invoke Tramp file name handler. |
3543 |
Falls back to normal file name handler if no tramp file name handler exists." |
Falls back to normal file name handler if no tramp file name handler exists." |
3544 |
(save-match-data |
(save-match-data |
3545 |
(let* ((fn (assoc operation tramp-file-name-handler-alist)) |
(let* ((filename (apply 'tramp-file-name-for-operation operation args)) |
|
(filename (apply 'tramp-file-name-for-operation operation args)) |
|
3546 |
(foreign (tramp-find-foreign-file-name-handler filename))) |
(foreign (tramp-find-foreign-file-name-handler filename))) |
3547 |
(cond |
(cond |
3548 |
(foreign (apply foreign operation args)) |
(foreign (apply foreign operation args)) |
|
(fn (apply (cdr fn) args)) |
|
3549 |
(t (tramp-run-real-handler operation args)))))) |
(t (tramp-run-real-handler operation args)))))) |
3550 |
|
|
3551 |
|
;;;###autoload |
3552 |
(put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p |
(put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p |
3553 |
|
|
3554 |
|
(defun tramp-sh-file-name-handler (operation &rest args) |
3555 |
|
"Invoke remote-shell Tramp file name handler. |
3556 |
|
Fall back to normal file name handler if no Tramp handler exists." |
3557 |
|
(save-match-data |
3558 |
|
(let ((fn (assoc operation tramp-file-name-handler-alist))) |
3559 |
|
(if fn |
3560 |
|
(apply (cdr fn) args) |
3561 |
|
(tramp-run-real-handler operation args))))) |
3562 |
|
|
3563 |
;;;###autoload |
;;;###autoload |
3564 |
(defun tramp-completion-file-name-handler (operation &rest args) |
(defun tramp-completion-file-name-handler (operation &rest args) |
3565 |
"Invoke tramp file name completion handler. |
"Invoke tramp file name completion handler. |
3573 |
(save-match-data (apply (cdr fn) args)) |
(save-match-data (apply (cdr fn) args)) |
3574 |
(tramp-completion-run-real-handler operation args)))) |
(tramp-completion-run-real-handler operation args)))) |
3575 |
|
|
3576 |
|
;;;###autoload |
3577 |
|
(put 'tramp-completion-file-name-handler 'safe-magic t) |
3578 |
|
|
3579 |
;; Register in file name handler alist |
;; Register in file name handler alist |
3580 |
;;;###autoload |
;;;###autoload |
3581 |
(add-to-list 'file-name-handler-alist |
(add-to-list 'file-name-handler-alist |
4195 |
|
|
4196 |
(defun tramp-buffer-name (multi-method method user host) |
(defun tramp-buffer-name (multi-method method user host) |
4197 |
"A name for the connection buffer for USER at HOST using METHOD." |
"A name for the connection buffer for USER at HOST using METHOD." |
4198 |
(cond (multi-method |
(if multi-method |
4199 |
(tramp-buffer-name-multi-method "tramp" multi-method method user host)) |
(tramp-buffer-name-multi-method "tramp" multi-method method user host) |
4200 |
(user |
(let ((method (tramp-find-method multi-method method user host))) |
4201 |
(format "*tramp/%s %s@%s*" method user host)) |
(if user |
4202 |
(t |
(format "*tramp/%s %s@%s*" method user host)) |
4203 |
(format "*tramp/%s %s*" method host)))) |
(format "*tramp/%s %s*" method host)))) |
4204 |
|
|
4205 |
(defun tramp-buffer-name-multi-method (prefix multi-method method user host) |
(defun tramp-buffer-name-multi-method (prefix multi-method method user host) |
4206 |
"A name for the multi method connection buffer. |
"A name for the multi method connection buffer. |
4230 |
|
|
4231 |
(defun tramp-debug-buffer-name (multi-method method user host) |
(defun tramp-debug-buffer-name (multi-method method user host) |
4232 |
"A name for the debug buffer for USER at HOST using METHOD." |
"A name for the debug buffer for USER at HOST using METHOD." |
4233 |
(cond (multi-method |
(if multi-method |
4234 |
(tramp-buffer-name-multi-method "debug tramp" |
(tramp-buffer-name-multi-method "debug tramp" |
4235 |
multi-method method user host)) |
multi-method method user host) |
4236 |
(user |
(let ((method (tramp-find-method multi-method method user host))) |
4237 |
(format "*debug tramp/%s %s@%s*" method user host)) |
(if user |
4238 |
(t |
(format "*debug tramp/%s %s@%s*" method user host) |
4239 |
(format "*debug tramp/%s %s*" method host)))) |
(format "*debug tramp/%s %s*" method host))))) |
4240 |
|
|
4241 |
(defun tramp-get-debug-buffer (multi-method method user host) |
(defun tramp-get-debug-buffer (multi-method method user host) |
4242 |
"Get the debug buffer for USER at HOST using METHOD." |
"Get the debug buffer for USER at HOST using METHOD." |
4620 |
(unless (eq exit 'ok) |
(unless (eq exit 'ok) |
4621 |
(error "Login failed")))) |
(error "Login failed")))) |
4622 |
|
|
4623 |
|
;; Functions to execute when we have seen the remote shell prompt but |
4624 |
|
;; before we exec the Bourne-ish shell. Note that these commands |
4625 |
|
;; might be sent to any shell, not just a Bourne-ish shell. This |
4626 |
|
;; means that the commands need to work in all shells. (It is also |
4627 |
|
;; okay for some commands to just fail with an error message, but |
4628 |
|
;; please make sure that they at least don't crash the odd shell people |
4629 |
|
;; might be running...) |
4630 |
|
(defun tramp-process-initial-commands (p |
4631 |
|
multi-method method user host |
4632 |
|
commands) |
4633 |
|
"Send list of commands to remote host, in order." |
4634 |
|
(let (cmd) |
4635 |
|
(while commands |
4636 |
|
(setq cmd (pop commands)) |
4637 |
|
(erase-buffer) |
4638 |
|
(tramp-message 10 "Sending command to remote shell: %s" |
4639 |
|
cmd) |
4640 |
|
(tramp-send-command multi-method method user host cmd) |
4641 |
|
(tramp-barf-if-no-shell-prompt |
4642 |
|
p 60 "Remote shell command failed: %s" cmd)) |
4643 |
|
(erase-buffer))) |
4644 |
|
|
4645 |
;; The actual functions for opening connections. |
;; The actual functions for opening connections. |
4646 |
|
|
4647 |
(defun tramp-open-connection-telnet (multi-method method user host) |
(defun tramp-open-connection-telnet (multi-method method user host) |
4686 |
(p (apply 'start-process |
(p (apply 'start-process |
4687 |
(tramp-buffer-name multi-method method user host) |
(tramp-buffer-name multi-method method user host) |
4688 |
(tramp-get-buffer multi-method method user host) |
(tramp-get-buffer multi-method method user host) |
4689 |
(tramp-get-telnet-program |
(tramp-get-login-program |
4690 |
multi-method |
multi-method |
4691 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4692 |
user host) |
user host) |
4693 |
host |
host |
4694 |
(tramp-get-telnet-args |
(tramp-get-login-args |
4695 |
multi-method |
multi-method |
4696 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4697 |
user host))) |
user host))) |
4743 |
(let ((process-environment (copy-sequence process-environment)) |
(let ((process-environment (copy-sequence process-environment)) |
4744 |
(bufnam (tramp-buffer-name multi-method method user host)) |
(bufnam (tramp-buffer-name multi-method method user host)) |
4745 |
(buf (tramp-get-buffer multi-method method user host)) |
(buf (tramp-get-buffer multi-method method user host)) |
4746 |
(rsh-program (tramp-get-rsh-program |
(login-program (tramp-get-login-program |
4747 |
multi-method |
multi-method |
4748 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4749 |
user host)) |
user host)) |
4750 |
(rsh-args (tramp-get-rsh-args |
(login-args (tramp-get-login-args |
4751 |
multi-method |
multi-method |
4752 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4753 |
user host))) |
user host))) |
4754 |
;; The following should be changed. We need a more general |
;; The following should be changed. We need a more general |
4755 |
;; mechanism to parse extra host args. |
;; mechanism to parse extra host args. |
4756 |
(when (string-match "\\([^#]*\\)#\\(.*\\)" host) |
(when (string-match "\\([^#]*\\)#\\(.*\\)" host) |
4757 |
(setq rsh-args (cons "-p" (cons (match-string 2 host) rsh-args))) |
(setq login-args (cons "-p" (cons (match-string 2 host) rsh-args))) |
4758 |
(setq host (match-string 1 host))) |
(setq host (match-string 1 host))) |
4759 |
(setenv "TERM" tramp-terminal-type) |
(setenv "TERM" tramp-terminal-type) |
4760 |
(let* ((default-directory (tramp-temporary-file-directory)) |
(let* ((default-directory (tramp-temporary-file-directory)) |
4765 |
(> emacs-major-version 20)) |
(> emacs-major-version 20)) |
4766 |
tramp-dos-coding-system)) |
tramp-dos-coding-system)) |
4767 |
(p (if (and user (not (string= user ""))) |
(p (if (and user (not (string= user ""))) |
4768 |
(apply #'start-process bufnam buf rsh-program |
(apply #'start-process bufnam buf login-program |
4769 |
host "-l" user rsh-args) |
host "-l" user login-args) |
4770 |
(apply #'start-process bufnam buf rsh-program |
(apply #'start-process bufnam buf login-program |
4771 |
host rsh-args))) |
host login-args))) |
4772 |
(found nil)) |
(found nil)) |
4773 |
(process-kill-without-query p) |
(process-kill-without-query p) |
4774 |
|
|
4818 |
(p (apply 'start-process |
(p (apply 'start-process |
4819 |
(tramp-buffer-name multi-method method user host) |
(tramp-buffer-name multi-method method user host) |
4820 |
(tramp-get-buffer multi-method method user host) |
(tramp-get-buffer multi-method method user host) |
4821 |
(tramp-get-su-program |
(tramp-get-login-program |
4822 |
multi-method |
multi-method |
4823 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4824 |
user host) |
user host) |
4825 |
(mapcar |
(mapcar |
4826 |
(lambda (x) |
(lambda (x) |
4827 |
(format-spec x `((?u . ,(or user "root"))))) |
(format-spec x `((?u . ,(or user "root"))))) |
4828 |
(tramp-get-su-args |
(tramp-get-login-args |
4829 |
multi-method |
multi-method |
4830 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4831 |
user host)))) |
user host)))) |
5029 |
"]]")))) |
"]]")))) |
5030 |
found)) |
found)) |
5031 |
|
|
5032 |
|
(defun tramp-wait-for-shell-prompt (proc timeout) |
5033 |
|
"Wait for the shell prompt to appear from process PROC within TIMEOUT seconds. |
5034 |
|
See `tramp-wait-for-regexp' for more details. |
5035 |
|
Shell prompt pattern is determined by variables `shell-prompt-pattern' |
5036 |
|
and `tramp-shell-prompt-pattern'." |
5037 |
|
(tramp-wait-for-regexp |
5038 |
|
proc timeout |
5039 |
|
(format "\\(%s\\|%s\\)\\'" |
5040 |
|
shell-prompt-pattern tramp-shell-prompt-pattern))) |
5041 |
|
|
5042 |
|
(defun tramp-barf-if-no-shell-prompt (proc timeout &rest error-args) |
5043 |
|
"Wait for shell prompt and barf if none appears. |
5044 |
|
Looks at process PROC to see if a shell prompt appears in TIMEOUT |
5045 |
|
seconds. If not, it produces an error message with the given ERROR-ARGS." |
5046 |
|
(unless (tramp-wait-for-shell-prompt proc timeout) |
5047 |
|
(pop-to-buffer (buffer-name)) |
5048 |
|
(apply 'error error-args))) |
5049 |
|
|
5050 |
(defun tramp-enter-password (p prompt) |
(defun tramp-enter-password (p prompt) |
5051 |
"Prompt for a password and send it to the remote end. |
"Prompt for a password and send it to the remote end. |
5052 |
Uses PROMPT as a prompt and sends the password to process P." |
Uses PROMPT as a prompt and sends the password to process P." |
5053 |
(let ((pw (tramp-read-passwd prompt))) |
(let ((pw (tramp-read-passwd prompt))) |
5054 |
(erase-buffer) |
(erase-buffer) |
5055 |
(process-send-string p (concat pw tramp-password-end-of-line)))) |
(process-send-string |
5056 |
|
p (concat pw |
5057 |
|
(tramp-get-password-end-of-line |
5058 |
|
tramp-current-multi-method |
5059 |
|
tramp-current-method |
5060 |
|
tramp-current-user |
5061 |
|
tramp-current-host))))) |
5062 |
|
|
5063 |
;; HHH: Not Changed. This might handle the case where USER is not |
;; HHH: Not Changed. This might handle the case where USER is not |
5064 |
;; given in the "File name" very poorly. Then, the local |
;; given in the "File name" very poorly. Then, the local |
5084 |
;; a Kerberos login. |
;; a Kerberos login. |
5085 |
(sit-for 1) |
(sit-for 1) |
5086 |
(tramp-discard-garbage-erase-buffer p multi-method method user host) |
(tramp-discard-garbage-erase-buffer p multi-method method user host) |
5087 |
|
(tramp-process-initial-commands p multi-method method user host |
5088 |
|
tramp-initial-commands) |
5089 |
;; It is useful to set the prompt in the following command because |
;; It is useful to set the prompt in the following command because |
5090 |
;; some people have a setting for $PS1 which /bin/sh doesn't know |
;; some people have a setting for $PS1 which /bin/sh doesn't know |
5091 |
;; about and thus /bin/sh will display a strange prompt. For |
;; about and thus /bin/sh will display a strange prompt. For |
5098 |
;; because that is read by some sh implementations (eg, bash when |
;; because that is read by some sh implementations (eg, bash when |
5099 |
;; called as sh) on startup; this way, we avoid the startup file |
;; called as sh) on startup; this way, we avoid the startup file |
5100 |
;; clobbering $PS1. |
;; clobbering $PS1. |
5101 |
(process-send-string nil (format "exec env 'ENV=' 'PS1=$ ' %s%s" |
(tramp-send-command-internal |
5102 |
(tramp-get-remote-sh |
multi-method method user host |
5103 |
multi-method method user host) |
(format "exec env 'ENV=' 'PS1=$ ' %s" |
5104 |
tramp-rsh-end-of-line)) |
(tramp-get-remote-sh multi-method method user host)) |
5105 |
(when tramp-debug-buffer |
(format "remote `%s' to come up" |
5106 |
(save-excursion |
(tramp-get-remote-sh multi-method method user host))) |
5107 |
(set-buffer (tramp-get-debug-buffer multi-method method user host)) |
(tramp-barf-if-no-shell-prompt |
5108 |
(goto-char (point-max)) |
p 30 |
5109 |
(tramp-insert-with-face |
"Remote `%s' didn't come up. See buffer `%s' for details" |
5110 |
'bold (format "$ exec env PS1='$ ' %s\n" |
(tramp-get-remote-sh multi-method method user host) |
5111 |
(tramp-get-remote-sh multi-method method user host))))) |
(buffer-name)) |
5112 |
(tramp-message 9 "Waiting 30s for remote `%s' to come up..." |
(tramp-message 8 "Setting up remote shell environment") |
|
(tramp-get-remote-sh multi-method method user host)) |
|
|
(unless (tramp-wait-for-regexp |
|
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error "Remote `%s' didn't come up. See buffer `%s' for details" |
|
|
(tramp-get-remote-sh multi-method method user host) |
|
|
(buffer-name))) |
|
|
(tramp-message 9 "Setting up remote shell environment") |
|
5113 |
(tramp-discard-garbage-erase-buffer p multi-method method user host) |
(tramp-discard-garbage-erase-buffer p multi-method method user host) |
5114 |
(process-send-string |
(tramp-send-command-internal multi-method method user host |
5115 |
nil (format "stty -inlcr -echo kill '^U'%s" tramp-rsh-end-of-line)) |
"stty -inlcr -echo kill '^U'") |
|
(unless (tramp-wait-for-regexp |
|
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error "Couldn't `stty -echo', see buffer `%s'" (buffer-name))) |
|
5116 |
(erase-buffer) |
(erase-buffer) |
5117 |
(process-send-string nil (format "TERM=dumb; export TERM%s" |
(tramp-send-command-internal multi-method method user host |
5118 |
tramp-rsh-end-of-line)) |
"TERM=dumb; export TERM") |
|
(unless (tramp-wait-for-regexp |
|
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error "Couldn't `TERM=dumb; export TERM', see buffer `%s'" (buffer-name))) |
|
5119 |
;; Try to set up the coding system correctly. |
;; Try to set up the coding system correctly. |
5120 |
;; CCC this can't be the right way to do it. Hm. |
;; CCC this can't be the right way to do it. Hm. |
5121 |
(save-excursion |
(save-excursion |
5122 |
(erase-buffer) |
(erase-buffer) |
5123 |
(tramp-message 9 "Determining coding system") |
(tramp-message 9 "Determining coding system") |
5124 |
(process-send-string nil (format "echo foo ; echo bar %s" |
(tramp-send-command-internal multi-method method user host |
5125 |
tramp-rsh-end-of-line)) |
"echo foo ; echo bar") |
|
(unless (tramp-wait-for-regexp |
|
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error "Couldn't `echo foo; echo bar' to determine line endings'")) |
|
5126 |
(goto-char (point-min)) |
(goto-char (point-min)) |
5127 |
(if (featurep 'mule) |
(if (featurep 'mule) |
5128 |
;; Use MULE to select the right EOL convention for communicating |
;; Use MULE to select the right EOL convention for communicating |
5145 |
;; We have found a ^M but cannot frob the process coding system |
;; We have found a ^M but cannot frob the process coding system |
5146 |
;; because we're running on a non-MULE Emacs. Let's try |
;; because we're running on a non-MULE Emacs. Let's try |
5147 |
;; stty, instead. |
;; stty, instead. |
5148 |
|
(erase-buffer) |
5149 |
(tramp-message 9 "Trying `stty -onlcr'") |
(tramp-message 9 "Trying `stty -onlcr'") |
5150 |
(process-send-string nil (format "stty -onlcr%s" tramp-rsh-end-of-line)) |
(tramp-send-command-internal multi-method method user host |
5151 |
(unless (tramp-wait-for-regexp |
"stty -onlcr")))) |
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error "Couldn't `stty -onlcr', see buffer `%s'" (buffer-name)))))) |
|
5152 |
(erase-buffer) |
(erase-buffer) |
5153 |
(tramp-message |
(tramp-message |
5154 |
9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1'") |
9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1'") |
5155 |
(process-send-string |
(tramp-send-command-internal multi-method method user host |
5156 |
nil (format "HISTFILE=$HOME/.tramp_history; HISTSIZE=1%s" |
"HISTFILE=$HOME/.tramp_history; HISTSIZE=1") |
|
tramp-rsh-end-of-line)) |
|
|
(unless (tramp-wait-for-regexp |
|
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error (concat "Couldn't `HISTFILE=$HOME/.tramp_history; " |
|
|
"HISTSIZE=1', see buffer `%s'") |
|
|
(buffer-name))) |
|
5157 |
(erase-buffer) |
(erase-buffer) |
5158 |
(tramp-message 9 "Waiting 30s for `set +o vi +o emacs'") |
(tramp-message 9 "Waiting 30s for `set +o vi +o emacs'") |
5159 |
(process-send-string |
(tramp-send-command-internal multi-method method user host |
5160 |
nil (format "set +o vi +o emacs%s" ;mustn't `>/dev/null' with AIX? |
"set +o vi +o emacs") |
|
tramp-rsh-end-of-line)) |
|
|
(unless (tramp-wait-for-regexp |
|
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error "Couldn't `set +o vi +o emacs', see buffer `%s'" |
|
|
(buffer-name))) |
|
5161 |
(erase-buffer) |
(erase-buffer) |
5162 |
(tramp-message 9 "Waiting 30s for `unset MAIL MAILCHECK MAILPATH'") |
(tramp-message 9 "Waiting 30s for `unset MAIL MAILCHECK MAILPATH'") |
5163 |
(process-send-string |
(tramp-send-command-internal |
5164 |
nil (format "unset MAIL MAILCHECK MAILPATH 1>/dev/null 2>/dev/null%s" |
multi-method method user host |
5165 |
tramp-rsh-end-of-line)) |
"unset MAIL MAILCHECK MAILPATH 1>/dev/null 2>/dev/null") |
|
(unless (tramp-wait-for-regexp |
|
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error "Couldn't `unset MAIL MAILCHECK MAILPATH', see buffer `%s'" |
|
|
(buffer-name))) |
|
5166 |
(erase-buffer) |
(erase-buffer) |
5167 |
(tramp-message 9 "Waiting 30s for `unset CDPATH'") |
(tramp-message 9 "Waiting 30s for `unset CDPATH'") |
5168 |
(process-send-string |
(tramp-send-command-internal multi-method method user host |
5169 |
nil (format "unset CDPATH%s" tramp-rsh-end-of-line)) |
"unset CDPATH") |
|
(unless (tramp-wait-for-regexp |
|
|
p 30 (format "\\(%s\\|%s\\)\\'" |
|
|
shell-prompt-pattern tramp-shell-prompt-pattern)) |
|
|
(pop-to-buffer (buffer-name)) |
|
|
(error "Couldn't `unset CDPATH', see buffer `%s'" |
|
|
(buffer-name))) |
|
5170 |
(erase-buffer) |
(erase-buffer) |
5171 |
(tramp-message 9 "Setting shell prompt") |
(tramp-message 9 "Setting shell prompt") |
5172 |
;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must |
;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must |
5290 |
" -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" |
" -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" |
5291 |
"}")) |
"}")) |
5292 |
(tramp-wait-for-output) |
(tramp-wait-for-output) |
5293 |
(unless (tramp-get-rcp-program |
(unless (tramp-get-copy-program |
5294 |
multi-method |
multi-method |
5295 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
5296 |
user host) |
user host) |
5332 |
(tramp-set-connection-property "ln" ln multi-method method user host))) |
(tramp-set-connection-property "ln" ln multi-method method user host))) |
5333 |
(erase-buffer) |
(erase-buffer) |
5334 |
;; Find the right encoding/decoding commands to use. |
;; Find the right encoding/decoding commands to use. |
5335 |
(unless (tramp-get-rcp-program |
(unless (tramp-get-copy-program |
5336 |
multi-method |
multi-method |
5337 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
5338 |
user host) |
user host) |
5577 |
(process-send-string proc |
(process-send-string proc |
5578 |
(concat command tramp-rsh-end-of-line)))) |
(concat command tramp-rsh-end-of-line)))) |
5579 |
|
|
5580 |
|
(defun tramp-send-command-internal |
5581 |
|
(multi-method method user host command &optional msg) |
5582 |
|
"Send command to remote host and wait for success. |
5583 |
|
Sends COMMAND, then waits 30 seconds for shell prompt." |
5584 |
|
(tramp-send-command multi-method method user host command t t) |
5585 |
|
(when msg |
5586 |
|
(tramp-message 9 "Waiting 30s for %s..." msg)) |
5587 |
|
(tramp-barf-if-no-shell-prompt |
5588 |
|
nil 30 |
5589 |
|
"Couldn't `%s', see buffer `%s'" command (buffer-name))) |
5590 |
|
|
5591 |
(defun tramp-wait-for-output (&optional timeout) |
(defun tramp-wait-for-output (&optional timeout) |
5592 |
"Wait for output from remote rsh command." |
"Wait for output from remote rsh command." |
5593 |
(let ((proc (get-buffer-process (current-buffer))) |
(let ((proc (get-buffer-process (current-buffer))) |
5718 |
(mapconcat 'identity |
(mapconcat 'identity |
5719 |
(split-string string "\n") |
(split-string string "\n") |
5720 |
tramp-rsh-end-of-line)) |
tramp-rsh-end-of-line)) |
5721 |
(unless (string-equal (substring string -1) tramp-rsh-end-of-line) |
(unless (or (string= string "") |
5722 |
|
(string-equal (substring string -1) tramp-rsh-end-of-line)) |
5723 |
(setq string (concat string tramp-rsh-end-of-line))) |
(setq string (concat string tramp-rsh-end-of-line))) |
5724 |
;; send the string |
;; send the string |
5725 |
(if (and tramp-chunksize (not (zerop tramp-chunksize))) |
(if (and tramp-chunksize (not (zerop tramp-chunksize))) |
6025 |
(incf i))) |
(incf i))) |
6026 |
(concat prefix hops localname))) |
(concat prefix hops localname))) |
6027 |
|
|
6028 |
(defun tramp-make-rcp-program-file-name (user host localname) |
(defun tramp-make-copy-program-file-name (user host localname) |
6029 |
"Create a file name suitable to be passed to `rcp'." |
"Create a file name suitable to be passed to `rcp' and workalikes." |
6030 |
(if user |
(if user |
6031 |
(format "%s@%s:%s" user host localname) |
(format "%s@%s:%s" user host localname) |
6032 |
(format "%s:%s" host localname))) |
(format "%s:%s" host localname))) |
6034 |
(defun tramp-method-out-of-band-p (multi-method method user host) |
(defun tramp-method-out-of-band-p (multi-method method user host) |
6035 |
"Return t if this is an out-of-band method, nil otherwise. |
"Return t if this is an out-of-band method, nil otherwise. |
6036 |
It is important to check for this condition, since it is not possible |
It is important to check for this condition, since it is not possible |
6037 |
to enter a password for the `tramp-rcp-program'." |
to enter a password for the `tramp-copy-program'." |
6038 |
(tramp-get-rcp-program |
(tramp-get-copy-program |
6039 |
multi-method |
multi-method |
6040 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
6041 |
user host)) |
user host)) |
6133 |
(error "Method `%s' didn't specify a remote shell" |
(error "Method `%s' didn't specify a remote shell" |
6134 |
(or multi-method method))))) |
(or multi-method method))))) |
6135 |
|
|
6136 |
(defun tramp-get-rsh-program (multi-method method user host) |
(defun tramp-get-login-program (multi-method method user host) |
6137 |
(second (or (assoc 'tramp-rsh-program |
(second (or (assoc 'tramp-login-program |
6138 |
(assoc (tramp-find-method multi-method method user host) |
(assoc (tramp-find-method multi-method method user host) |
6139 |
tramp-methods)) |
tramp-methods)) |
6140 |
(error "Method `%s' didn't specify an rsh program" |
(error "Method `%s' didn't specify a login program" |
6141 |
(or multi-method method))))) |
(or multi-method method))))) |
6142 |
|
|
6143 |
(defun tramp-get-rsh-args (multi-method method user host) |
(defun tramp-get-login-args (multi-method method user host) |
6144 |
(second (or (assoc 'tramp-rsh-args |
(second (or (assoc 'tramp-login-args |
6145 |
(assoc (tramp-find-method multi-method method user host) |
(assoc (tramp-find-method multi-method method user host) |
6146 |
tramp-methods)) |
tramp-methods)) |
6147 |
(error "Method `%s' didn't specify rsh args" |
(error "Method `%s' didn't specify login args" |
6148 |
(or multi-method method))))) |
(or multi-method method))))) |
6149 |
|
|
6150 |
(defun tramp-get-rcp-program (multi-method method user host) |
(defun tramp-get-copy-program (multi-method method user host) |
6151 |
(second (or (assoc 'tramp-rcp-program |
(second (or (assoc 'tramp-copy-program |
6152 |
(assoc (tramp-find-method multi-method method user host) |
(assoc (tramp-find-method multi-method method user host) |
6153 |
tramp-methods)) |
tramp-methods)) |
6154 |
(error "Method `%s' didn't specify an rcp program" |
(error "Method `%s' didn't specify a copy program" |
6155 |
(or multi-method method))))) |
(or multi-method method))))) |
6156 |
|
|
6157 |
(defun tramp-get-rcp-args (multi-method method user host) |
(defun tramp-get-copy-args (multi-method method user host) |
6158 |
(second (or (assoc 'tramp-rcp-args |
(second (or (assoc 'tramp-copy-args |
6159 |
(assoc (tramp-find-method multi-method method user host) |
(assoc (tramp-find-method multi-method method user host) |
6160 |
tramp-methods)) |
tramp-methods)) |
6161 |
(error "Method `%s' didn't specify rcp args" |
(error "Method `%s' didn't specify copy args" |
6162 |
(or multi-method method))))) |
(or multi-method method))))) |
6163 |
|
|
6164 |
(defun tramp-get-rcp-keep-date-arg (multi-method method user host) |
(defun tramp-get-copy-keep-date-arg (multi-method method user host) |
6165 |
(second (or (assoc 'tramp-rcp-keep-date-arg |
(second (or (assoc 'tramp-copy-keep-date-arg |
6166 |
(assoc (tramp-find-method multi-method method user host) |
(assoc (tramp-find-method multi-method method user host) |
6167 |
tramp-methods)) |
tramp-methods)) |
6168 |
(error "Method `%s' didn't specify `keep-date' arg for tramp" |
(error "Method `%s' didn't specify `keep-date' arg for tramp" |
6169 |
(or multi-method method))))) |
(or multi-method method))))) |
6170 |
|
|
6171 |
(defun tramp-get-su-program (multi-method method user host) |
(defun tramp-get-password-end-of-line (multi-method method user host) |
6172 |
(second (or (assoc 'tramp-su-program |
(let ((entry (assoc 'tramp-password-end-of-line |
6173 |
(assoc (tramp-find-method multi-method method user host) |
(assoc (tramp-find-method multi-method method user host) |
6174 |
tramp-methods)) |
tramp-methods)))) |
6175 |
(error "Method `%s' didn't specify a su program" |
(unless entry |
6176 |
(or multi-method method))))) |
(error "Method `%s' didn't specify `password-end-of-line' arg for tramp" |
6177 |
|
(or multi-method method))) |
6178 |
(defun tramp-get-su-args (multi-method method user host) |
(or (second entry) tramp-default-password-end-of-line))) |
|
(second (or (assoc 'tramp-su-args |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify su args" |
|
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-telnet-program (multi-method method user host) |
|
|
(second (or (assoc 'tramp-telnet-program |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify a telnet program" |
|
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-telnet-args (multi-method method user host) |
|
|
(second (or (assoc 'tramp-telnet-args |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify telnet args" |
|
|
(or multi-method method))))) |
|
|
|
|
6179 |
|
|
6180 |
;; Auto saving to a special directory. |
;; Auto saving to a special directory. |
6181 |
|
|
6263 |
NOTE: This function will fail if the time difference is too large to |
NOTE: This function will fail if the time difference is too large to |
6264 |
fit in an integer." |
fit in an integer." |
6265 |
;; Pacify byte-compiler with `symbol-function'. |
;; Pacify byte-compiler with `symbol-function'. |
6266 |
(cond ((fboundp 'subtract-time) |
(cond ((and (fboundp 'subtract-time) |
6267 |
(cadr (funcall (symbol-function 'subtract-time) t1 t2))) |
(fboundp 'float-time)) |
6268 |
|
(funcall (symbol-function 'float-time) |
6269 |
|
(funcall (symbol-function 'subtract-time) t1 t2))) |
6270 |
|
((and (fboundp 'subtract-time) |
6271 |
|
(fboundp 'time-to-seconds)) |
6272 |
|
(funcall (symbol-function 'time-to-seconds) |
6273 |
|
(funcall (symbol-function 'subtract-time) t1 t2))) |
6274 |
((fboundp 'itimer-time-difference) |
((fboundp 'itimer-time-difference) |
6275 |
(floor (funcall |
(floor (funcall |
6276 |
(symbol-function 'itimer-time-difference) |
(symbol-function 'itimer-time-difference) |
6277 |
(if (< (length t1) 3) (append t1 '(0)) t1) |
(if (< (length t1) 3) (append t1 '(0)) t1) |
6278 |
(if (< (length t2) 3) (append t2 '(0)) t2)))) |
(if (< (length t2) 3) (append t2 '(0)) t2)))) |
6279 |
(t |
(t |
6280 |
;; snarfed from Emacs 21 time-date.el |
;; snarfed from Emacs 21 time-date.el; combining |
6281 |
(cadr (let ((borrow (< (cadr t1) (cadr t2)))) |
;; time-to-seconds and subtract-time |
6282 |
|
(let ((time (let ((borrow (< (cadr t1) (cadr t2)))) |
6283 |
(list (- (car t1) (car t2) (if borrow 1 0)) |
(list (- (car t1) (car t2) (if borrow 1 0)) |
6284 |
(- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))))) |
(- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))) |
6285 |
|
(+ (* (car time) 65536.0) |
6286 |
|
(cadr time) |
6287 |
|
(/ (or (nth 2 time) 0) 1000000.0)))))) |
6288 |
|
|
6289 |
(defun tramp-coding-system-change-eol-conversion (coding-system eol-type) |
(defun tramp-coding-system-change-eol-conversion (coding-system eol-type) |
6290 |
"Return a coding system like CODING-SYSTEM but with given EOL-TYPE. |
"Return a coding system like CODING-SYSTEM but with given EOL-TYPE. |
6442 |
tramp-auto-save-directory ; vars to dump |
tramp-auto-save-directory ; vars to dump |
6443 |
tramp-default-method |
tramp-default-method |
6444 |
tramp-rsh-end-of-line |
tramp-rsh-end-of-line |
6445 |
tramp-password-end-of-line |
tramp-default-password-end-of-line |
6446 |
tramp-remote-path |
tramp-remote-path |
6447 |
tramp-login-prompt-regexp |
tramp-login-prompt-regexp |
6448 |
tramp-password-prompt-regexp |
tramp-password-prompt-regexp |
6580 |
;; transfer method to use. (Greg Stark) |
;; transfer method to use. (Greg Stark) |
6581 |
;; * Remove unneeded parameters from methods. |
;; * Remove unneeded parameters from methods. |
6582 |
;; * Invoke rsync once for copying a whole directory hierarchy. |
;; * Invoke rsync once for copying a whole directory hierarchy. |
6583 |
;; (Francesco Potort́) |
;; (Francesco Potort,Al(B) |
6584 |
;; * Should we set PATH ourselves or should we rely on the remote end |
;; * Should we set PATH ourselves or should we rely on the remote end |
6585 |
;; to do it? |
;; to do it? |
6586 |
;; * Do the autoconf thing. |
;; * Do the autoconf thing. |
6642 |
;; unhandled-file-name-directory |
;; unhandled-file-name-directory |
6643 |
;; vc-registered |
;; vc-registered |
6644 |
|
|
6645 |
|
;;; arch-tag: 3a21a994-182b-48fa-b0cd-c1d9fede424a |
6646 |
;;; tramp.el ends here |
;;; tramp.el ends here |