aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2002-07-30 20:24:27 +0000
committerKai Großjohann2002-07-30 20:24:27 +0000
commitac474af158838341ece00dd620f79a7e7cce283d (patch)
tree1a497274b9ba8cf08b7111a546495def31bd9100
parent575698d4a58d13af0ad8d058cacdc5241771751f (diff)
downloademacs-ac474af158838341ece00dd620f79a7e7cce283d.tar.gz
emacs-ac474af158838341ece00dd620f79a7e7cce283d.zip
New version 2.0.5.
(tramp-methods): Remove inline encoding method parameters. The encoding is now autodetected. Also shorten the list of methods (u/m distinction gone) and rename the remaining methods to have longer, but more mnemonic, names. (tramp-login-prompt-regexp, tramp-password-prompt-regexp) (tramp-wrong-passwd-regexp): Trailing `$' not needed, regexp is matched at end of buffer anyway. (tramp-yesno-prompt-regexp): New variable, for questions where the user should say "yes" or "no". (tramp-file-name-structure-unified) (tramp-file-name-structure-separate): Allow dash in method names. (tramp-actions-before-shell): New variable, contains list of pattern/action pairs. Output sent by remote end is scanned for the patterns, then the actions are executed. (tramp-multi-actions): Like `tramp-actions-before-shell', but executed for each hop in a multi-hop connection. (tramp-last-cmd-time): New variable. If nothing has been sent to remote end for 60 seconds, look to see if the remote end is still alive. (tramp-perl-mime-encode, tramp-perl-mime-decode): Remove. It didn't work. (tramp-perl-encode, tramp-perl-decode): New variables, these require the MIME::Base64 module on the remote end. (tramp-handle-file-attributes): Restructure logic. (tramp-handle-file-attributes-with-ls) (tramp-handle-file-attributes-with-perl): More debugging. (tramp-handle-directory-files): Grok fifth arg `files-only' for XEmacs. (tramp-handle-make-directory, tramp-handle-delete-directory) (tramp-handle-delete-file, tramp-handle-insert-directory): Expand file name. (tramp-handle-shell-command): Use `when', not `if'. (tramp-handle-file-local-copy, tramp-handle-write-region): Adapt to autodetection of inline encoding. (tramp-invoke-ange-ftp): Require ange-ftp to make sure that variable ange-ftp-name-format is defined before binding it. (tramp-action-login, tramp-action-password, tramp-action-succeed) (tramp-action-permission-denied, tramp-action-yesno): Functions called from `tramp-actions-before-shell'. (tramp-multi-action-login, tramp-multi-action-password) (tramp-multi-action-succeed) (tramp-multi-action-permission-denied): Functions called from `tramp-multi-actions'. (tramp-process-one-action, tramp-process-actions): Pattern matching and action invocation code for `tramp-actions-before-shell'. (tramp-process-one-multi-action, tramp-process-multi-actions): Same for `tramp-multi-actions'. (tramp-open-connection-telnet, tramp-open-connection-rsh) (tramp-open-connection-su): Process actions instead of hardwired logic. (tramp-multi-connect-telnet, tramp-multi-connect-rlogin) (tramp-multi-connect-su): Ditto. (tramp-post-connection): New method for tramp_encode and tramp_decode scripts. (tramp-post-connection): Invoke inline autodetection code. (tramp-coding-commands): List of inline codings. (tramp-find-inline-encoding): This is the inline autodetection code. (tramp-maybe-open-connection): If nothing was sent to connection for 60 seconds, look if it connection is still alive. (tramp-send-command): Remember that something was sent to the connection. (tramp-make-tramp-file-name, tramp-make-tramp-multi-file-name): Use backticks for constructing alist. (tramp-get-encoding-command, tramp-set-encoding-command) (tramp-get-decoding-command, tramp-set-decoding-command) (tramp-get-encoding-function, tramp-set-encoding-function) (tramp-get-decoding-function, tramp-set-decoding-function): Use for results of inline autodetection. (tramp-get-encoding-command, tramp-get-decoding-command) (tramp-get-encoding-function, tramp-get-decoding-function): Remove these old functions.
-rw-r--r--lisp/ChangeLog77
-rw-r--r--lisp/net/tramp.el1479
2 files changed, 874 insertions, 682 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 61378cf2c09..cd8e2dfad30 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,80 @@
12002-07-30 Kai Gro,b_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
2
3 * net/tramp.el: New version 2.0.5.
4 (tramp-methods): Remove inline encoding method parameters. The
5 encoding is now autodetected. Also shorten the list of
6 methods (u/m distinction gone) and rename the remaining methods to
7 have longer, but more mnemonic, names.
8 (tramp-login-prompt-regexp, tramp-password-prompt-regexp)
9 (tramp-wrong-passwd-regexp): Trailing `$' not needed, regexp is
10 matched at end of buffer anyway.
11 (tramp-yesno-prompt-regexp): New variable, for questions where the
12 user should say "yes" or "no".
13 (tramp-file-name-structure-unified)
14 (tramp-file-name-structure-separate): Allow dash in method names.
15 (tramp-actions-before-shell): New variable, contains list of
16 pattern/action pairs. Output sent by remote end is scanned for
17 the patterns, then the actions are executed.
18 (tramp-multi-actions): Like `tramp-actions-before-shell', but
19 executed for each hop in a multi-hop connection.
20 (tramp-last-cmd-time): New variable. If nothing has been sent to
21 remote end for 60 seconds, look to see if the remote end is still
22 alive.
23 (tramp-perl-mime-encode, tramp-perl-mime-decode): Remove. It
24 didn't work.
25 (tramp-perl-encode, tramp-perl-decode): New variables, these
26 require the MIME::Base64 module on the remote end.
27 (tramp-handle-file-attributes): Restructure logic.
28 (tramp-handle-file-attributes-with-ls)
29 (tramp-handle-file-attributes-with-perl): More debugging.
30 (tramp-handle-directory-files): Grok fifth arg `files-only' for
31 XEmacs.
32 (tramp-handle-make-directory, tramp-handle-delete-directory)
33 (tramp-handle-delete-file, tramp-handle-insert-directory): Expand
34 file name.
35 (tramp-handle-shell-command): Use `when', not `if'.
36 (tramp-handle-file-local-copy, tramp-handle-write-region): Adapt
37 to autodetection of inline encoding.
38 (tramp-invoke-ange-ftp): Require ange-ftp to make sure that
39 variable ange-ftp-name-format is defined before binding it.
40 (tramp-action-login, tramp-action-password, tramp-action-succeed)
41 (tramp-action-permission-denied, tramp-action-yesno): Functions
42 called from `tramp-actions-before-shell'.
43 (tramp-multi-action-login, tramp-multi-action-password)
44 (tramp-multi-action-succeed)
45 (tramp-multi-action-permission-denied): Functions called from
46 `tramp-multi-actions'.
47 (tramp-process-one-action, tramp-process-actions): Pattern
48 matching and action invocation code for
49 `tramp-actions-before-shell'.
50 (tramp-process-one-multi-action, tramp-process-multi-actions):
51 Same for `tramp-multi-actions'.
52 (tramp-open-connection-telnet, tramp-open-connection-rsh)
53 (tramp-open-connection-su): Process actions instead of hardwired
54 logic.
55 (tramp-multi-connect-telnet, tramp-multi-connect-rlogin)
56 (tramp-multi-connect-su): Ditto.
57 (tramp-post-connection): New method for tramp_encode and
58 tramp_decode scripts.
59 (tramp-post-connection): Invoke inline autodetection code.
60 (tramp-coding-commands): List of inline codings.
61 (tramp-find-inline-encoding): This is the inline autodetection
62 code.
63 (tramp-maybe-open-connection): If nothing was sent to connection
64 for 60 seconds, look if it connection is still alive.
65 (tramp-send-command): Remember that something was sent to the
66 connection.
67 (tramp-make-tramp-file-name, tramp-make-tramp-multi-file-name):
68 Use backticks for constructing alist.
69 (tramp-get-encoding-command, tramp-set-encoding-command)
70 (tramp-get-decoding-command, tramp-set-decoding-command)
71 (tramp-get-encoding-function, tramp-set-encoding-function)
72 (tramp-get-decoding-function, tramp-set-decoding-function): Use
73 for results of inline autodetection.
74 (tramp-get-encoding-command, tramp-get-decoding-command)
75 (tramp-get-encoding-function, tramp-get-decoding-function):
76 Remove these old functions.
77
12002-07-30 Kenichi Handa <handa@etl.go.jp> 782002-07-30 Kenichi Handa <handa@etl.go.jp>
2 79
3 * language/indian.el (in-is13194): Give correct `safe-chars' property. 80 * language/indian.el (in-is13194): Give correct `safe-chars' property.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 662690e3f0a..26141c0aa20 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -69,8 +69,9 @@
69 69
70;;; Code: 70;;; Code:
71 71
72(defconst tramp-version "2.0.2" 72(defconst tramp-version "2.0.5"
73 "This version of tramp.") 73 "This version of tramp.")
74
74(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" 75(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
75 "Email address to send bug reports to.") 76 "Email address to send bug reports to.")
76 77
@@ -175,10 +176,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
175 (tramp-rcp-keep-date-arg "-p") 176 (tramp-rcp-keep-date-arg "-p")
176 (tramp-su-program nil) 177 (tramp-su-program nil)
177 (tramp-su-args nil) 178 (tramp-su-args nil)
178 (tramp-encoding-command nil)
179 (tramp-decoding-command nil)
180 (tramp-encoding-function nil)
181 (tramp-decoding-function nil)
182 (tramp-telnet-program nil) 179 (tramp-telnet-program nil)
183 (tramp-telnet-args nil)) 180 (tramp-telnet-args nil))
184 ("scp" (tramp-connection-function tramp-open-connection-rsh) 181 ("scp" (tramp-connection-function tramp-open-connection-rsh)
@@ -190,10 +187,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
190 (tramp-rcp-keep-date-arg "-p") 187 (tramp-rcp-keep-date-arg "-p")
191 (tramp-su-program nil) 188 (tramp-su-program nil)
192 (tramp-su-args nil) 189 (tramp-su-args nil)
193 (tramp-encoding-command nil)
194 (tramp-decoding-command nil)
195 (tramp-encoding-function nil)
196 (tramp-decoding-function nil)
197 (tramp-telnet-program nil) 190 (tramp-telnet-program nil)
198 (tramp-telnet-args nil)) 191 (tramp-telnet-args nil))
199 ("scp1" (tramp-connection-function tramp-open-connection-rsh) 192 ("scp1" (tramp-connection-function tramp-open-connection-rsh)
@@ -205,10 +198,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
205 (tramp-rcp-keep-date-arg "-p") 198 (tramp-rcp-keep-date-arg "-p")
206 (tramp-su-program nil) 199 (tramp-su-program nil)
207 (tramp-su-args nil) 200 (tramp-su-args nil)
208 (tramp-encoding-command nil)
209 (tramp-decoding-command nil)
210 (tramp-encoding-function nil)
211 (tramp-decoding-function nil)
212 (tramp-telnet-program nil) 201 (tramp-telnet-program nil)
213 (tramp-telnet-args nil)) 202 (tramp-telnet-args nil))
214 ("scp2" (tramp-connection-function tramp-open-connection-rsh) 203 ("scp2" (tramp-connection-function tramp-open-connection-rsh)
@@ -220,13 +209,10 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
220 (tramp-rcp-keep-date-arg "-p") 209 (tramp-rcp-keep-date-arg "-p")
221 (tramp-su-program nil) 210 (tramp-su-program nil)
222 (tramp-su-args nil) 211 (tramp-su-args nil)
223 (tramp-encoding-command nil)
224 (tramp-decoding-command nil)
225 (tramp-encoding-function nil)
226 (tramp-decoding-function nil)
227 (tramp-telnet-program nil) 212 (tramp-telnet-program nil)
228 (tramp-telnet-args nil)) 213 (tramp-telnet-args nil))
229 ("scp-ssh1" (tramp-connection-function tramp-open-connection-rsh) 214 ("scp1-old"
215 (tramp-connection-function tramp-open-connection-rsh)
230 (tramp-rsh-program "ssh1") 216 (tramp-rsh-program "ssh1")
231 (tramp-rcp-program "scp1") 217 (tramp-rcp-program "scp1")
232 (tramp-remote-sh "/bin/sh") 218 (tramp-remote-sh "/bin/sh")
@@ -235,13 +221,10 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
235 (tramp-rcp-keep-date-arg "-p") 221 (tramp-rcp-keep-date-arg "-p")
236 (tramp-su-program nil) 222 (tramp-su-program nil)
237 (tramp-su-args nil) 223 (tramp-su-args nil)
238 (tramp-encoding-command nil)
239 (tramp-decoding-command nil)
240 (tramp-encoding-function nil)
241 (tramp-decoding-function nil)
242 (tramp-telnet-program nil) 224 (tramp-telnet-program nil)
243 (tramp-telnet-args nil)) 225 (tramp-telnet-args nil))
244 ("scp-ssh2" (tramp-connection-function tramp-open-connection-rsh) 226 ("scp2-old"
227 (tramp-connection-function tramp-open-connection-rsh)
245 (tramp-rsh-program "ssh2") 228 (tramp-rsh-program "ssh2")
246 (tramp-rcp-program "scp2") 229 (tramp-rcp-program "scp2")
247 (tramp-remote-sh "/bin/sh") 230 (tramp-remote-sh "/bin/sh")
@@ -250,10 +233,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
250 (tramp-rcp-keep-date-arg "-p") 233 (tramp-rcp-keep-date-arg "-p")
251 (tramp-su-program nil) 234 (tramp-su-program nil)
252 (tramp-su-args nil) 235 (tramp-su-args nil)
253 (tramp-encoding-command nil)
254 (tramp-decoding-command nil)
255 (tramp-encoding-function nil)
256 (tramp-decoding-function nil)
257 (tramp-telnet-program nil) 236 (tramp-telnet-program nil)
258 (tramp-telnet-args nil)) 237 (tramp-telnet-args nil))
259 ("rsync" (tramp-connection-function tramp-open-connection-rsh) 238 ("rsync" (tramp-connection-function tramp-open-connection-rsh)
@@ -265,13 +244,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
265 (tramp-rcp-keep-date-arg "-t") 244 (tramp-rcp-keep-date-arg "-t")
266 (tramp-su-program nil) 245 (tramp-su-program nil)
267 (tramp-su-args nil) 246 (tramp-su-args nil)
268 (tramp-encoding-command nil)
269 (tramp-decoding-command nil)
270 (tramp-encoding-function nil)
271 (tramp-decoding-function nil)
272 (tramp-telnet-program nil) 247 (tramp-telnet-program nil)
273 (tramp-telnet-args nil)) 248 (tramp-telnet-args nil))
274 ("ru" (tramp-connection-function tramp-open-connection-rsh) 249 ("rsh" (tramp-connection-function tramp-open-connection-rsh)
275 (tramp-rsh-program "rsh") 250 (tramp-rsh-program "rsh")
276 (tramp-rcp-program nil) 251 (tramp-rcp-program nil)
277 (tramp-remote-sh "/bin/sh") 252 (tramp-remote-sh "/bin/sh")
@@ -280,14 +255,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
280 (tramp-rcp-keep-date-arg nil) 255 (tramp-rcp-keep-date-arg nil)
281 (tramp-su-program nil) 256 (tramp-su-program nil)
282 (tramp-su-args nil) 257 (tramp-su-args nil)
283 (tramp-encoding-command "uuencode xxx")
284 (tramp-decoding-command
285 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
286 (tramp-encoding-function nil)
287 (tramp-decoding-function uudecode-decode-region)
288 (tramp-telnet-program nil) 258 (tramp-telnet-program nil)
289 (tramp-telnet-args nil)) 259 (tramp-telnet-args nil))
290 ("su" (tramp-connection-function tramp-open-connection-rsh) 260 ("ssh" (tramp-connection-function tramp-open-connection-rsh)
291 (tramp-rsh-program "ssh") 261 (tramp-rsh-program "ssh")
292 (tramp-rcp-program nil) 262 (tramp-rcp-program nil)
293 (tramp-remote-sh "/bin/sh") 263 (tramp-remote-sh "/bin/sh")
@@ -296,14 +266,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
296 (tramp-rcp-keep-date-arg nil) 266 (tramp-rcp-keep-date-arg nil)
297 (tramp-su-program nil) 267 (tramp-su-program nil)
298 (tramp-su-args nil) 268 (tramp-su-args nil)
299 (tramp-encoding-command "uuencode xxx")
300 (tramp-decoding-command
301 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
302 (tramp-encoding-function nil)
303 (tramp-decoding-function uudecode-decode-region)
304 (tramp-telnet-program nil) 269 (tramp-telnet-program nil)
305 (tramp-telnet-args nil)) 270 (tramp-telnet-args nil))
306 ("su1" (tramp-connection-function tramp-open-connection-rsh) 271 ("ssh1" (tramp-connection-function tramp-open-connection-rsh)
307 (tramp-rsh-program "ssh") 272 (tramp-rsh-program "ssh")
308 (tramp-rcp-program nil) 273 (tramp-rcp-program nil)
309 (tramp-remote-sh "/bin/sh") 274 (tramp-remote-sh "/bin/sh")
@@ -312,14 +277,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
312 (tramp-rcp-keep-date-arg nil) 277 (tramp-rcp-keep-date-arg nil)
313 (tramp-su-program nil) 278 (tramp-su-program nil)
314 (tramp-su-args nil) 279 (tramp-su-args nil)
315 (tramp-encoding-command "uuencode xxx")
316 (tramp-decoding-command
317 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
318 (tramp-encoding-function nil)
319 (tramp-decoding-function uudecode-decode-region)
320 (tramp-telnet-program nil) 280 (tramp-telnet-program nil)
321 (tramp-telnet-args nil)) 281 (tramp-telnet-args nil))
322 ("su2" (tramp-connection-function tramp-open-connection-rsh) 282 ("ssh2" (tramp-connection-function tramp-open-connection-rsh)
323 (tramp-rsh-program "ssh") 283 (tramp-rsh-program "ssh")
324 (tramp-rcp-program nil) 284 (tramp-rcp-program nil)
325 (tramp-remote-sh "/bin/sh") 285 (tramp-remote-sh "/bin/sh")
@@ -328,14 +288,10 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
328 (tramp-rcp-keep-date-arg nil) 288 (tramp-rcp-keep-date-arg nil)
329 (tramp-su-program nil) 289 (tramp-su-program nil)
330 (tramp-su-args nil) 290 (tramp-su-args nil)
331 (tramp-encoding-command "uuencode xxx")
332 (tramp-decoding-command
333 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
334 (tramp-encoding-function nil)
335 (tramp-decoding-function uudecode-decode-region)
336 (tramp-telnet-program nil) 291 (tramp-telnet-program nil)
337 (tramp-telnet-args nil)) 292 (tramp-telnet-args nil))
338 ("su-ssh1" (tramp-connection-function tramp-open-connection-rsh) 293 ("ssh1-old"
294 (tramp-connection-function tramp-open-connection-rsh)
339 (tramp-rsh-program "ssh1") 295 (tramp-rsh-program "ssh1")
340 (tramp-rcp-program nil) 296 (tramp-rcp-program nil)
341 (tramp-remote-sh "/bin/sh") 297 (tramp-remote-sh "/bin/sh")
@@ -344,14 +300,10 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
344 (tramp-rcp-keep-date-arg nil) 300 (tramp-rcp-keep-date-arg nil)
345 (tramp-su-program nil) 301 (tramp-su-program nil)
346 (tramp-su-args nil) 302 (tramp-su-args nil)
347 (tramp-encoding-command "uuencode xxx")
348 (tramp-decoding-command
349 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
350 (tramp-encoding-function nil)
351 (tramp-decoding-function uudecode-decode-region)
352 (tramp-telnet-program nil) 303 (tramp-telnet-program nil)
353 (tramp-telnet-args nil)) 304 (tramp-telnet-args nil))
354 ("su-ssh2" (tramp-connection-function tramp-open-connection-rsh) 305 ("ssh2-old"
306 (tramp-connection-function tramp-open-connection-rsh)
355 (tramp-rsh-program "ssh2") 307 (tramp-rsh-program "ssh2")
356 (tramp-rcp-program nil) 308 (tramp-rcp-program nil)
357 (tramp-remote-sh "/bin/sh") 309 (tramp-remote-sh "/bin/sh")
@@ -360,88 +312,10 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
360 (tramp-rcp-keep-date-arg nil) 312 (tramp-rcp-keep-date-arg nil)
361 (tramp-su-program nil) 313 (tramp-su-program nil)
362 (tramp-su-args nil) 314 (tramp-su-args nil)
363 (tramp-encoding-command "uuencode xxx")
364 (tramp-decoding-command
365 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
366 (tramp-encoding-function nil)
367 (tramp-decoding-function uudecode-decode-region)
368 (tramp-telnet-program nil)
369 (tramp-telnet-args nil))
370 ("rm" (tramp-connection-function tramp-open-connection-rsh)
371 (tramp-rsh-program "rsh")
372 (tramp-rcp-program nil)
373 (tramp-remote-sh "/bin/sh")
374 (tramp-rsh-args nil)
375 (tramp-rcp-args nil)
376 (tramp-rcp-keep-date-arg nil)
377 (tramp-su-program nil)
378 (tramp-su-args nil)
379 (tramp-encoding-command "mimencode -b")
380 (tramp-decoding-command "mimencode -u -b")
381 (tramp-encoding-function base64-encode-region)
382 (tramp-decoding-function base64-decode-region)
383 (tramp-telnet-program nil)
384 (tramp-telnet-args nil))
385 ("sm" (tramp-connection-function tramp-open-connection-rsh)
386 (tramp-rsh-program "ssh")
387 (tramp-rcp-program nil)
388 (tramp-remote-sh "/bin/sh")
389 (tramp-rsh-args ("-e" "none"))
390 (tramp-rcp-args nil)
391 (tramp-rcp-keep-date-arg nil)
392 (tramp-su-program nil)
393 (tramp-su-args nil)
394 (tramp-encoding-command "mimencode -b")
395 (tramp-decoding-command "mimencode -u -b")
396 (tramp-encoding-function base64-encode-region)
397 (tramp-decoding-function base64-decode-region)
398 (tramp-telnet-program nil)
399 (tramp-telnet-args nil))
400 ("smp" (tramp-connection-function tramp-open-connection-rsh)
401 (tramp-rsh-program "ssh")
402 (tramp-rcp-program nil)
403 (tramp-remote-sh "/bin/sh")
404 (tramp-rsh-args ("-e" "none"))
405 (tramp-rcp-args nil)
406 (tramp-rcp-keep-date-arg nil)
407 (tramp-su-program nil)
408 (tramp-su-args nil)
409 (tramp-encoding-command "tramp_mimencode")
410 (tramp-decoding-command "tramp_mimedecode")
411 (tramp-encoding-function base64-encode-region)
412 (tramp-decoding-function base64-decode-region)
413 (tramp-telnet-program nil))
414 ("sm1" (tramp-connection-function tramp-open-connection-rsh)
415 (tramp-rsh-program "ssh")
416 (tramp-rcp-program nil)
417 (tramp-remote-sh "/bin/sh")
418 (tramp-rsh-args ("-1" "-e" "none"))
419 (tramp-rcp-args ("-1"))
420 (tramp-rcp-keep-date-arg nil)
421 (tramp-su-program nil)
422 (tramp-su-args nil)
423 (tramp-encoding-command "mimencode -b")
424 (tramp-decoding-command "mimencode -u -b")
425 (tramp-encoding-function base64-encode-region)
426 (tramp-decoding-function base64-decode-region)
427 (tramp-telnet-program nil)
428 (tramp-telnet-args nil))
429 ("sm2" (tramp-connection-function tramp-open-connection-rsh)
430 (tramp-rsh-program "ssh")
431 (tramp-rcp-program nil)
432 (tramp-remote-sh "/bin/sh")
433 (tramp-rsh-args ("-2" "-e" "none"))
434 (tramp-rcp-args ("-2"))
435 (tramp-rcp-keep-date-arg nil)
436 (tramp-su-program nil)
437 (tramp-su-args nil)
438 (tramp-encoding-command "mimencode -b")
439 (tramp-decoding-command "mimencode -u -b")
440 (tramp-encoding-function base64-encode-region)
441 (tramp-decoding-function base64-decode-region)
442 (tramp-telnet-program nil) 315 (tramp-telnet-program nil)
443 (tramp-telnet-args nil)) 316 (tramp-telnet-args nil))
444 ("sm-ssh1" (tramp-connection-function tramp-open-connection-rsh) 317 ("ssh1-old"
318 (tramp-connection-function tramp-open-connection-rsh)
445 (tramp-rsh-program "ssh1") 319 (tramp-rsh-program "ssh1")
446 (tramp-rcp-program nil) 320 (tramp-rcp-program nil)
447 (tramp-remote-sh "/bin/sh") 321 (tramp-remote-sh "/bin/sh")
@@ -450,13 +324,10 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
450 (tramp-rcp-keep-date-arg nil) 324 (tramp-rcp-keep-date-arg nil)
451 (tramp-su-program nil) 325 (tramp-su-program nil)
452 (tramp-su-args nil) 326 (tramp-su-args nil)
453 (tramp-encoding-command "mimencode -b")
454 (tramp-decoding-command "mimencode -u -b")
455 (tramp-encoding-function base64-encode-region)
456 (tramp-decoding-function base64-decode-region)
457 (tramp-telnet-program nil) 327 (tramp-telnet-program nil)
458 (tramp-telnet-args nil)) 328 (tramp-telnet-args nil))
459 ("sm-ssh2" (tramp-connection-function tramp-open-connection-rsh) 329 ("ssh2-old"
330 (tramp-connection-function tramp-open-connection-rsh)
460 (tramp-rsh-program "ssh2") 331 (tramp-rsh-program "ssh2")
461 (tramp-rcp-program nil) 332 (tramp-rcp-program nil)
462 (tramp-remote-sh "/bin/sh") 333 (tramp-remote-sh "/bin/sh")
@@ -465,13 +336,10 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
465 (tramp-rcp-keep-date-arg nil) 336 (tramp-rcp-keep-date-arg nil)
466 (tramp-su-program nil) 337 (tramp-su-program nil)
467 (tramp-su-args nil) 338 (tramp-su-args nil)
468 (tramp-encoding-command "mimencode -b")
469 (tramp-decoding-command "mimencode -u -b")
470 (tramp-encoding-function base64-encode-region)
471 (tramp-decoding-function base64-decode-region)
472 (tramp-telnet-program nil) 339 (tramp-telnet-program nil)
473 (tramp-telnet-args nil)) 340 (tramp-telnet-args nil))
474 ("tm" (tramp-connection-function tramp-open-connection-telnet) 341 ("telnet"
342 (tramp-connection-function tramp-open-connection-telnet)
475 (tramp-rsh-program nil) 343 (tramp-rsh-program nil)
476 (tramp-rcp-program nil) 344 (tramp-rcp-program nil)
477 (tramp-remote-sh "/bin/sh") 345 (tramp-remote-sh "/bin/sh")
@@ -480,44 +348,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
480 (tramp-rcp-keep-date-arg nil) 348 (tramp-rcp-keep-date-arg nil)
481 (tramp-su-program nil) 349 (tramp-su-program nil)
482 (tramp-su-args nil) 350 (tramp-su-args nil)
483 (tramp-encoding-command "mimencode -b")
484 (tramp-decoding-command "mimencode -u -b")
485 (tramp-encoding-function base64-encode-region)
486 (tramp-decoding-function base64-decode-region)
487 (tramp-telnet-program "telnet") 351 (tramp-telnet-program "telnet")
488 (tramp-telnet-args nil)) 352 (tramp-telnet-args nil))
489 ("tu" (tramp-connection-function tramp-open-connection-telnet) 353 ("su" (tramp-connection-function tramp-open-connection-su)
490 (tramp-rsh-program nil)
491 (tramp-rcp-program nil)
492 (tramp-remote-sh "/bin/sh")
493 (tramp-rsh-args nil)
494 (tramp-rcp-args nil)
495 (tramp-rcp-keep-date-arg nil)
496 (tramp-su-program nil)
497 (tramp-su-args nil)
498 (tramp-encoding-command "uuencode xxx")
499 (tramp-decoding-command
500 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
501 (tramp-encoding-function nil)
502 (tramp-decoding-function uudecode-decode-region)
503 (tramp-telnet-program "telnet")
504 (tramp-telnet-args nil))
505 ("sum" (tramp-connection-function tramp-open-connection-su)
506 (tramp-rsh-program nil)
507 (tramp-rcp-program nil)
508 (tramp-remote-sh "/bin/sh")
509 (tramp-rsh-args nil)
510 (tramp-rcp-args nil)
511 (tramp-rcp-keep-date-arg nil)
512 (tramp-su-program "su")
513 (tramp-su-args ("-" "%u"))
514 (tramp-encoding-command "mimencode -b")
515 (tramp-decoding-command "mimencode -u -b")
516 (tramp-encoding-function base64-encode-region)
517 (tramp-decoding-function base64-decode-region)
518 (tramp-telnet-program nil)
519 (tramp-telnet-args nil))
520 ("suu" (tramp-connection-function tramp-open-connection-su)
521 (tramp-rsh-program nil) 354 (tramp-rsh-program nil)
522 (tramp-rcp-program nil) 355 (tramp-rcp-program nil)
523 (tramp-remote-sh "/bin/sh") 356 (tramp-remote-sh "/bin/sh")
@@ -526,29 +359,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
526 (tramp-rcp-keep-date-arg nil) 359 (tramp-rcp-keep-date-arg nil)
527 (tramp-su-program "su") 360 (tramp-su-program "su")
528 (tramp-su-args ("-" "%u")) 361 (tramp-su-args ("-" "%u"))
529 (tramp-encoding-command "uuencode xxx")
530 (tramp-decoding-command
531 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
532 (tramp-encoding-function nil)
533 (tramp-decoding-function uudecode-decode-region)
534 (tramp-telnet-program nil)
535 (tramp-telnet-args nil))
536 ("sudm" (tramp-connection-function tramp-open-connection-su)
537 (tramp-rsh-program nil)
538 (tramp-rcp-program nil)
539 (tramp-remote-sh "/bin/sh")
540 (tramp-rsh-args nil)
541 (tramp-rcp-args nil)
542 (tramp-rcp-keep-date-arg nil)
543 (tramp-su-program "sudo")
544 (tramp-su-args ("-u" "%u" "-s"))
545 (tramp-encoding-command "mimencode -b")
546 (tramp-decoding-command "mimencode -u -b")
547 (tramp-encoding-function base64-encode-region)
548 (tramp-decoding-function base64-decode-region)
549 (tramp-telnet-program nil) 362 (tramp-telnet-program nil)
550 (tramp-telnet-args nil)) 363 (tramp-telnet-args nil))
551 ("sudu" (tramp-connection-function tramp-open-connection-su) 364 ("sudo" (tramp-connection-function tramp-open-connection-su)
552 (tramp-rsh-program nil) 365 (tramp-rsh-program nil)
553 (tramp-rcp-program nil) 366 (tramp-rcp-program nil)
554 (tramp-remote-sh "/bin/sh") 367 (tramp-remote-sh "/bin/sh")
@@ -557,11 +370,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
557 (tramp-rcp-keep-date-arg nil) 370 (tramp-rcp-keep-date-arg nil)
558 (tramp-su-program "sudo") 371 (tramp-su-program "sudo")
559 (tramp-su-args ("-u" "%u" "-s")) 372 (tramp-su-args ("-u" "%u" "-s"))
560 (tramp-encoding-command "uuencode xxx")
561 (tramp-decoding-command
562 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
563 (tramp-encoding-function nil)
564 (tramp-decoding-function uudecode-decode-region)
565 (tramp-telnet-program nil) 373 (tramp-telnet-program nil)
566 (tramp-telnet-args nil)) 374 (tramp-telnet-args nil))
567 ("multi" (tramp-connection-function tramp-open-connection-multi) 375 ("multi" (tramp-connection-function tramp-open-connection-multi)
@@ -573,26 +381,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
573 (tramp-rcp-keep-date-arg nil) 381 (tramp-rcp-keep-date-arg nil)
574 (tramp-su-program nil) 382 (tramp-su-program nil)
575 (tramp-su-args nil) 383 (tramp-su-args nil)
576 (tramp-encoding-command "mimencode -b")
577 (tramp-decoding-command "mimencode -u -b")
578 (tramp-encoding-function base64-encode-region)
579 (tramp-decoding-function base64-decode-region)
580 (tramp-telnet-program nil)
581 (tramp-telnet-args nil))
582 ("multiu" (tramp-connection-function tramp-open-connection-multi)
583 (tramp-rsh-program nil)
584 (tramp-rcp-program nil)
585 (tramp-remote-sh "/bin/sh")
586 (tramp-rsh-args nil)
587 (tramp-rcp-args nil)
588 (tramp-rcp-keep-date-arg nil)
589 (tramp-su-program nil)
590 (tramp-su-args nil)
591 (tramp-encoding-command "uuencode xxx")
592 (tramp-decoding-command
593 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
594 (tramp-encoding-function nil)
595 (tramp-decoding-function uudecode-decode-region)
596 (tramp-telnet-program nil) 384 (tramp-telnet-program nil)
597 (tramp-telnet-args nil)) 385 (tramp-telnet-args nil))
598 ("scpx" (tramp-connection-function tramp-open-connection-rsh) 386 ("scpx" (tramp-connection-function tramp-open-connection-rsh)
@@ -602,13 +390,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
602 (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) 390 (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh"))
603 (tramp-rcp-args nil) 391 (tramp-rcp-args nil)
604 (tramp-rcp-keep-date-arg "-p") 392 (tramp-rcp-keep-date-arg "-p")
605 (tramp-encoding-command nil)
606 (tramp-decoding-command nil)
607 (tramp-encoding-function nil)
608 (tramp-decoding-function nil)
609 (tramp-telnet-program nil) 393 (tramp-telnet-program nil)
610 (tramp-telnet-args nil)) 394 (tramp-telnet-args nil))
611 ("smx" (tramp-connection-function tramp-open-connection-rsh) 395 ("sshx" (tramp-connection-function tramp-open-connection-rsh)
612 (tramp-rsh-program "ssh") 396 (tramp-rsh-program "ssh")
613 (tramp-rcp-program nil) 397 (tramp-rcp-program nil)
614 (tramp-remote-sh "/bin/sh") 398 (tramp-remote-sh "/bin/sh")
@@ -617,13 +401,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
617 (tramp-rcp-keep-date-arg nil) 401 (tramp-rcp-keep-date-arg nil)
618 (tramp-su-program nil) 402 (tramp-su-program nil)
619 (tramp-su-args nil) 403 (tramp-su-args nil)
620 (tramp-encoding-command "mimencode -b")
621 (tramp-decoding-command "mimencode -u -b")
622 (tramp-encoding-function base64-encode-region)
623 (tramp-decoding-function base64-decode-region)
624 (tramp-telnet-program nil) 404 (tramp-telnet-program nil)
625 (tramp-telnet-args nil)) 405 (tramp-telnet-args nil))
626 ("km" 406 ("krlogin"
627 (tramp-connection-function tramp-open-connection-rsh) 407 (tramp-connection-function tramp-open-connection-rsh)
628 (tramp-rsh-program "krlogin") 408 (tramp-rsh-program "krlogin")
629 (tramp-rcp-program nil) 409 (tramp-rcp-program nil)
@@ -633,13 +413,9 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
633 (tramp-rcp-keep-date-arg nil) 413 (tramp-rcp-keep-date-arg nil)
634 (tramp-su-program nil) 414 (tramp-su-program nil)
635 (tramp-su-args nil) 415 (tramp-su-args nil)
636 (tramp-encoding-command "mimencode -b")
637 (tramp-decoding-command "mimencode -u -b")
638 (tramp-encoding-function base64-encode-region)
639 (tramp-decoding-function base64-decode-region)
640 (tramp-telnet-program nil) 416 (tramp-telnet-program nil)
641 (tramp-telnet-args nil)) 417 (tramp-telnet-args nil))
642 ("plinku" 418 ("plink"
643 (tramp-connection-function tramp-open-connection-rsh) 419 (tramp-connection-function tramp-open-connection-rsh)
644 (tramp-rsh-program "plink") 420 (tramp-rsh-program "plink")
645 (tramp-rcp-program nil) 421 (tramp-rcp-program nil)
@@ -649,27 +425,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
649 (tramp-rcp-keep-date-arg nil) 425 (tramp-rcp-keep-date-arg nil)
650 (tramp-su-program nil) 426 (tramp-su-program nil)
651 (tramp-su-args nil) 427 (tramp-su-args nil)
652 (tramp-encoding-command "uuencode xxx")
653 (tramp-decoding-command
654 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
655 (tramp-encoding-function nil)
656 (tramp-decoding-function uudecode-decode-region)
657 (tramp-telnet-program nil)
658 (tramp-telnet-args nil))
659 ("plinkm"
660 (tramp-connection-function tramp-open-connection-rsh)
661 (tramp-rsh-program "plink")
662 (tramp-rcp-program nil)
663 (tramp-remote-sh "/bin/sh")
664 (tramp-rsh-args ("-ssh")) ;optionally add "-v"
665 (tramp-rcp-args nil)
666 (tramp-rcp-keep-date-arg nil)
667 (tramp-su-program nil)
668 (tramp-su-args nil)
669 (tramp-encoding-command "mimencode -b")
670 (tramp-decoding-command "mimencode -u -b")
671 (tramp-encoding-function base64-encode-region)
672 (tramp-decoding-function base64-decode-region)
673 (tramp-telnet-program nil) 428 (tramp-telnet-program nil)
674 (tramp-telnet-args nil)) 429 (tramp-telnet-args nil))
675 ("pscp" 430 ("pscp"
@@ -682,10 +437,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
682 (tramp-rcp-keep-date-arg "-p") 437 (tramp-rcp-keep-date-arg "-p")
683 (tramp-su-program nil) 438 (tramp-su-program nil)
684 (tramp-su-args nil) 439 (tramp-su-args nil)
685 (tramp-encoding-command nil)
686 (tramp-decoding-command nil)
687 (tramp-encoding-function nil)
688 (tramp-decoding-function nil)
689 (tramp-telnet-program nil) 440 (tramp-telnet-program nil)
690 (tramp-telnet-args nil)) 441 (tramp-telnet-args nil))
691 ("fcp" 442 ("fcp"
@@ -698,10 +449,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of
698 (tramp-rcp-keep-date-arg "-p") 449 (tramp-rcp-keep-date-arg "-p")
699 (tramp-su-program nil) 450 (tramp-su-program nil)
700 (tramp-su-args nil) 451 (tramp-su-args nil)
701 (tramp-encoding-command nil)
702 (tramp-decoding-command nil)
703 (tramp-encoding-function nil)
704 (tramp-decoding-function nil)
705 (tramp-telnet-program nil) 452 (tramp-telnet-program nil)
706 (tramp-telnet-args nil)) 453 (tramp-telnet-args nil))
707 ) 454 )
@@ -944,16 +691,16 @@ tilde expansion, all directory names starting with `~' will be ignored."
944 :type '(repeat string)) 691 :type '(repeat string))
945 692
946(defcustom tramp-login-prompt-regexp 693(defcustom tramp-login-prompt-regexp
947 ".*ogin: *$" 694 ".*ogin: *"
948 "*Regexp matching login-like prompts. 695 "*Regexp matching login-like prompts.
949The regexp should match the whole line." 696The regexp should match at end of buffer."
950 :group 'tramp 697 :group 'tramp
951 :type 'regexp) 698 :type 'regexp)
952 699
953(defcustom tramp-password-prompt-regexp 700(defcustom tramp-password-prompt-regexp
954 "^.*\\([pP]assword\\|passphrase.*\\):\^@? *$" 701 "^.*\\([pP]assword\\|passphrase.*\\):\^@? *"
955 "*Regexp matching password-like prompts. 702 "*Regexp matching password-like prompts.
956The regexp should match the whole line. 703The regexp should match at end of buffer.
957 704
958The `sudo' program appears to insert a `^@' character into the prompt." 705The `sudo' program appears to insert a `^@' character into the prompt."
959 :group 'tramp 706 :group 'tramp
@@ -962,9 +709,17 @@ The `sudo' program appears to insert a `^@' character into the prompt."
962(defcustom tramp-wrong-passwd-regexp 709(defcustom tramp-wrong-passwd-regexp
963 (concat "^.*\\(Permission denied.\\|Login [Ii]ncorrect\\|" 710 (concat "^.*\\(Permission denied.\\|Login [Ii]ncorrect\\|"
964 "Received signal [0-9]+\\|Connection \\(refused\\|closed\\)\\|" 711 "Received signal [0-9]+\\|Connection \\(refused\\|closed\\)\\|"
965 "Sorry, try again.\\|Name or service not known\\).*$") 712 "Sorry, try again.\\|Name or service not known\\).*")
966 "*Regexp matching a `login failed' message. 713 "*Regexp matching a `login failed' message.
967The regexp should match the whole line." 714The regexp should match at end of buffer."
715 :group 'tramp
716 :type 'regexp)
717
718(defcustom tramp-yesno-prompt-regexp
719 "Are you sure you want to continue connecting (yes/no)\\? *"
720 "Regular expression matching all queries which need to be confirmed.
721The confirmation should be done with yes or no.
722The regexp should match at end of buffer."
968 :group 'tramp 723 :group 'tramp
969 :type 'regexp) 724 :type 'regexp)
970 725
@@ -999,7 +754,7 @@ shell from reading its init file."
999;; File name format. 754;; File name format.
1000 755
1001(defconst tramp-file-name-structure-unified 756(defconst tramp-file-name-structure-unified
1002 (list (concat "\\`/\\(\\([a-zA-Z0-9]+\\):\\)?" ;method 757 (list (concat "\\`/\\(\\([a-zA-Z0-9-]+\\):\\)?" ;method
1003 "\\(\\([^:@/]+\\)@\\)?" ;user 758 "\\(\\([^:@/]+\\)@\\)?" ;user
1004 "\\([^:/]+\\):" ;host 759 "\\([^:/]+\\):" ;host
1005 "\\(.*\\)\\'") ;path 760 "\\(.*\\)\\'") ;path
@@ -1009,7 +764,7 @@ On Emacs (not XEmacs), the Tramp and Ange-FTP packages use a unified
1009filename space. This value is used for this unified namespace.") 764filename space. This value is used for this unified namespace.")
1010 765
1011(defconst tramp-file-name-structure-separate 766(defconst tramp-file-name-structure-separate
1012 (list (concat "\\`/\\[\\(\\([a-zA-Z0-9]+\\)/\\)?" ;method 767 (list (concat "\\`/\\[\\(\\([a-zA-Z0-9-]+\\)/\\)?" ;method
1013 "\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user 768 "\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user
1014 "\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host 769 "\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host
1015 "\\(.*\\)\\'") ;path 770 "\\(.*\\)\\'") ;path
@@ -1282,6 +1037,37 @@ but it might be slow on large directories."
1282 :group 'tramp 1037 :group 'tramp
1283 :type 'boolean) 1038 :type 'boolean)
1284 1039
1040(defcustom tramp-actions-before-shell
1041 '((tramp-password-prompt-regexp tramp-action-password)
1042 (tramp-login-prompt-regexp tramp-action-login)
1043 (shell-prompt-pattern tramp-action-succeed)
1044 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
1045 (tramp-yesno-prompt-regexp tramp-action-yesno))
1046 "List of pattern/action pairs.
1047Whenever a pattern matches, the corresponding action is performed.
1048Each item looks like (PATTERN ACTION).
1049
1050The PATTERN should be a symbol, a variable. The value of this
1051variable gives the regular expression to search for. Note that the
1052regexp must match at the end of the buffer, \"\\'\" is implicitly
1053appended to it.
1054
1055The ACTION should also be a symbol, but a function. When the
1056corresponding PATTERN matches, the ACTION function is called."
1057 :group 'tramp
1058 :type '(repeat (list variable function)))
1059
1060(defcustom tramp-multi-actions
1061 '((tramp-password-prompt-regexp tramp-multi-action-password)
1062 (tramp-login-prompt-regexp tramp-multi-action-login)
1063 (shell-prompt-pattern tramp-multi-action-succeed)
1064 (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied))
1065 "List of pattern/action pairs.
1066This list is used for each hop in multi-hop connections.
1067See `tramp-actions-before-shell' for more info."
1068 :group 'tramp
1069 :type '(repeat (list variable function)))
1070
1285;;; Internal Variables: 1071;;; Internal Variables:
1286 1072
1287(defvar tramp-buffer-file-attributes nil 1073(defvar tramp-buffer-file-attributes nil
@@ -1413,51 +1199,36 @@ $s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff, $s[0] >> 16 & 0xffff, $s[0]
1413 "Perl script to produce output suitable for use with `file-attributes' 1199 "Perl script to produce output suitable for use with `file-attributes'
1414on the remote file system.") 1200on the remote file system.")
1415 1201
1416;; Perl script to implement `mime-encode' 1202;; ;; These two use uu encoding.
1417(defvar tramp-perl-mime-encode (concat 1203;; (defvar tramp-perl-encode "%s -e'\
1418 "sub encode_base64 ($); 1204;; print qq(begin 644 xxx\n);
1419 my $buf; 1205;; my $s = q();
1420 while(read(STDIN, $buf, 60*57)) { print encode_base64($buf) } 1206;; my $res = q();
1421 sub encode_base64 ($) { 1207;; while (read(STDIN, $s, 45)) {
1422 my $res = \"\"; 1208;; print pack(q(u), $s);
1423 my $eol = \"\n\"; 1209;; }
1424 pos($_[0]) = 0; # ensure start at the beginning 1210;; print qq(`\n);
1425 while ($_[0] =~ /(.{1,45})/gs) { 1211;; print qq(end\n);
1426 $res .= substr(pack(\"u\", $1), 1); 1212;; '"
1427 chop($res); 1213;; "Perl program to use for encoding a file.
1428 } 1214;; Escape sequence %s is replaced with name of Perl binary.")
1429 $res =~ tr|` -_|AA-Za-z0-9+/|; # `# help emacs 1215
1430 # fix padding at the end 1216;; (defvar tramp-perl-decode "%s -ne '
1431 my $padding = (3 - length($_[0]) % 3) % 3; 1217;; print unpack q(u), $_;
1432 $res =~ s/.{$padding}$/\"=\" x $padding/e if $padding; 1218;; '"
1433 # break encoded string into lines of no more than 76 characters each 1219;; "Perl program to use for decoding a file.
1434 if (length $eol) { 1220;; Escape sequence %s is replaced with name of Perl binary.")
1435 $res =~ s/(.{1,76})/$1$eol/g; 1221
1436 } 1222;; These two use base64 encoding.
1437 $res;}")) 1223(defvar tramp-perl-encode
1438 1224 "perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)'"
1439;; Perl script to implement `mime-decode' 1225 "Perl program to use for encoding a file.
1440(defvar tramp-perl-mime-decode (concat 1226Escape sequence %s is replaced with name of Perl binary.")
1441 "sub decode_base64 ($); 1227
1442 my $buf; 1228(defvar tramp-perl-decode
1443 while(read(STDIN, $buf, 60*57)) { print decode_base64($buf) } 1229 "perl -MMIME::Base64 -0777 -ne 'print decode_base64($_)'"
1444 sub decode_base64 ($) { 1230 "Perl program to use for decoding a file.
1445 local($^W) = 0; # unpack(\"u\",...) gives bogus warning in 5.00[123] 1231Escape sequence %s is replaced with name of Perl binary.")
1446
1447 my $str = shift;
1448 my $res = \"\";
1449
1450 $str =~ tr|A-Za-z0-9+=/||cd; # remove non-base64 chars
1451 if (length($str) % 4) {
1452 warn(\"Length of base64 data not a multiple of 4\")
1453 }
1454 $str =~ s/=+$//; # remove padding
1455 $str =~ tr|A-Za-z0-9+/| -_|; # convert to uuencoded format
1456 while ($str =~ /(.{1,60})/gs) {
1457 my $len = chr(32 + length($1)*3/4); # compute length byte
1458 $res .= unpack(\"u\", $len . $1 ); # uudecode
1459 }
1460 $res;}"))
1461 1232
1462; These values conform to `file-attributes' from XEmacs 21.2. 1233; These values conform to `file-attributes' from XEmacs 21.2.
1463; GNU Emacs and other tools not checked. 1234; GNU Emacs and other tools not checked.
@@ -1486,6 +1257,10 @@ This is used to map a mode number to a permission string.")
1486 'undecided-dos) 1257 'undecided-dos)
1487 "Some Emacsen know the `dos' coding system, others need `undecided-dos'.") 1258 "Some Emacsen know the `dos' coding system, others need `undecided-dos'.")
1488 1259
1260(defvar tramp-last-cmd-time nil
1261 "Internal Tramp variable recording the time when the last cmd was sent.
1262This variable is buffer-local in every buffer.")
1263(make-variable-buffer-local 'tramp-last-cmd-time)
1489 1264
1490;; New handlers should be added here. The following operations can be 1265;; New handlers should be added here. The following operations can be
1491;; handled using the normal primitives: file-name-as-directory, 1266;; handled using the normal primitives: file-name-as-directory,
@@ -1537,13 +1312,6 @@ This is used to map a mode number to a permission string.")
1537 "Alist of handler functions. 1312 "Alist of handler functions.
1538Operations not mentioned here will be handled by the normal Emacs functions.") 1313Operations not mentioned here will be handled by the normal Emacs functions.")
1539 1314
1540;;; For better error reporting.
1541
1542(defun tramp-version (arg)
1543 "Print version number of tramp.el in minibuffer or current buffer."
1544 (interactive "P")
1545 (if arg (insert tramp-version) (message tramp-version)))
1546
1547;;; Internal functions which must come first. 1315;;; Internal functions which must come first.
1548 1316
1549(defsubst tramp-message (level fmt-string &rest args) 1317(defsubst tramp-message (level fmt-string &rest args)
@@ -1833,18 +1601,21 @@ target of the symlink differ."
1833 "Like `file-attributes' for tramp files. 1601 "Like `file-attributes' for tramp files.
1834Optional argument NONNUMERIC means return user and group name 1602Optional argument NONNUMERIC means return user and group name
1835rather than as numbers." 1603rather than as numbers."
1836 (if (tramp-handle-file-exists-p filename) 1604 (let (result)
1837 ;; file exists, find out stuff 1605 (with-parsed-tramp-file-name filename nil
1838 (save-excursion 1606 (when (tramp-ange-ftp-file-name-p multi-method method)
1839 (with-parsed-tramp-file-name filename nil 1607 (tramp-invoke-ange-ftp 'file-attributes filename))
1840 (when (tramp-ange-ftp-file-name-p multi-method method) 1608 (when (tramp-handle-file-exists-p filename)
1841 (tramp-invoke-ange-ftp 'file-attributes file)) 1609 ;; file exists, find out stuff
1610 (save-excursion
1842 (if (tramp-get-remote-perl multi-method method user host) 1611 (if (tramp-get-remote-perl multi-method method user host)
1843 (tramp-handle-file-attributes-with-perl 1612 (setq result
1844 multi-method method user host path nonnumeric) 1613 (tramp-handle-file-attributes-with-perl
1845 (tramp-handle-file-attributes-with-ls 1614 multi-method method user host path nonnumeric))
1846 multi-method method user host path nonnumeric)))) 1615 (setq result
1847 nil)) ; no file 1616 (tramp-handle-file-attributes-with-ls
1617 multi-method method user host path nonnumeric))))))
1618 result))
1848 1619
1849 1620
1850(defun tramp-handle-file-attributes-with-ls 1621(defun tramp-handle-file-attributes-with-ls
@@ -1853,6 +1624,10 @@ rather than as numbers."
1853 (let (symlinkp dirp 1624 (let (symlinkp dirp
1854 res-inode res-filemodes res-numlinks 1625 res-inode res-filemodes res-numlinks
1855 res-uid res-gid res-size res-symlink-target) 1626 res-uid res-gid res-size res-symlink-target)
1627 (tramp-message-for-buffer multi-method method user host 10
1628 "file attributes with ls: %s"
1629 (tramp-make-tramp-file-name
1630 multi-method method user host path))
1856 (tramp-send-command 1631 (tramp-send-command
1857 multi-method method user host 1632 multi-method method user host
1858 (format "%s %s %s" 1633 (format "%s %s %s"
@@ -1934,6 +1709,10 @@ rather than as numbers."
1934 1709
1935The Perl command is sent to the remote machine when the connection 1710The Perl command is sent to the remote machine when the connection
1936is initially created and is kept cached by the remote shell." 1711is initially created and is kept cached by the remote shell."
1712 (tramp-message-for-buffer multi-method method user host 10
1713 "file attributes with perl: %s"
1714 (tramp-make-tramp-file-name
1715 multi-method method user host path))
1937 (tramp-send-command 1716 (tramp-send-command
1938 multi-method method user host 1717 multi-method method user host
1939 (format "tramp_file_attributes %s" 1718 (format "tramp_file_attributes %s"
@@ -2204,12 +1983,13 @@ if the remote host can't provide the modtime."
2204 1983
2205;; Directory listings. 1984;; Directory listings.
2206 1985
2207(defun tramp-handle-directory-files (directory &optional full match nosort) 1986(defun tramp-handle-directory-files (directory
1987 &optional full match nosort files-only)
2208 "Like `directory-files' for tramp files." 1988 "Like `directory-files' for tramp files."
2209 (with-parsed-tramp-file-name directory nil 1989 (with-parsed-tramp-file-name directory nil
2210 (when (tramp-ange-ftp-file-name-p multi-method method) 1990 (when (tramp-ange-ftp-file-name-p multi-method method)
2211 (tramp-invoke-ange-ftp 'directory-files 1991 (tramp-invoke-ange-ftp 'directory-files
2212 directory full match nosort)) 1992 directory full match nosort files-only))
2213 (let (result x) 1993 (let (result x)
2214 (save-excursion 1994 (save-excursion
2215 (tramp-barf-unless-okay 1995 (tramp-barf-unless-okay
@@ -2235,7 +2015,26 @@ if the remote host can't provide the modtime."
2235 result) 2015 result)
2236 (push x result)))) 2016 (push x result))))
2237 (tramp-send-command multi-method method user host "cd") 2017 (tramp-send-command multi-method method user host "cd")
2238 (tramp-wait-for-output)) 2018 (tramp-wait-for-output)
2019 ;; Remove non-files or non-directories if necessary. Using
2020 ;; the remote shell for this would probably be way faster.
2021 ;; Maybe something could be adapted from
2022 ;; tramp-handle-file-name-all-completions.
2023 (when files-only
2024 (let ((temp (nreverse result))
2025 item)
2026 (setq result nil)
2027 (if (equal files-only t)
2028 ;; files only
2029 (while temp
2030 (setq item (pop temp))
2031 (when (file-regular-p item)
2032 (push item result)))
2033 ;; directories only
2034 (while temp
2035 (setq item (pop temp))
2036 (when (file-directory-p item)
2037 (push item result)))))))
2239 result))) 2038 result)))
2240 2039
2241;; This function should return "foo/" for directories and "bar" for 2040;; This function should return "foo/" for directories and "bar" for
@@ -2494,6 +2293,7 @@ If KEEP-DATE is non-nil, preserve the time stamp when copying."
2494;; mkdir 2293;; mkdir
2495(defun tramp-handle-make-directory (dir &optional parents) 2294(defun tramp-handle-make-directory (dir &optional parents)
2496 "Like `make-directory' for tramp files." 2295 "Like `make-directory' for tramp files."
2296 (setq dir (expand-file-name dir))
2497 (with-parsed-tramp-file-name dir nil 2297 (with-parsed-tramp-file-name dir nil
2498 (when (tramp-ange-ftp-file-name-p multi-method method) 2298 (when (tramp-ange-ftp-file-name-p multi-method method)
2499 (tramp-invoke-ange-ftp 'make-directory dir parents)) 2299 (tramp-invoke-ange-ftp 'make-directory dir parents))
@@ -2508,6 +2308,7 @@ If KEEP-DATE is non-nil, preserve the time stamp when copying."
2508;; CCC error checking? 2308;; CCC error checking?
2509(defun tramp-handle-delete-directory (directory) 2309(defun tramp-handle-delete-directory (directory)
2510 "Like `delete-directory' for tramp files." 2310 "Like `delete-directory' for tramp files."
2311 (setq directory (expand-file-name directory))
2511 (with-parsed-tramp-file-name directory nil 2312 (with-parsed-tramp-file-name directory nil
2512 (when (tramp-ange-ftp-file-name-p multi-method method) 2313 (when (tramp-ange-ftp-file-name-p multi-method method)
2513 (tramp-invoke-ange-ftp 'delete-directory directory)) 2314 (tramp-invoke-ange-ftp 'delete-directory directory))
@@ -2520,6 +2321,7 @@ If KEEP-DATE is non-nil, preserve the time stamp when copying."
2520 2321
2521(defun tramp-handle-delete-file (filename) 2322(defun tramp-handle-delete-file (filename)
2522 "Like `delete-file' for tramp files." 2323 "Like `delete-file' for tramp files."
2324 (setq filename (expand-file-name filename))
2523 (with-parsed-tramp-file-name filename nil 2325 (with-parsed-tramp-file-name filename nil
2524 (when (tramp-ange-ftp-file-name-p multi-method method) 2326 (when (tramp-ange-ftp-file-name-p multi-method method)
2525 (tramp-invoke-ange-ftp 'delete-file filename)) 2327 (tramp-invoke-ange-ftp 'delete-file filename))
@@ -2601,6 +2403,7 @@ This is like `dired-recursive-delete-directory' for tramp files."
2601(defun tramp-handle-insert-directory 2403(defun tramp-handle-insert-directory
2602 (filename switches &optional wildcard full-directory-p) 2404 (filename switches &optional wildcard full-directory-p)
2603 "Like `insert-directory' for tramp files." 2405 "Like `insert-directory' for tramp files."
2406 (setq filename (expand-file-name filename))
2604 (with-parsed-tramp-file-name filename nil 2407 (with-parsed-tramp-file-name filename nil
2605 (when (tramp-ange-ftp-file-name-p multi-method method) 2408 (when (tramp-ange-ftp-file-name-p multi-method method)
2606 (tramp-invoke-ange-ftp 'insert-directory 2409 (tramp-invoke-ange-ftp 'insert-directory
@@ -2754,54 +2557,54 @@ Doesn't do anything if the NAME does not start with a drive letter."
2754 "Like `shell-command' for tramp files. 2557 "Like `shell-command' for tramp files.
2755This will break if COMMAND prints a newline, followed by the value of 2558This will break if COMMAND prints a newline, followed by the value of
2756`tramp-end-of-output', followed by another newline." 2559`tramp-end-of-output', followed by another newline."
2757 (if (tramp-tramp-file-p default-directory) 2560 (when (tramp-tramp-file-p default-directory)
2758 (with-parsed-tramp-file-name default-directory nil 2561 (with-parsed-tramp-file-name default-directory nil
2759 (when (tramp-ange-ftp-file-name-p multi-method method) 2562 (when (tramp-ange-ftp-file-name-p multi-method method)
2760 (let ((default-directory (tramp-make-ange-ftp-file-name 2563 (let ((default-directory (tramp-make-ange-ftp-file-name
2761 user host path))) 2564 user host path)))
2762 (tramp-invoke-ange-ftp 'shell-command 2565 (tramp-invoke-ange-ftp 'shell-command
2763 command output-buffer error-buffer))) 2566 command output-buffer error-buffer)))
2764 (let (status) 2567 (let (status)
2765 (when (string-match "&[ \t]*\\'" command) 2568 (when (string-match "&[ \t]*\\'" command)
2766 (error "Tramp doesn't grok asynchronous shell commands, yet")) 2569 (error "Tramp doesn't grok asynchronous shell commands, yet"))
2767 (when error-buffer 2570 (when error-buffer
2768 (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet")) 2571 (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet"))
2769 (save-excursion 2572 (save-excursion
2770 (tramp-barf-unless-okay 2573 (tramp-barf-unless-okay
2771 multi-method method user host 2574 multi-method method user host
2772 (format "cd %s" (tramp-shell-quote-argument path)) 2575 (format "cd %s" (tramp-shell-quote-argument path))
2773 nil 'file-error 2576 nil 'file-error
2774 "tramp-handle-shell-command: Couldn't `cd %s'" 2577 "tramp-handle-shell-command: Couldn't `cd %s'"
2775 (tramp-shell-quote-argument path)) 2578 (tramp-shell-quote-argument path))
2776 (tramp-send-command multi-method method user host 2579 (tramp-send-command multi-method method user host
2777 (concat command "; tramp_old_status=$?")) 2580 (concat command "; tramp_old_status=$?"))
2778 ;; This will break if the shell command prints "/////" 2581 ;; This will break if the shell command prints "/////"
2779 ;; somewhere. Let's just hope for the best... 2582 ;; somewhere. Let's just hope for the best...
2780 (tramp-wait-for-output)) 2583 (tramp-wait-for-output))
2781 (unless output-buffer 2584 (unless output-buffer
2782 (setq output-buffer (get-buffer-create "*Shell Command Output*")) 2585 (setq output-buffer (get-buffer-create "*Shell Command Output*"))
2783 (set-buffer output-buffer)
2784 (erase-buffer))
2785 (unless (bufferp output-buffer)
2786 (setq output-buffer (current-buffer)))
2787 (set-buffer output-buffer) 2586 (set-buffer output-buffer)
2788 (insert-buffer (tramp-get-buffer multi-method method user host)) 2587 (erase-buffer))
2789 (save-excursion 2588 (unless (bufferp output-buffer)
2790 (tramp-send-command multi-method method user host "cd") 2589 (setq output-buffer (current-buffer)))
2791 (tramp-wait-for-output) 2590 (set-buffer output-buffer)
2792 (tramp-send-command 2591 (insert-buffer (tramp-get-buffer multi-method method user host))
2793 multi-method method user host 2592 (save-excursion
2794 (concat "tramp_set_exit_status $tramp_old_status;" 2593 (tramp-send-command multi-method method user host "cd")
2795 " echo tramp_exit_status $?")) 2594 (tramp-wait-for-output)
2796 (tramp-wait-for-output) 2595 (tramp-send-command
2797 (goto-char (point-max)) 2596 multi-method method user host
2798 (unless (search-backward "tramp_exit_status " nil t) 2597 (concat "tramp_set_exit_status $tramp_old_status;"
2799 (error "Couldn't find exit status of `%s'" command)) 2598 " echo tramp_exit_status $?"))
2800 (skip-chars-forward "^ ") 2599 (tramp-wait-for-output)
2801 (setq status (read (current-buffer)))) 2600 (goto-char (point-max))
2802 (unless (zerop (buffer-size)) 2601 (unless (search-backward "tramp_exit_status " nil t)
2803 (pop-to-buffer output-buffer)) 2602 (error "Couldn't find exit status of `%s'" command))
2804 status))) 2603 (skip-chars-forward "^ ")
2604 (setq status (read (current-buffer))))
2605 (unless (zerop (buffer-size))
2606 (pop-to-buffer output-buffer))
2607 status)))
2805 ;; The following is only executed if something strange was 2608 ;; The following is only executed if something strange was
2806 ;; happening. Emit a helpful message and do it anyway. 2609 ;; happening. Emit a helpful message and do it anyway.
2807 (message "tramp-handle-shell-command called with non-tramp directory: `%s'" 2610 (message "tramp-handle-shell-command called with non-tramp directory: `%s'"
@@ -2828,7 +2631,7 @@ This will break if COMMAND prints a newline, followed by the value of
2828 filename)) 2631 filename))
2829 (setq tmpfil (tramp-make-temp-file)) 2632 (setq tmpfil (tramp-make-temp-file))
2830 (cond ((tramp-get-rcp-program multi-method method) 2633 (cond ((tramp-get-rcp-program multi-method method)
2831 ;; Use tramp-like program for file transfer. 2634 ;; Use rcp-like program for file transfer.
2832 (tramp-message-for-buffer 2635 (tramp-message-for-buffer
2833 multi-method method user host 2636 multi-method method user host
2834 5 "Fetching %s to tmp file %s..." filename tmpfil) 2637 5 "Fetching %s to tmp file %s..." filename tmpfil)
@@ -2852,8 +2655,8 @@ This will break if COMMAND prints a newline, followed by the value of
2852 (tramp-message-for-buffer 2655 (tramp-message-for-buffer
2853 multi-method method user host 2656 multi-method method user host
2854 5 "Fetching %s to tmp file %s...done" filename tmpfil)) 2657 5 "Fetching %s to tmp file %s...done" filename tmpfil))
2855 ((and (tramp-get-encoding-command multi-method method) 2658 ((and (tramp-get-encoding-command multi-method method user host)
2856 (tramp-get-decoding-command multi-method method)) 2659 (tramp-get-decoding-command multi-method method user host))
2857 ;; Use inline encoding for file transfer. 2660 ;; Use inline encoding for file transfer.
2858 (save-excursion 2661 (save-excursion
2859 ;; Following line for setting tramp-current-method, 2662 ;; Following line for setting tramp-current-method,
@@ -2862,7 +2665,7 @@ This will break if COMMAND prints a newline, followed by the value of
2862 (tramp-message 5 "Encoding remote file %s..." filename) 2665 (tramp-message 5 "Encoding remote file %s..." filename)
2863 (tramp-barf-unless-okay 2666 (tramp-barf-unless-okay
2864 multi-method method user host 2667 multi-method method user host
2865 (concat (tramp-get-encoding-command multi-method method) 2668 (concat (tramp-get-encoding-command multi-method method user host)
2866 " < " (tramp-shell-quote-argument path)) 2669 " < " (tramp-shell-quote-argument path))
2867 nil 'file-error 2670 nil 'file-error
2868 "Encoding remote file failed, see buffer `%s' for details" 2671 "Encoding remote file failed, see buffer `%s' for details"
@@ -2872,9 +2675,9 @@ This will break if COMMAND prints a newline, followed by the value of
2872 (delete-region (point) (progn (forward-line -1) (point))) 2675 (delete-region (point) (progn (forward-line -1) (point)))
2873 2676
2874 (tramp-message 5 "Decoding remote file %s..." filename) 2677 (tramp-message 5 "Decoding remote file %s..." filename)
2875 (if (and (tramp-get-decoding-function multi-method method) 2678 (if (and (tramp-get-decoding-function multi-method method user host)
2876 (fboundp (tramp-get-decoding-function 2679 (fboundp (tramp-get-decoding-function
2877 multi-method method))) 2680 multi-method method user host)))
2878 ;; If tramp-decoding-function is defined for this 2681 ;; If tramp-decoding-function is defined for this
2879 ;; method, we call it. 2682 ;; method, we call it.
2880 (let ((tmpbuf (get-buffer-create " *tramp tmp*"))) 2683 (let ((tmpbuf (get-buffer-create " *tramp tmp*")))
@@ -2886,11 +2689,11 @@ This will break if COMMAND prints a newline, followed by the value of
2886 multi-method method user host 2689 multi-method method user host
2887 6 "Decoding remote file %s with function %s..." 2690 6 "Decoding remote file %s with function %s..."
2888 filename 2691 filename
2889 (tramp-get-decoding-function multi-method method)) 2692 (tramp-get-decoding-function multi-method method user host))
2890 (set-buffer tmpbuf) 2693 (set-buffer tmpbuf)
2891 (let ((coding-system-for-write 'no-conversion)) 2694 (let ((coding-system-for-write 'no-conversion))
2892 (funcall (tramp-get-decoding-function 2695 (funcall (tramp-get-decoding-function
2893 multi-method method) 2696 multi-method method user host)
2894 (point-min) 2697 (point-min)
2895 (point-max)) 2698 (point-max))
2896 (write-region (point-min) (point-max) tmpfil)) 2699 (write-region (point-min) (point-max) tmpfil))
@@ -2902,14 +2705,14 @@ This will break if COMMAND prints a newline, followed by the value of
2902 (tramp-message 2705 (tramp-message
2903 6 "Decoding remote file %s with command %s..." 2706 6 "Decoding remote file %s with command %s..."
2904 filename 2707 filename
2905 (tramp-get-decoding-command multi-method method)) 2708 (tramp-get-decoding-command multi-method method user host))
2906 (call-process 2709 (call-process
2907 tramp-sh-program 2710 tramp-sh-program
2908 tmpfil2 ;input 2711 tmpfil2 ;input
2909 nil ;output 2712 nil ;output
2910 nil ;display 2713 nil ;display
2911 "-c" (concat (tramp-get-decoding-command 2714 "-c" (concat (tramp-get-decoding-command
2912 multi-method method) 2715 multi-method method user host)
2913 " > " tmpfil)) 2716 " > " tmpfil))
2914 (delete-file tmpfil2))) 2717 (delete-file tmpfil2)))
2915 (tramp-message-for-buffer 2718 (tramp-message-for-buffer
@@ -2990,10 +2793,12 @@ This will break if COMMAND prints a newline, followed by the value of
2990 (let ((curbuf (current-buffer)) 2793 (let ((curbuf (current-buffer))
2991 (rcp-program (tramp-get-rcp-program multi-method method)) 2794 (rcp-program (tramp-get-rcp-program multi-method method))
2992 (rcp-args (tramp-get-rcp-args multi-method method)) 2795 (rcp-args (tramp-get-rcp-args multi-method method))
2993 (encoding-command (tramp-get-encoding-command multi-method method)) 2796 (encoding-command
2797 (tramp-get-encoding-command multi-method method user host))
2994 (encoding-function 2798 (encoding-function
2995 (tramp-get-encoding-function multi-method method)) 2799 (tramp-get-encoding-function multi-method method user host))
2996 (decoding-command (tramp-get-decoding-command multi-method method)) 2800 (decoding-command
2801 (tramp-get-decoding-command multi-method method user host))
2997 (trampbuf (get-buffer-create "*tramp output*")) 2802 (trampbuf (get-buffer-create "*tramp output*"))
2998 ;; We use this to save the value of `last-coding-system-used' 2803 ;; We use this to save the value of `last-coding-system-used'
2999 ;; after writing the tmp file. At the end of the function, 2804 ;; after writing the tmp file. At the end of the function,
@@ -3253,6 +3058,7 @@ necessary anymore."
3253 3058
3254(defun tramp-invoke-ange-ftp (operation &rest args) 3059(defun tramp-invoke-ange-ftp (operation &rest args)
3255 "Invoke the Ange-FTP handler function and throw." 3060 "Invoke the Ange-FTP handler function and throw."
3061 (or ange-ftp-name-format (require 'ange-ftp))
3256 (let ((ange-ftp-name-format 3062 (let ((ange-ftp-name-format
3257 (list (nth 0 tramp-file-name-structure) 3063 (list (nth 0 tramp-file-name-structure)
3258 (nth 3 tramp-file-name-structure) 3064 (nth 3 tramp-file-name-structure)
@@ -3650,13 +3456,145 @@ Returns nil if none was found, else the command is returned."
3650;; -- Functions for establishing connection -- 3456;; -- Functions for establishing connection --
3651;; ------------------------------------------------------------ 3457;; ------------------------------------------------------------
3652 3458
3653(defun tramp-process-actions 3459;; The following functions are actions to be taken when seeing certain
3654 (multi-method method user host actions &optional timeout) 3460;; prompts from the remote host. See the variable
3655 "Process given ACTIONS for login specified via first four args. 3461;; `tramp-actions-before-shell' for usage of these functions.
3656ACTIONS is a list of items (REGEXP FUN), where REGEXP specifies what 3462
3657output from the remote end to look for, and FUN specifies the action 3463(defun tramp-action-login (p multi-method method user host)
3658to take when the regexp matches." 3464 "Send the login name."
3659 nil) 3465 (tramp-message 9 "Sending login name `%s'"
3466 (or user (user-login-name)))
3467 (erase-buffer)
3468 (process-send-string nil (concat (or user (user-login-name))
3469 tramp-rsh-end-of-line)))
3470
3471(defun tramp-action-password (p multi-method method user host)
3472 "Query the user for a password."
3473 (when (tramp-method-out-of-band-p multi-method method)
3474 (kill-process (get-buffer-process (current-buffer)))
3475 (error (concat "Out of band method `%s' not applicable "
3476 "for remote shell asking for a password")
3477 method))
3478 (tramp-enter-password p (match-string 0)))
3479
3480(defun tramp-action-succeed (p multi-method method user host)
3481 "Signal success in finding shell prompt."
3482 (tramp-message 9 "Found remote shell prompt.")
3483 (erase-buffer)
3484 (throw 'tramp-action 'ok))
3485
3486(defun tramp-action-permission-denied (p multi-method method user host)
3487 "Signal permission denied."
3488 (tramp-message 9 "Permission denied by remote host.")
3489 (kill-process p)
3490 (erase-buffer)
3491 (throw 'tramp-action 'permission-denied))
3492
3493(defun tramp-action-yesno (p multi-method method user host)
3494 "Ask the user if he is sure."
3495 (save-window-excursion
3496 (pop-to-buffer (tramp-get-buffer multi-method method user host))
3497 (unless (yes-or-no-p (match-string 0))
3498 (kill-process p)
3499 (erase-buffer)
3500 (throw 'tramp-action 'permission-denied))
3501 (process-send-string p (concat "yes" tramp-rsh-end-of-line))
3502 (erase-buffer)))
3503
3504;; The following functions are specifically for multi connections.
3505
3506(defun tramp-multi-action-login (p method user host)
3507 "Send the login name."
3508 (tramp-message 9 "Sending login name `%s'" user)
3509 (erase-buffer)
3510 (process-send-string p (concat user tramp-rsh-end-of-line)))
3511
3512(defun tramp-multi-action-password (p method user host)
3513 "Query the user for a password."
3514 (tramp-enter-password p (match-string 0)))
3515
3516(defun tramp-multi-action-succeed (p method user host)
3517 "Signal success in finding shell prompt."
3518 (tramp-message 9 "Found shell prompt on `%s'" host)
3519 (erase-buffer)
3520 (throw 'tramp-action 'ok))
3521
3522(defun tramp-multi-action-permission-denied (p method user host)
3523 "Signal permission denied."
3524 (tramp-message 9 "Permission denied by remote host `%s'" host)
3525 (kill-process p)
3526 (erase-buffer)
3527 (throw 'tramp-action 'permission-denied))
3528
3529;; Functions for processing the actions.
3530
3531(defun tramp-process-one-action (p multi-method method user host actions)
3532 "Wait for output from the shell and perform one action."
3533 (let (found item pattern action todo)
3534 (erase-buffer)
3535 (tramp-message 9 "Waiting 60s for prompt from remote shell")
3536 (with-timeout (60 (throw 'tramp-action 'timeout))
3537 (while (not found)
3538 (accept-process-output p 1)
3539 (goto-char (point-min))
3540 (setq todo actions)
3541 (while todo
3542 (goto-char (point-min))
3543 (setq item (pop todo))
3544 (setq pattern (symbol-value (nth 0 item)))
3545 (setq action (nth 1 item))
3546 (tramp-message 10 "Looking for pattern %s" pattern)
3547 (when (re-search-forward (concat pattern "\\'") nil t)
3548 (setq found (funcall action p multi-method method user host)))))
3549 found)))
3550
3551(defun tramp-process-actions (p multi-method method user host actions)
3552 "Perform actions until success."
3553 (let (exit)
3554 (while (not exit)
3555 (tramp-message 10 "Processing actions")
3556 (setq exit
3557 (catch 'tramp-action
3558 (tramp-process-one-action
3559 p multi-method method user host actions)
3560 nil)))
3561 (unless (eq exit 'ok)
3562 (error "Login failed"))))
3563
3564;; For multi-actions.
3565
3566(defun tramp-process-one-multi-action (p method user host actions)
3567 "Wait for output from the shell and perform one action."
3568 (let (found item pattern action todo)
3569 (erase-buffer)
3570 (tramp-message 9 "Waiting 60s for prompt from remote shell")
3571 (with-timeout (60 (throw 'tramp-action 'timeout))
3572 (while (not found)
3573 (accept-process-output p 1)
3574 (setq todo actions)
3575 (goto-char (point-min))
3576 (while todo
3577 (goto-char (point-min))
3578 (setq item (pop todo))
3579 (setq pattern (symbol-value (nth 0 item)))
3580 (setq action (nth 1 item))
3581 (tramp-message 10 "Looking for pattern %s" pattern)
3582 (when (re-search-forward (concat pattern "\\'") nil t)
3583 (setq found (funcall action p method user host)))))
3584 found)))
3585
3586(defun tramp-process-multi-actions (p method user host actions)
3587 "Perform actions until success."
3588 (let (exit)
3589 (while (not exit)
3590 (setq exit
3591 (catch 'tramp-action
3592 (tramp-process-one-multi-action p method user host actions)
3593 nil)))
3594 (unless (eq exit 'ok)
3595 (error "Login failed"))))
3596
3597;; The actual functions for opening connections.
3660 3598
3661(defun tramp-open-connection-telnet (multi-method method user host) 3599(defun tramp-open-connection-telnet (multi-method method user host)
3662 "Open a connection using a telnet METHOD. 3600 "Open a connection using a telnet METHOD.
@@ -3702,44 +3640,50 @@ Maybe the different regular expressions need to be tuned.
3702 (found nil) 3640 (found nil)
3703 (pw nil)) 3641 (pw nil))
3704 (process-kill-without-query p) 3642 (process-kill-without-query p)
3705 (tramp-message 9 "Waiting for login prompt...") 3643 (set-buffer (tramp-get-buffer multi-method method user host))
3706 (unless (tramp-wait-for-regexp p nil tramp-login-prompt-regexp) 3644 (erase-buffer)
3707 (pop-to-buffer (buffer-name)) 3645 (tramp-process-actions p multi-method method user host
3708 (kill-process p) 3646 tramp-actions-before-shell)
3709 (error "Couldn't find remote login prompt")) 3647
3710 (erase-buffer) 3648;; (tramp-message 9 "Waiting for login prompt...")
3711 ;; Remote login defaults to local one. 3649;; (unless (tramp-wait-for-regexp p nil tramp-login-prompt-regexp)
3712 (tramp-message 9 "Sending login name %s" (or user (user-login-name))) 3650;; (pop-to-buffer (buffer-name))
3713 (process-send-string p (concat (or user (user-login-name)) 3651;; (kill-process p)
3714 tramp-rsh-end-of-line)) 3652;; (error "Couldn't find remote login prompt"))
3715 (tramp-message 9 "Waiting for password prompt...") 3653;; (erase-buffer)
3716 (unless (setq found (tramp-wait-for-regexp 3654;; ;; Remote login defaults to local one.
3717 p nil tramp-password-prompt-regexp)) 3655;; (tramp-message 9 "Sending login name %s" (or user (user-login-name)))
3718 (pop-to-buffer (buffer-name)) 3656;; (process-send-string p (concat (or user (user-login-name))
3719 (kill-process p) 3657;; tramp-rsh-end-of-line))
3720 (error "Couldn't find remote password prompt")) 3658;; (tramp-message 9 "Waiting for password prompt...")
3721 (erase-buffer) 3659;; (unless (setq found (tramp-wait-for-regexp
3722 (setq pw (tramp-read-passwd (car found))) 3660;; p nil tramp-password-prompt-regexp))
3723 (tramp-message 9 "Sending password") 3661;; (pop-to-buffer (buffer-name))
3724 (process-send-string p (concat pw tramp-rsh-end-of-line)) 3662;; (kill-process p)
3725 (tramp-message 9 "Waiting 30s for remote shell to come up...") 3663;; (error "Couldn't find remote password prompt"))
3726 (unless (setq found 3664;; (erase-buffer)
3727 (tramp-wait-for-regexp 3665;; (setq pw (tramp-read-passwd (car found)))
3728 p 30 (format "\\(%s\\)\\|\\(%s\\)\\'" 3666;; (tramp-message 9 "Sending password")
3729 tramp-wrong-passwd-regexp 3667;; (process-send-string p (concat pw tramp-rsh-end-of-line))
3730 shell-prompt-pattern))) 3668;; (tramp-message 9 "Waiting 30s for remote shell to come up...")
3731 (pop-to-buffer (buffer-name)) 3669;; (unless (setq found
3732 (kill-process p) 3670;; (tramp-wait-for-regexp
3733 (error "Couldn't find remote shell prompt")) 3671;; p 30 (format "\\(%s\\)\\|\\(%s\\)\\'"
3734 (when (nth 1 found) 3672;; tramp-wrong-passwd-regexp
3735 (pop-to-buffer (buffer-name)) 3673;; shell-prompt-pattern)))
3736 (kill-process p) 3674;; (pop-to-buffer (buffer-name))
3737 (error "Login failed: %s" (nth 1 found))) 3675;; (kill-process p)
3676;; (error "Couldn't find remote shell prompt"))
3677;; (when (nth 1 found)
3678;; (pop-to-buffer (buffer-name))
3679;; (kill-process p)
3680;; (error "Login failed: %s" (nth 1 found)))
3681
3738 (tramp-open-connection-setup-interactive-shell 3682 (tramp-open-connection-setup-interactive-shell
3739 p multi-method method user host) 3683 p multi-method method user host)
3740 (tramp-post-connection multi-method method user host))))) 3684 (tramp-post-connection multi-method method user host)))))
3741 3685
3742;; HHH: Changed to handle the case when USER is nil. 3686
3743(defun tramp-open-connection-rsh (multi-method method user host) 3687(defun tramp-open-connection-rsh (multi-method method user host)
3744 "Open a connection using an rsh METHOD. 3688 "Open a connection using an rsh METHOD.
3745This starts the command `rsh HOST -l USER'[*], then waits for a remote 3689This starts the command `rsh HOST -l USER'[*], then waits for a remote
@@ -3794,47 +3738,52 @@ arguments, and xx will be used as the host name to connect to.
3794 host rsh-args))) 3738 host rsh-args)))
3795 (found nil)) 3739 (found nil))
3796 (process-kill-without-query p) 3740 (process-kill-without-query p)
3797 (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host) 3741
3798 (setq found 3742 (set-buffer buf)
3799 (tramp-wait-for-regexp 3743 (tramp-process-actions p multi-method method user host
3800 p 60 3744 tramp-actions-before-shell)
3801 (format 3745
3802 "\\(%s\\)\\|\\(%s\\)\\'" 3746;; (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host)
3803 tramp-password-prompt-regexp 3747;; (setq found
3804 shell-prompt-pattern))) 3748;; (tramp-wait-for-regexp
3805 (unless found 3749;; p 60
3806 (pop-to-buffer (buffer-name)) 3750;; (format
3807 (kill-process p) 3751;; "\\(%s\\)\\|\\(%s\\)\\'"
3808 (error "Couldn't find remote shell or passwd prompt")) 3752;; tramp-password-prompt-regexp
3809 (when (nth 1 found) 3753;; shell-prompt-pattern)))
3810 (when (tramp-method-out-of-band-p multi-method method) 3754;; (unless found
3811 (pop-to-buffer (buffer-name)) 3755;; (pop-to-buffer (buffer-name))
3812 (kill-process p) 3756;; (kill-process p)
3813 (error (concat "Out of band method `%s' not applicable" 3757;; (error "Couldn't find remote shell or passwd prompt"))
3814 " for remote shell asking for a password") 3758;; (when (nth 1 found)
3815 method)) 3759;; (when (tramp-method-out-of-band-p multi-method method)
3816 (erase-buffer) 3760;; (pop-to-buffer (buffer-name))
3817 (tramp-message 9 "Sending password...") 3761;; (kill-process p)
3818 (tramp-enter-password p (nth 1 found)) 3762;; (error (concat "Out of band method `%s' not applicable"
3819 (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") 3763;; " for remote shell asking for a password")
3820 (setq found (tramp-wait-for-regexp p 60 3764;; method))
3821 (format "\\(%s\\)\\|\\(%s\\)\\'" 3765;; (erase-buffer)
3822 tramp-wrong-passwd-regexp 3766;; (tramp-message 9 "Sending password...")
3823 shell-prompt-pattern)))) 3767;; (tramp-enter-password p (nth 1 found))
3824 (unless found 3768;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt")
3825 (pop-to-buffer (buffer-name)) 3769;; (setq found (tramp-wait-for-regexp p 60
3826 (kill-process p) 3770;; (format "\\(%s\\)\\|\\(%s\\)\\'"
3827 (error "Couldn't find remote shell prompt")) 3771;; tramp-wrong-passwd-regexp
3828 (when (nth 1 found) 3772;; shell-prompt-pattern))))
3829 (pop-to-buffer (buffer-name)) 3773;; (unless found
3830 (kill-process p) 3774;; (pop-to-buffer (buffer-name))
3831 (error "Login failed: %s" (nth 1 found))) 3775;; (kill-process p)
3776;; (error "Couldn't find remote shell prompt"))
3777;; (when (nth 1 found)
3778;; (pop-to-buffer (buffer-name))
3779;; (kill-process p)
3780;; (error "Login failed: %s" (nth 1 found)))
3781
3832 (tramp-message 7 "Initializing remote shell") 3782 (tramp-message 7 "Initializing remote shell")
3833 (tramp-open-connection-setup-interactive-shell 3783 (tramp-open-connection-setup-interactive-shell
3834 p multi-method method user host) 3784 p multi-method method user host)
3835 (tramp-post-connection multi-method method user host))))) 3785 (tramp-post-connection multi-method method user host)))))
3836 3786
3837;; HHH: Changed. Now utilizes (or user (user-login-name)) instead of USER.
3838(defun tramp-open-connection-su (multi-method method user host) 3787(defun tramp-open-connection-su (multi-method method user host)
3839 "Open a connection using the `su' program with METHOD. 3788 "Open a connection using the `su' program with METHOD.
3840This starts `su - USER', then waits for a password prompt. The HOST 3789This starts `su - USER', then waits for a password prompt. The HOST
@@ -3868,45 +3817,48 @@ at all unlikely that this variable is set up wrongly!"
3868 (> emacs-major-version 20)) 3817 (> emacs-major-version 20))
3869 tramp-dos-coding-system)) 3818 tramp-dos-coding-system))
3870 (p (apply 'start-process 3819 (p (apply 'start-process
3871 (tramp-buffer-name multi-method method 3820 (tramp-buffer-name multi-method method user host)
3872 user host) 3821 (tramp-get-buffer multi-method method user host)
3873 (tramp-get-buffer multi-method method
3874 user host)
3875 (tramp-get-su-program multi-method method) 3822 (tramp-get-su-program multi-method method)
3876 (mapcar 3823 (mapcar
3877 '(lambda (x) 3824 '(lambda (x)
3878 (format-spec x `((?u ,user)))) 3825 (format-spec x `((?u . ,user))))
3879 (tramp-get-su-args multi-method method)))) 3826 (tramp-get-su-args multi-method method))))
3880 (found nil) 3827 (found nil)
3881 (pw nil)) 3828 (pw nil))
3882 (process-kill-without-query p) 3829 (process-kill-without-query p)
3883 (tramp-message 9 "Waiting 30s for shell or password prompt...") 3830 (set-buffer (tramp-get-buffer multi-method method user host))
3884 (unless (setq found (tramp-wait-for-regexp 3831 (tramp-process-actions p multi-method method user host
3885 p 30 3832 tramp-actions-before-shell)
3886 (format "\\(%s\\)\\|\\(%s\\)\\'" 3833
3887 tramp-password-prompt-regexp 3834;; (tramp-message 9 "Waiting 30s for shell or password prompt...")
3888 shell-prompt-pattern))) 3835;; (unless (setq found (tramp-wait-for-regexp
3889 (pop-to-buffer (buffer-name)) 3836;; p 30
3890 (kill-process p) 3837;; (format "\\(%s\\)\\|\\(%s\\)\\'"
3891 (error "Couldn't find shell or password prompt")) 3838;; tramp-password-prompt-regexp
3892 (when (nth 1 found) 3839;; shell-prompt-pattern)))
3893 (erase-buffer) 3840;; (pop-to-buffer (buffer-name))
3894 (setq pw (tramp-read-passwd (car found))) 3841;; (kill-process p)
3895 (tramp-message 9 "Sending password") 3842;; (error "Couldn't find shell or password prompt"))
3896 (process-send-string p (concat pw tramp-rsh-end-of-line)) 3843;; (when (nth 1 found)
3897 (tramp-message 9 "Waiting 30s for remote shell to come up...") 3844;; (erase-buffer)
3898 (unless (setq found 3845;; (setq pw (tramp-read-passwd (car found)))
3899 (tramp-wait-for-regexp 3846;; (tramp-message 9 "Sending password")
3900 p 30 (format "\\(%s\\)\\|\\(%s\\)\\'" 3847;; (process-send-string p (concat pw tramp-rsh-end-of-line))
3901 tramp-wrong-passwd-regexp 3848;; (tramp-message 9 "Waiting 30s for remote shell to come up...")
3902 shell-prompt-pattern))) 3849;; (unless (setq found
3903 (pop-to-buffer (buffer-name)) 3850;; (tramp-wait-for-regexp
3904 (kill-process p) 3851;; p 30 (format "\\(%s\\)\\|\\(%s\\)\\'"
3905 (error "Couldn't find remote shell prompt")) 3852;; tramp-wrong-passwd-regexp
3906 (when (nth 1 found) 3853;; shell-prompt-pattern)))
3907 (pop-to-buffer (buffer-name)) 3854;; (pop-to-buffer (buffer-name))
3908 (kill-process p) 3855;; (kill-process p)
3909 (error "`su' failed: %s" (nth 1 found)))) 3856;; (error "Couldn't find remote shell prompt"))
3857;; (when (nth 1 found)
3858;; (pop-to-buffer (buffer-name))
3859;; (kill-process p)
3860;; (error "`su' failed: %s" (nth 1 found))))
3861
3910 (tramp-open-connection-setup-interactive-shell 3862 (tramp-open-connection-setup-interactive-shell
3911 p multi-method method user host) 3863 p multi-method method user host)
3912 (tramp-post-connection multi-method method 3864 (tramp-post-connection multi-method method
@@ -3990,42 +3942,47 @@ set in `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent
3990character. 3942character.
3991 3943
3992If USER is nil, uses the return value of (user-login-name) instead." 3944If USER is nil, uses the return value of (user-login-name) instead."
3993 (let ((cmd (format-spec command `((?h ,host) (?n ,tramp-rsh-end-of-line)))) 3945 (let ((cmd (format-spec command
3994 (cmd1 (format-spec command `((?h ,host) (?n "")))) 3946 `((?h . ,host) (?n . ,tramp-rsh-end-of-line))))
3947 (cmd1 (format-spec command `((?h . ,host) (?n . ""))))
3995 found pw) 3948 found pw)
3996 (erase-buffer) 3949 (erase-buffer)
3997 (tramp-message 9 "Sending telnet command `%s'" cmd1) 3950 (tramp-message 9 "Sending telnet command `%s'" cmd1)
3998 (process-send-string p cmd) 3951 (process-send-string p cmd)
3999 (tramp-message 9 "Waiting 30s for login prompt from %s" host) 3952 (tramp-process-multi-actions p method user host
4000 (unless (tramp-wait-for-regexp p 30 tramp-login-prompt-regexp) 3953 tramp-multi-actions)
4001 (pop-to-buffer (buffer-name)) 3954
4002 (kill-process p) 3955;; (tramp-message 9 "Waiting 30s for login prompt from %s" host)
4003 (error "Couldn't find login prompt from host %s" host)) 3956;; (unless (tramp-wait-for-regexp p 30 tramp-login-prompt-regexp)
4004 (erase-buffer) 3957;; (pop-to-buffer (buffer-name))
4005 (tramp-message 9 "Sending login name %s" (or user (user-login-name))) 3958;; (kill-process p)
4006 (process-send-string p (concat (or user (user-login-name)) tramp-rsh-end-of-line)) 3959;; (error "Couldn't find login prompt from host %s" host))
4007 (tramp-message 9 "Waiting for password prompt") 3960;; (erase-buffer)
4008 (unless (setq found (tramp-wait-for-regexp p nil tramp-password-prompt-regexp)) 3961;; (tramp-message 9 "Sending login name %s" (or user (user-login-name)))
4009 (pop-to-buffer (buffer-name)) 3962;; (process-send-string p (concat (or user (user-login-name)) tramp-rsh-end-of-line))
4010 (kill-process p) 3963;; (tramp-message 9 "Waiting for password prompt")
4011 (error "Couldn't find password prompt from host %s" host)) 3964;; (unless (setq found (tramp-wait-for-regexp p nil tramp-password-prompt-regexp))
4012 (erase-buffer) 3965;; (pop-to-buffer (buffer-name))
4013 (setq pw (tramp-read-passwd 3966;; (kill-process p)
4014 (format "Password for %s@%s, %s" (or user (user-login-name)) host found))) 3967;; (error "Couldn't find password prompt from host %s" host))
4015 (tramp-message 9 "Sending password") 3968;; (erase-buffer)
4016 (process-send-string p (concat pw tramp-rsh-end-of-line)) 3969;; (setq pw (tramp-read-passwd
4017 (tramp-message 9 "Waiting 60s for remote shell to come up...") 3970;; (format "Password for %s@%s, %s" (or user (user-login-name)) host found)))
4018 (unless (setq found (tramp-wait-for-regexp 3971;; (tramp-message 9 "Sending password")
4019 p 60 (format "\\(%s\\)\\|\\(%s\\)\\'" 3972;; (process-send-string p (concat pw tramp-rsh-end-of-line))
4020 tramp-wrong-passwd-regexp 3973;; (tramp-message 9 "Waiting 60s for remote shell to come up...")
4021 shell-prompt-pattern))) 3974;; (unless (setq found (tramp-wait-for-regexp
4022 (pop-to-buffer (buffer-name)) 3975;; p 60 (format "\\(%s\\)\\|\\(%s\\)\\'"
4023 (kill-process p) 3976;; tramp-wrong-passwd-regexp
4024 (error "Couldn't find shell prompt from host %s" host)) 3977;; shell-prompt-pattern)))
4025 (when (nth 1 found) 3978;; (pop-to-buffer (buffer-name))
4026 (pop-to-buffer (buffer-name)) 3979;; (kill-process p)
4027 (kill-process p) 3980;; (error "Couldn't find shell prompt from host %s" host))
4028 (error "Login to %s failed: %s" (nth 2 found))))) 3981;; (when (nth 1 found)
3982;; (pop-to-buffer (buffer-name))
3983;; (kill-process p)
3984;; (error "Login to %s failed: %s" (nth 2 found)))
3985 ))
4029 3986
4030;; HHH: Changed. Multi method. Don't know how to handle this in the case 3987;; HHH: Changed. Multi method. Don't know how to handle this in the case
4031;; of no user name provided. Hack to make it work as it did before: 3988;; of no user name provided. Hack to make it work as it did before:
@@ -4040,42 +3997,45 @@ will be replaced with the value of `tramp-rsh-end-of-line'. You can use
4040`%%' if you want to use a literal percent character. 3997`%%' if you want to use a literal percent character.
4041 3998
4042If USER is nil, uses the return value of (user-login-name) instead." 3999If USER is nil, uses the return value of (user-login-name) instead."
4043 (let ((cmd (format-spec command `((?h ,host) 4000 (let ((cmd (format-spec command `((?h . ,host)
4044 (?u ,(or user (user-login-name))) 4001 (?u . ,(or user (user-login-name)))
4045 (?n ,tramp-rsh-end-of-line)))) 4002 (?n . ,tramp-rsh-end-of-line))))
4046 (cmd1 (format-spec command `((?h ,host) 4003 (cmd1 (format-spec command `((?h . ,host)
4047 (?u ,(or user (user-login-name))) 4004 (?u . ,(or user (user-login-name)))
4048 (?n "")))) 4005 (?n . ""))))
4049 found) 4006 found)
4050 (erase-buffer) 4007 (erase-buffer)
4051 (tramp-message 9 "Sending rlogin command `%s'" cmd1) 4008 (tramp-message 9 "Sending rlogin command `%s'" cmd1)
4052 (process-send-string p cmd) 4009 (process-send-string p cmd)
4053 (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host) 4010 (tramp-process-multi-actions p method user host
4054 (unless (setq found 4011 tramp-multi-actions)
4055 (tramp-wait-for-regexp p 60 4012;; (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host)
4056 (format "\\(%s\\)\\|\\(%s\\)\\'" 4013;; (unless (setq found
4057 tramp-password-prompt-regexp 4014;; (tramp-wait-for-regexp p 60
4058 shell-prompt-pattern))) 4015;; (format "\\(%s\\)\\|\\(%s\\)\\'"
4059 (pop-to-buffer (buffer-name)) 4016;; tramp-password-prompt-regexp
4060 (kill-process p) 4017;; shell-prompt-pattern)))
4061 (error "Couldn't find remote shell or passwd prompt")) 4018;; (pop-to-buffer (buffer-name))
4062 (when (nth 1 found) 4019;; (kill-process p)
4063 (erase-buffer) 4020;; (error "Couldn't find remote shell or passwd prompt"))
4064 (tramp-message 9 "Sending password...") 4021;; (when (nth 1 found)
4065 (tramp-enter-password p (nth 1 found)) 4022;; (erase-buffer)
4066 (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") 4023;; (tramp-message 9 "Sending password...")
4067 (setq found (tramp-wait-for-regexp p 60 4024;; (tramp-enter-password p (nth 1 found))
4068 (format "\\(%s\\)\\|\\(%s\\)\\'" 4025;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt")
4069 tramp-wrong-passwd-regexp 4026;; (setq found (tramp-wait-for-regexp p 60
4070 shell-prompt-pattern)))) 4027;; (format "\\(%s\\)\\|\\(%s\\)\\'"
4071 (unless found 4028;; tramp-wrong-passwd-regexp
4072 (pop-to-buffer (buffer-name)) 4029;; shell-prompt-pattern))))
4073 (kill-process p) 4030;; (unless found
4074 (error "Couldn't find remote shell prompt")) 4031;; (pop-to-buffer (buffer-name))
4075 (when (nth 1 found) 4032;; (kill-process p)
4076 (pop-to-buffer (buffer-name)) 4033;; (error "Couldn't find remote shell prompt"))
4077 (kill-process p) 4034;; (when (nth 1 found)
4078 (error "Login failed: %s" (nth 1 found))))) 4035;; (pop-to-buffer (buffer-name))
4036;; (kill-process p)
4037;; (error "Login failed: %s" (nth 1 found)))
4038 ))
4079 4039
4080;; HHH: Changed. Multi method. Don't know how to handle this in the case 4040;; HHH: Changed. Multi method. Don't know how to handle this in the case
4081;; of no user name provided. Hack to make it work as it did before: 4041;; of no user name provided. Hack to make it work as it did before:
@@ -4093,40 +4053,43 @@ You can use percent escapes in the COMMAND. `%u' is replaced with the
4093user name, and `%n' is replaced with the value of 4053user name, and `%n' is replaced with the value of
4094`tramp-rsh-end-of-line'. Use `%%' if you want a literal percent 4054`tramp-rsh-end-of-line'. Use `%%' if you want a literal percent
4095character." 4055character."
4096 (let ((cmd (format-spec command `((?u ,(or user (user-login-name))) 4056 (let ((cmd (format-spec command `((?u . ,(or user (user-login-name)))
4097 (?n ,tramp-rsh-end-of-line)))) 4057 (?n . ,tramp-rsh-end-of-line))))
4098 (cmd1 (format-spec command `((?u ,(or user (user-login-name))) 4058 (cmd1 (format-spec command `((?u . ,(or user (user-login-name)))
4099 (?n "")))) 4059 (?n . ""))))
4100 found) 4060 found)
4101 (erase-buffer) 4061 (erase-buffer)
4102 (tramp-message 9 "Sending su command `%s'" cmd1) 4062 (tramp-message 9 "Sending su command `%s'" cmd1)
4103 (process-send-string p cmd) 4063 (process-send-string p cmd)
4104 (tramp-message 9 "Waiting 60s for shell or passwd prompt for %s" (or user (user-login-name))) 4064 (tramp-process-multi-actions p method user host
4105 (unless (setq found (tramp-wait-for-regexp 4065 tramp-multi-actions)
4106 p 60 (format "\\(%s\\)\\|\\(%s\\)\\'" 4066;; (tramp-message 9 "Waiting 60s for shell or passwd prompt for %s" (or user (user-login-name)))
4107 tramp-password-prompt-regexp 4067;; (unless (setq found (tramp-wait-for-regexp
4108 shell-prompt-pattern))) 4068;; p 60 (format "\\(%s\\)\\|\\(%s\\)\\'"
4109 (pop-to-buffer (buffer-name)) 4069;; tramp-password-prompt-regexp
4110 (kill-process p) 4070;; shell-prompt-pattern)))
4111 (error "Couldn't find shell or passwd prompt for %s" 4071;; (pop-to-buffer (buffer-name))
4112 (or user (user-login-name)))) 4072;; (kill-process p)
4113 (when (nth 1 found) 4073;; (error "Couldn't find shell or passwd prompt for %s"
4114 (tramp-message 9 "Sending password...") 4074;; (or user (user-login-name))))
4115 (tramp-enter-password p (nth 1 found)) 4075;; (when (nth 1 found)
4116 (erase-buffer) 4076;; (tramp-message 9 "Sending password...")
4117 (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") 4077;; (tramp-enter-password p (nth 1 found))
4118 (setq found (tramp-wait-for-regexp p 60 4078;; (erase-buffer)
4119 (format "\\(%s\\)\\|\\(%s\\)\\'" 4079;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt")
4120 tramp-wrong-passwd-regexp 4080;; (setq found (tramp-wait-for-regexp p 60
4121 shell-prompt-pattern)))) 4081;; (format "\\(%s\\)\\|\\(%s\\)\\'"
4122 (unless found 4082;; tramp-wrong-passwd-regexp
4123 (pop-to-buffer (buffer-name)) 4083;; shell-prompt-pattern))))
4124 (kill-process p) 4084;; (unless found
4125 (error "Couldn't find remote shell prompt")) 4085;; (pop-to-buffer (buffer-name))
4126 (when (nth 1 found) 4086;; (kill-process p)
4127 (pop-to-buffer (buffer-name)) 4087;; (error "Couldn't find remote shell prompt"))
4128 (kill-process p) 4088;; (when (nth 1 found)
4129 (error "Login failed: %s" (nth 1 found))))) 4089;; (pop-to-buffer (buffer-name))
4090;; (kill-process p)
4091;; (error "Login failed: %s" (nth 1 found)))
4092 ))
4130 4093
4131;; Utility functions. 4094;; Utility functions.
4132 4095
@@ -4176,6 +4139,7 @@ nil."
4176 "Prompt for a password and send it to the remote end. 4139 "Prompt for a password and send it to the remote end.
4177Uses PROMPT as a prompt and sends the password to process P." 4140Uses PROMPT as a prompt and sends the password to process P."
4178 (let ((pw (tramp-read-passwd prompt))) 4141 (let ((pw (tramp-read-passwd prompt)))
4142 (erase-buffer)
4179 (process-send-string p (concat pw tramp-rsh-end-of-line)))) 4143 (process-send-string p (concat pw tramp-rsh-end-of-line))))
4180 4144
4181;; HHH: Not Changed. This might handle the case where USER is not 4145;; HHH: Not Changed. This might handle the case where USER is not
@@ -4435,32 +4399,22 @@ locale to C and sets up the remote shell search path."
4435 " -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" 4399 " -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n"
4436 "}")) 4400 "}"))
4437 (tramp-wait-for-output) 4401 (tramp-wait-for-output)
4438 (when (string= (tramp-get-encoding-command multi-method method) 4402 (tramp-message 5 "Sending the Perl `mime-encode' implementation.")
4439 "tramp_mimencode") 4403 (tramp-send-linewise
4440 (tramp-message 5 "Sending the Perl `mime-encode' implementation.") 4404 multi-method method user host
4441 (tramp-send-linewise 4405 (concat "tramp_encode () {\n"
4442 multi-method method user host 4406 (format tramp-perl-encode tramp-remote-perl)
4443 (concat "tramp_mimencode () {\n" 4407 " 2>/dev/null"
4444 (if (tramp-find-executable multi-method method user host 4408 "\n}"))
4445 "mimencode" tramp-remote-path t) 4409 (tramp-wait-for-output)
4446 "mimencode -b $1" 4410 (tramp-message 5 "Sending the Perl `mime-decode' implementation.")
4447 (concat tramp-remote-perl 4411 (tramp-send-linewise
4448 " -e '" tramp-perl-mime-encode "' $1 2>/dev/null")) 4412 multi-method method user host
4449 "\n}")) 4413 (concat "tramp_decode () {\n"
4450 (tramp-wait-for-output)) 4414 (format tramp-perl-decode tramp-remote-perl)
4451 (when (string= (tramp-get-decoding-command multi-method method) 4415 " 2>/dev/null"
4452 "tramp_mimedecode") 4416 "\n}"))
4453 (tramp-message 5 "Sending the Perl `mime-decode' implementation.") 4417 (tramp-wait-for-output))))
4454 (tramp-send-linewise
4455 multi-method method user host
4456 (concat "tramp_mimedecode () {\n"
4457 (if (tramp-find-executable multi-method method user host
4458 "mimencode" tramp-remote-path t)
4459 "mimencode -u -b $1"
4460 (concat tramp-remote-perl
4461 " -e '" tramp-perl-mime-decode "' $1 2>/dev/null"))
4462 "\n}"))
4463 (tramp-wait-for-output)))))
4464 ;; Find ln(1) 4418 ;; Find ln(1)
4465 (erase-buffer) 4419 (erase-buffer)
4466 (let ((ln (tramp-find-executable multi-method method user host 4420 (let ((ln (tramp-find-executable multi-method method user host
@@ -4468,11 +4422,14 @@ locale to C and sets up the remote shell search path."
4468 (when ln 4422 (when ln
4469 (tramp-set-connection-property "ln" ln multi-method method user host))) 4423 (tramp-set-connection-property "ln" ln multi-method method user host)))
4470 (erase-buffer) 4424 (erase-buffer)
4425 ;; Find the right encoding/decoding commands to use.
4426 (unless (tramp-get-rcp-program multi-method method)
4427 (tramp-find-inline-encoding multi-method method user host))
4471 ;; If encoding/decoding command are given, test to see if they work. 4428 ;; If encoding/decoding command are given, test to see if they work.
4472 ;; CCC: Maybe it would be useful to run the encoder both locally and 4429 ;; CCC: Maybe it would be useful to run the encoder both locally and
4473 ;; remotely to see if they produce the same result. 4430 ;; remotely to see if they produce the same result.
4474 (let ((decoding (tramp-get-decoding-command multi-method method)) 4431 (let ((decoding (tramp-get-decoding-command multi-method method user host))
4475 (encoding (tramp-get-encoding-command multi-method method)) 4432 (encoding (tramp-get-encoding-command multi-method method user host))
4476 (magic-string "xyzzy")) 4433 (magic-string "xyzzy"))
4477 (when (and (or decoding encoding) (not (and decoding encoding))) 4434 (when (and (or decoding encoding) (not (and decoding encoding)))
4478 (tramp-kill-process multi-method method user host) 4435 (tramp-kill-process multi-method method user host)
@@ -4495,15 +4452,138 @@ locale to C and sets up the remote shell search path."
4495 (tramp-message 4452 (tramp-message
4496 5 "Checking to see if encoding/decoding commands work on remote host...done")))) 4453 5 "Checking to see if encoding/decoding commands work on remote host...done"))))
4497 4454
4455;; CCC: We should either implement a Perl version of base64 encoding
4456;; and decoding. Then we just use that in the last item. The other
4457;; alternative is to use the Perl version of UU encoding. But then
4458;; we need a Lisp version of uuencode.
4459(defvar tramp-coding-commands
4460 '(("mimencode -b" "mimencode -u -b"
4461 base64-encode-region base64-decode-region)
4462 ("mmencode -b" "mmencode -u -b"
4463 base64-encode-region base64-decode-region)
4464 ("recode data..base64" "recode base64..data"
4465 base64-encode-region base64-decode-region)
4466 ("uuencode xxx" "uudecode -o -"
4467 nil uudecode-decode-region)
4468 ("uuencode xxx" "uudecode -p"
4469 nil uudecode-decode-region)
4470 ("tramp_encode" "tramp_decode"
4471 base64-encode-region base64-decode-region))
4472 "List of coding commands for inline transfer.
4473Each item is a list (ENCODING-COMMAND DECODING-COMMAND
4474ENCODING-FUNCTION DECODING-FUNCTION).
4475
4476Each item can be a string, giving a command, or a symbol, giving
4477a function.
4478
4479The ENCODING-COMMAND should be a command accepting a plain file on
4480standard input and writing the encoded file to standard output. The
4481DECODING-COMMAND should be a command accepting an encoded file on
4482standard input and writing the decoded file to standard output.
4483
4484The ENCODING-FUNCTION and DECODING-FUNCTION functions will be called
4485with two arguments, start and end of region, and are expected to
4486replace the region contents with the encoded or decoded results,
4487respectively.")
4488
4489(defun tramp-find-inline-encoding (multi-method method user host)
4490 "Find an inline transfer encoding that works.
4491Goes through the list `tramp-coding-commands'."
4492 (let ((commands tramp-coding-commands)
4493 item found)
4494 (while (and commands (null found))
4495 (setq item (pop commands))
4496 (catch 'wont-work
4497 (let ((ec (nth 0 item))
4498 (dc (nth 1 item))
4499 (ef (nth 2 item))
4500 (df (nth 3 item)))
4501 ;; Check if encoding and decoding commands can be called
4502 ;; remotely with null input and output. This makes sure there
4503 ;; are no syntax errors and the command is really found.
4504 (tramp-message-for-buffer
4505 multi-method method user host 10
4506 "Checking remote encoding command `%s' for sanity" ec)
4507 (unless (zerop (tramp-send-command-and-check
4508 multi-method method user host
4509 (format "%s </dev/null >/dev/null" ec) t))
4510 (throw 'wont-work nil))
4511 (tramp-message-for-buffer
4512 multi-method method user host 10
4513 "Checking remote decoding command `%s' for sanity" dc)
4514 (unless (zerop (tramp-send-command-and-check
4515 multi-method method user host
4516 (format "%s </dev/null >/dev/null" dc) t))
4517 (throw 'wont-work nil))
4518 ;; If no encoding/decoding function is given, the
4519 ;; corresponding encoding/decoding command also has to work
4520 ;; locally.
4521 (when (not (fboundp ef))
4522 (tramp-message-for-buffer
4523 multi-method method user host 10
4524 "Checking local encoding command `%s' for sanity" ec)
4525 (unless (zerop (call-process
4526 tramp-sh-program ;program
4527 nil ;input
4528 nil ;output buffer
4529 nil ;redisplay
4530 "-c"
4531 (format "%s </dev/null >/dev/null" ec)))
4532 (throw 'wont-work nil)))
4533 (when (not (fboundp df))
4534 (tramp-message-for-buffer
4535 multi-method method user host 10
4536 "Checking local decoding command `%s' for sanity" dc)
4537 (unless (zerop (call-process
4538 tramp-sh-program ;program
4539 nil ;input file
4540 nil ;output buffer
4541 nil ;redisplay
4542 "-c"
4543 (format "%s </dev/null >/dev/null" dc)))
4544 (throw 'wont-work nil)))
4545 ;; CCC: At this point, maybe we should check that the output
4546 ;; of the commands is correct. But for the moment we will
4547 ;; assume that commands working on empty input will also
4548 ;; work in practice.
4549 (setq found item))))
4550 ;; Did we find something? If not, issue error. If so,
4551 ;; set connection properties.
4552 (unless found
4553 (error "Couldn't find an inline transfer encoding"))
4554 (let ((ec (nth 0 found))
4555 (dc (nth 1 found))
4556 (ef (nth 2 found))
4557 (df (nth 3 found)))
4558 (tramp-set-encoding-command multi-method method user host ec)
4559 (tramp-set-decoding-command multi-method method user host dc)
4560 (tramp-set-encoding-function multi-method method user host ef)
4561 (tramp-set-decoding-function multi-method method user host df))))
4562
4498 4563
4499(defun tramp-maybe-open-connection (multi-method method user host) 4564(defun tramp-maybe-open-connection (multi-method method user host)
4500 "Maybe open a connection to HOST, logging in as USER, using METHOD. 4565 "Maybe open a connection to HOST, logging in as USER, using METHOD.
4501Does not do anything if a connection is already open, but re-opens the 4566Does not do anything if a connection is already open, but re-opens the
4502connection if a previous connection has died for some reason." 4567connection if a previous connection has died for some reason."
4503 (let ((p (get-buffer-process (tramp-get-buffer multi-method method user host)))) 4568 (let ((p (get-buffer-process (tramp-get-buffer multi-method method user host)))
4504 (unless (and p 4569 last-cmd-time)
4505 (processp p) 4570 ;; If too much time has passed since last command was sent, look
4506 (memq (process-status p) '(run open))) 4571 ;; whether process is still alive. If it isn't, kill it. When
4572 ;; using ssh, it can sometimes happen that the remote end has hung
4573 ;; up but the local ssh client doesn't recognize this until it
4574 ;; tries to send some data to the remote end. So that's why we
4575 ;; try to send a command from time to time, then look again
4576 ;; whether the process is really alive.
4577 (save-excursion
4578 (set-buffer (tramp-get-buffer multi-method method user host))
4579 (when (and tramp-last-cmd-time
4580 (> (tramp-time-diff tramp-last-cmd-time (current-time)) 60))
4581 (process-send-string p (concat "echo hello" tramp-rsh-end-of-line))
4582 (unless (accept-process-output p 2)
4583 (delete-process p)
4584 (setq p nil))
4585 (erase-buffer)))
4586 (unless (and p (processp p) (memq (process-status p) '(run open)))
4507 (when (and p (processp p)) 4587 (when (and p (processp p))
4508 (delete-process p)) 4588 (delete-process p))
4509 (funcall (tramp-get-connection-function multi-method method) 4589 (funcall (tramp-get-connection-function multi-method method)
@@ -4515,6 +4595,7 @@ connection if a previous connection has died for some reason."
4515Erases temporary buffer before sending the command (unless NOERASE 4595Erases temporary buffer before sending the command (unless NOERASE
4516is true)." 4596is true)."
4517 (tramp-maybe-open-connection multi-method method user host) 4597 (tramp-maybe-open-connection multi-method method user host)
4598 (setq tramp-last-cmd-time (current-time))
4518 (when tramp-debug-buffer 4599 (when tramp-debug-buffer
4519 (save-excursion 4600 (save-excursion
4520 (set-buffer (tramp-get-debug-buffer multi-method method user host)) 4601 (set-buffer (tramp-get-debug-buffer multi-method method user host))
@@ -4927,9 +5008,9 @@ remote path name."
4927 (tramp-make-tramp-multi-file-name multi-method method user host path) 5008 (tramp-make-tramp-multi-file-name multi-method method user host path)
4928 (if user 5009 (if user
4929 (format-spec tramp-make-tramp-file-format 5010 (format-spec tramp-make-tramp-file-format
4930 `((?m ,method) (?u ,user) (?h ,host) (?p ,path))) 5011 `((?m . ,method) (?u . ,user) (?h . ,host) (?p . ,path)))
4931 (format-spec tramp-make-tramp-file-user-nil-format 5012 (format-spec tramp-make-tramp-file-user-nil-format
4932 `((?m ,method) (?h ,host) (?p ,path)))))) 5013 `((?m . ,method) (?h . ,host) (?p . ,path))))))
4933 5014
4934;; CCC: Henrik Holm: Not Changed. Multi Method. What should be done 5015;; CCC: Henrik Holm: Not Changed. Multi Method. What should be done
4935;; with this when USER is nil? 5016;; with this when USER is nil?
@@ -4940,15 +5021,15 @@ remote path name."
4940 (let* ((prefix-format (nth 0 tramp-make-multi-tramp-file-format)) 5021 (let* ((prefix-format (nth 0 tramp-make-multi-tramp-file-format))
4941 (hop-format (nth 1 tramp-make-multi-tramp-file-format)) 5022 (hop-format (nth 1 tramp-make-multi-tramp-file-format))
4942 (path-format (nth 2 tramp-make-multi-tramp-file-format)) 5023 (path-format (nth 2 tramp-make-multi-tramp-file-format))
4943 (prefix (format-spec prefix-format `((?m ,multi-method)))) 5024 (prefix (format-spec prefix-format `((?m . ,multi-method))))
4944 (hops "") 5025 (hops "")
4945 (path (format-spec path-format `((?p ,path)))) 5026 (path (format-spec path-format `((?p . ,path))))
4946 (i 0) 5027 (i 0)
4947 (len (length method))) 5028 (len (length method)))
4948 (while (< i len) 5029 (while (< i len)
4949 (let ((m (aref method i)) (u (aref user i)) (h (aref host i))) 5030 (let ((m (aref method i)) (u (aref user i)) (h (aref host i)))
4950 (setq hops (concat hops (format-spec hop-format 5031 (setq hops (concat hops (format-spec hop-format
4951 `((?m ,m) (?u ,u) (?h ,h))))) 5032 `((?m . ,m) (?u . ,u) (?h . ,h)))))
4952 (incf i))) 5033 (incf i)))
4953 (concat prefix hops path))) 5034 (concat prefix hops path)))
4954 5035
@@ -4997,7 +5078,8 @@ to enter a password for the `tramp-rcp-program'."
4997 (tramp-get-connection-property "ln" nil multi-method method user host)) 5078 (tramp-get-connection-property "ln" nil multi-method method user host))
4998 5079
4999;; Get a property of a TRAMP connection. 5080;; Get a property of a TRAMP connection.
5000(defun tramp-get-connection-property (property default multi-method method user host) 5081(defun tramp-get-connection-property
5082 (property default multi-method method user host)
5001 "Get the named property for the connection. 5083 "Get the named property for the connection.
5002If the value is not set for the connection, return `default'" 5084If the value is not set for the connection, return `default'"
5003 (tramp-maybe-open-connection multi-method method user host) 5085 (tramp-maybe-open-connection multi-method method user host)
@@ -5008,7 +5090,8 @@ If the value is not set for the connection, return `default'"
5008 (error default))))) 5090 (error default)))))
5009 5091
5010;; Set a property of a TRAMP connection. 5092;; Set a property of a TRAMP connection.
5011(defun tramp-set-connection-property (property value multi-method method user host) 5093(defun tramp-set-connection-property
5094 (property value multi-method method user host)
5012 "Set the named property of a TRAMP connection." 5095 "Set the named property of a TRAMP connection."
5013 (tramp-maybe-open-connection multi-method method user host) 5096 (tramp-maybe-open-connection multi-method method user host)
5014 (with-current-buffer (tramp-get-buffer multi-method method user host) 5097 (with-current-buffer (tramp-get-buffer multi-method method user host)
@@ -5016,6 +5099,31 @@ If the value is not set for the connection, return `default'"
5016 (intern (concat "tramp-connection-property-" property))) 5099 (intern (concat "tramp-connection-property-" property)))
5017 value))) 5100 value)))
5018 5101
5102;; Some predefined connection properties.
5103(defun tramp-get-encoding-command (multi-method method user host)
5104 (tramp-get-connection-property "encoding-command" nil
5105 multi-method method user host))
5106(defun tramp-set-encoding-command (multi-method method user host command)
5107 (tramp-set-connection-property "encoding-command" command
5108 multi-method method user host))
5109(defun tramp-get-decoding-command (multi-method method user host)
5110 (tramp-get-connection-property "decoding-command" nil
5111 multi-method method user host))
5112(defun tramp-set-decoding-command (multi-method method user host command)
5113 (tramp-set-connection-property "decoding-command" command
5114 multi-method method user host))
5115(defun tramp-get-encoding-function (multi-method method user host)
5116 (tramp-get-connection-property "encoding-function" nil
5117 multi-method method user host))
5118(defun tramp-set-encoding-function (multi-method method user host func)
5119 (tramp-set-connection-property "encoding-function" func
5120 multi-method method user host))
5121(defun tramp-get-decoding-function (multi-method method user host)
5122 (tramp-get-connection-property "decoding-function" nil
5123 multi-method method user host))
5124(defun tramp-set-decoding-function (multi-method method user host func)
5125 (tramp-set-connection-property "decoding-function" func
5126 multi-method method user host))
5019 5127
5020 5128
5021(defun tramp-get-connection-function (multi-method method) 5129(defun tramp-get-connection-function (multi-method method)
@@ -5081,34 +5189,6 @@ If the value is not set for the connection, return `default'"
5081 (error "Method `%s' didn't specify su args" 5189 (error "Method `%s' didn't specify su args"
5082 (or multi-method method))))) 5190 (or multi-method method)))))
5083 5191
5084(defun tramp-get-encoding-command (multi-method method)
5085 (second (or (assoc 'tramp-encoding-command
5086 (assoc (or multi-method method tramp-default-method)
5087 tramp-methods))
5088 (error "Method `%s' didn't specify an encoding command"
5089 (or multi-method method)))))
5090
5091(defun tramp-get-decoding-command (multi-method method)
5092 (second (or (assoc 'tramp-decoding-command
5093 (assoc (or multi-method method tramp-default-method)
5094 tramp-methods))
5095 (error "Method `%s' didn't specify a decoding command"
5096 (or multi-method method)))))
5097
5098(defun tramp-get-encoding-function (multi-method method)
5099 (second (or (assoc 'tramp-encoding-function
5100 (assoc (or multi-method method tramp-default-method)
5101 tramp-methods))
5102 (error "Method `%s' didn't specify an encoding function"
5103 (or multi-method method)))))
5104
5105(defun tramp-get-decoding-function (multi-method method)
5106 (second (or (assoc 'tramp-decoding-function
5107 (assoc (or multi-method method tramp-default-method)
5108 tramp-methods))
5109 (error "Method `%s' didn't specify a decoding function"
5110 (or multi-method method)))))
5111
5112(defun tramp-get-telnet-program (multi-method method) 5192(defun tramp-get-telnet-program (multi-method method)
5113 (second (or (assoc 'tramp-telnet-program 5193 (second (or (assoc 'tramp-telnet-program
5114 (assoc (or multi-method method tramp-default-method) 5194 (assoc (or multi-method method tramp-default-method)
@@ -5123,6 +5203,34 @@ If the value is not set for the connection, return `default'"
5123 (error "Method `%s' didn't specify telnet args" 5203 (error "Method `%s' didn't specify telnet args"
5124 (or multi-method method))))) 5204 (or multi-method method)))))
5125 5205
5206;; (defun tramp-get-encoding-command (multi-method method)
5207;; (second (or (assoc 'tramp-encoding-command
5208;; (assoc (or multi-method method tramp-default-method)
5209;; tramp-methods))
5210;; (error "Method `%s' didn't specify an encoding command"
5211;; (or multi-method method)))))
5212
5213;; (defun tramp-get-decoding-command (multi-method method)
5214;; (second (or (assoc 'tramp-decoding-command
5215;; (assoc (or multi-method method tramp-default-method)
5216;; tramp-methods))
5217;; (error "Method `%s' didn't specify a decoding command"
5218;; (or multi-method method)))))
5219
5220;; (defun tramp-get-encoding-function (multi-method method)
5221;; (second (or (assoc 'tramp-encoding-function
5222;; (assoc (or multi-method method tramp-default-method)
5223;; tramp-methods))
5224;; (error "Method `%s' didn't specify an encoding function"
5225;; (or multi-method method)))))
5226
5227;; (defun tramp-get-decoding-function (multi-method method)
5228;; (second (or (assoc 'tramp-decoding-function
5229;; (assoc (or multi-method method tramp-default-method)
5230;; tramp-methods))
5231;; (error "Method `%s' didn't specify a decoding function"
5232;; (or multi-method method)))))
5233
5126;; Auto saving to a special directory. 5234;; Auto saving to a special directory.
5127 5235
5128(defun tramp-make-auto-save-file-name (fn) 5236(defun tramp-make-auto-save-file-name (fn)
@@ -5348,6 +5456,13 @@ Only works for Bourne-like shells."
5348 (setq ad-return-value (or res (list name))))))) 5456 (setq ad-return-value (or res (list name)))))))
5349;; ) 5457;; )
5350 5458
5459;; Tramp version is useful in a number of situations.
5460
5461(defun tramp-version (arg)
5462 "Print version number of tramp.el in minibuffer or current buffer."
5463 (interactive "P")
5464 (if arg (insert tramp-version) (message tramp-version)))
5465
5351;; Make the `reporter` functionality available for making bug reports about 5466;; Make the `reporter` functionality available for making bug reports about
5352;; the package. A most useful piece of code. 5467;; the package. A most useful piece of code.
5353 5468