Mercurial > emacs
comparison lisp/net/tramp.el @ 46752:54b975949d6a
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.
author | Kai Großjohann <kgrossjo@eu.uu.net> |
---|---|
date | Tue, 30 Jul 2002 20:24:27 +0000 |
parents | f548d7d0c651 |
children | c217aa0214e2 |
comparison
equal
deleted
inserted
replaced
46751:01bd8c67a47a | 46752:54b975949d6a |
---|---|
67 ;; | 67 ;; |
68 ;; Don't forget to put on your asbestos longjohns, first! | 68 ;; Don't forget to put on your asbestos longjohns, first! |
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 |
77 (require 'timer) | 78 (require 'timer) |
78 (require 'format-spec) ;from Gnus 5.8, also in tar ball | 79 (require 'format-spec) ;from Gnus 5.8, also in tar ball |
173 (tramp-rsh-args nil) | 174 (tramp-rsh-args nil) |
174 (tramp-rcp-args nil) | 175 (tramp-rcp-args nil) |
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) |
185 (tramp-rsh-program "ssh") | 182 (tramp-rsh-program "ssh") |
186 (tramp-rcp-program "scp") | 183 (tramp-rcp-program "scp") |
188 (tramp-rsh-args ("-e" "none")) | 185 (tramp-rsh-args ("-e" "none")) |
189 (tramp-rcp-args nil) | 186 (tramp-rcp-args nil) |
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) |
200 (tramp-rsh-program "ssh") | 193 (tramp-rsh-program "ssh") |
201 (tramp-rcp-program "scp") | 194 (tramp-rcp-program "scp") |
203 (tramp-rsh-args ("-1" "-e" "none")) | 196 (tramp-rsh-args ("-1" "-e" "none")) |
204 (tramp-rcp-args ("-1")) | 197 (tramp-rcp-args ("-1")) |
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) |
215 (tramp-rsh-program "ssh") | 204 (tramp-rsh-program "ssh") |
216 (tramp-rcp-program "scp") | 205 (tramp-rcp-program "scp") |
218 (tramp-rsh-args ("-2" "-e" "none")) | 207 (tramp-rsh-args ("-2" "-e" "none")) |
219 (tramp-rcp-args ("-2")) | 208 (tramp-rcp-args ("-2")) |
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") |
233 (tramp-rsh-args ("-e" "none")) | 219 (tramp-rsh-args ("-e" "none")) |
234 (tramp-rcp-args nil) | 220 (tramp-rcp-args nil) |
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") |
248 (tramp-rsh-args ("-e" "none")) | 231 (tramp-rsh-args ("-e" "none")) |
249 (tramp-rcp-args nil) | 232 (tramp-rcp-args nil) |
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) |
260 (tramp-rsh-program "ssh") | 239 (tramp-rsh-program "ssh") |
261 (tramp-rcp-program "rsync") | 240 (tramp-rcp-program "rsync") |
263 (tramp-rsh-args ("-e" "none")) | 242 (tramp-rsh-args ("-e" "none")) |
264 (tramp-rcp-args ("-e" "ssh")) | 243 (tramp-rcp-args ("-e" "ssh")) |
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") |
278 (tramp-rsh-args nil) | 253 (tramp-rsh-args nil) |
279 (tramp-rcp-args nil) | 254 (tramp-rcp-args nil) |
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") |
294 (tramp-rsh-args ("-e" "none")) | 264 (tramp-rsh-args ("-e" "none")) |
295 (tramp-rcp-args nil) | 265 (tramp-rcp-args nil) |
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") |
310 (tramp-rsh-args ("-1" "-e" "none")) | 275 (tramp-rsh-args ("-1" "-e" "none")) |
311 (tramp-rcp-args ("-1")) | 276 (tramp-rcp-args ("-1")) |
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") |
326 (tramp-rsh-args ("-2" "-e" "none")) | 286 (tramp-rsh-args ("-2" "-e" "none")) |
327 (tramp-rcp-args ("-2")) | 287 (tramp-rcp-args ("-2")) |
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") |
342 (tramp-rsh-args ("-e" "none")) | 298 (tramp-rsh-args ("-e" "none")) |
343 (tramp-rcp-args nil) | 299 (tramp-rcp-args nil) |
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") |
358 (tramp-rsh-args ("-e" "none")) | 310 (tramp-rsh-args ("-e" "none")) |
359 (tramp-rcp-args nil) | 311 (tramp-rcp-args nil) |
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) | 315 (tramp-telnet-program nil) |
369 (tramp-telnet-args nil)) | 316 (tramp-telnet-args nil)) |
370 ("rm" (tramp-connection-function tramp-open-connection-rsh) | 317 ("ssh1-old" |
371 (tramp-rsh-program "rsh") | 318 (tramp-connection-function tramp-open-connection-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) | |
443 (tramp-telnet-args nil)) | |
444 ("sm-ssh1" (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") |
448 (tramp-rsh-args ("-e" "none")) | 322 (tramp-rsh-args ("-e" "none")) |
449 (tramp-rcp-args nil) | 323 (tramp-rcp-args nil) |
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") |
463 (tramp-rsh-args ("-e" "none")) | 334 (tramp-rsh-args ("-e" "none")) |
464 (tramp-rcp-args nil) | 335 (tramp-rcp-args nil) |
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") |
478 (tramp-rsh-args nil) | 346 (tramp-rsh-args nil) |
479 (tramp-rcp-args nil) | 347 (tramp-rcp-args nil) |
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) | 354 (tramp-rsh-program nil) |
507 (tramp-rcp-program nil) | 355 (tramp-rcp-program nil) |
508 (tramp-remote-sh "/bin/sh") | 356 (tramp-remote-sh "/bin/sh") |
509 (tramp-rsh-args nil) | 357 (tramp-rsh-args nil) |
510 (tramp-rcp-args nil) | 358 (tramp-rcp-args nil) |
511 (tramp-rcp-keep-date-arg nil) | 359 (tramp-rcp-keep-date-arg nil) |
512 (tramp-su-program "su") | 360 (tramp-su-program "su") |
513 (tramp-su-args ("-" "%u")) | 361 (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) | 362 (tramp-telnet-program nil) |
519 (tramp-telnet-args nil)) | 363 (tramp-telnet-args nil)) |
520 ("suu" (tramp-connection-function tramp-open-connection-su) | 364 ("sudo" (tramp-connection-function tramp-open-connection-su) |
521 (tramp-rsh-program nil) | |
522 (tramp-rcp-program nil) | |
523 (tramp-remote-sh "/bin/sh") | |
524 (tramp-rsh-args nil) | |
525 (tramp-rcp-args nil) | |
526 (tramp-rcp-keep-date-arg nil) | |
527 (tramp-su-program "su") | |
528 (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) | 365 (tramp-rsh-program nil) |
538 (tramp-rcp-program nil) | 366 (tramp-rcp-program nil) |
539 (tramp-remote-sh "/bin/sh") | 367 (tramp-remote-sh "/bin/sh") |
540 (tramp-rsh-args nil) | 368 (tramp-rsh-args nil) |
541 (tramp-rcp-args nil) | 369 (tramp-rcp-args nil) |
542 (tramp-rcp-keep-date-arg nil) | 370 (tramp-rcp-keep-date-arg nil) |
543 (tramp-su-program "sudo") | 371 (tramp-su-program "sudo") |
544 (tramp-su-args ("-u" "%u" "-s")) | 372 (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) | |
550 (tramp-telnet-args nil)) | |
551 ("sudu" (tramp-connection-function tramp-open-connection-su) | |
552 (tramp-rsh-program nil) | |
553 (tramp-rcp-program nil) | |
554 (tramp-remote-sh "/bin/sh") | |
555 (tramp-rsh-args nil) | |
556 (tramp-rcp-args nil) | |
557 (tramp-rcp-keep-date-arg nil) | |
558 (tramp-su-program "sudo") | |
559 (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) |
568 (tramp-rsh-program nil) | 376 (tramp-rsh-program nil) |
569 (tramp-rcp-program nil) | 377 (tramp-rcp-program nil) |
571 (tramp-rsh-args nil) | 379 (tramp-rsh-args nil) |
572 (tramp-rcp-args nil) | 380 (tramp-rcp-args nil) |
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) |
599 (tramp-rsh-program "ssh") | 387 (tramp-rsh-program "ssh") |
600 (tramp-rcp-program "scp") | 388 (tramp-rcp-program "scp") |
601 (tramp-remote-sh "/bin/sh") | 389 (tramp-remote-sh "/bin/sh") |
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") |
615 (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) | 399 (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) |
616 (tramp-rcp-args nil) | 400 (tramp-rcp-args nil) |
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) |
630 (tramp-remote-sh "/bin/sh") | 410 (tramp-remote-sh "/bin/sh") |
631 (tramp-rsh-args ("-x")) | 411 (tramp-rsh-args ("-x")) |
632 (tramp-rcp-args nil) | 412 (tramp-rcp-args nil) |
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) |
646 (tramp-remote-sh "/bin/sh") | 422 (tramp-remote-sh "/bin/sh") |
647 (tramp-rsh-args ("-ssh")) ;optionally add "-v" | 423 (tramp-rsh-args ("-ssh")) ;optionally add "-v" |
648 (tramp-rcp-args nil) | 424 (tramp-rcp-args nil) |
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" |
676 (tramp-connection-function tramp-open-connection-rsh) | 431 (tramp-connection-function tramp-open-connection-rsh) |
677 (tramp-rsh-program "plink") | 432 (tramp-rsh-program "plink") |
680 (tramp-rsh-args ("-ssh")) | 435 (tramp-rsh-args ("-ssh")) |
681 (tramp-rcp-args nil) | 436 (tramp-rcp-args nil) |
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" |
692 (tramp-connection-function tramp-open-connection-rsh) | 443 (tramp-connection-function tramp-open-connection-rsh) |
693 (tramp-rsh-program "fsh") | 444 (tramp-rsh-program "fsh") |
696 (tramp-rsh-args ("sh" "-i")) | 447 (tramp-rsh-args ("sh" "-i")) |
697 (tramp-rcp-args nil) | 448 (tramp-rcp-args nil) |
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 ) |
708 "*Alist of methods for remote files. | 455 "*Alist of methods for remote files. |
709 This is a list of entries of the form (NAME PARAM1 PARAM2 ...). | 456 This is a list of entries of the form (NAME PARAM1 PARAM2 ...). |
942 tilde expansion, all directory names starting with `~' will be ignored." | 689 tilde expansion, all directory names starting with `~' will be ignored." |
943 :group 'tramp | 690 :group 'tramp |
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. |
949 The regexp should match the whole line." | 696 The 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. |
956 The regexp should match the whole line. | 703 The regexp should match at end of buffer. |
957 | 704 |
958 The `sudo' program appears to insert a `^@' character into the prompt." | 705 The `sudo' program appears to insert a `^@' character into the prompt." |
959 :group 'tramp | 706 :group 'tramp |
960 :type 'regexp) | 707 :type 'regexp) |
961 | 708 |
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. |
967 The regexp should match the whole line." | 714 The 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. | |
721 The confirmation should be done with yes or no. | |
722 The regexp should match at end of buffer." | |
968 :group 'tramp | 723 :group 'tramp |
969 :type 'regexp) | 724 :type 'regexp) |
970 | 725 |
971 (defcustom tramp-temp-name-prefix "tramp." | 726 (defcustom tramp-temp-name-prefix "tramp." |
972 "*Prefix to use for temporary files. | 727 "*Prefix to use for temporary files. |
997 :type '(alist :key-type string :value-type string)) | 752 :type '(alist :key-type string :value-type string)) |
998 | 753 |
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 |
1006 2 4 5 6) | 761 2 4 5 6) |
1007 "Default value for `tramp-file-name-structure' for unified remoting. | 762 "Default value for `tramp-file-name-structure' for unified remoting. |
1008 On Emacs (not XEmacs), the Tramp and Ange-FTP packages use a unified | 763 On Emacs (not XEmacs), the Tramp and Ange-FTP packages use a unified |
1009 filename space. This value is used for this unified namespace.") | 764 filename 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 |
1016 2 4 5 6) | 771 2 4 5 6) |
1017 "Default value for `tramp-file-name-structure' for separate remoting. | 772 "Default value for `tramp-file-name-structure' for separate remoting. |
1279 case-sensitive. Relying on Lisp only means that case-insensitive | 1034 case-sensitive. Relying on Lisp only means that case-insensitive |
1280 completion is possible (subject to the variable `completion-ignore-case'), | 1035 completion is possible (subject to the variable `completion-ignore-case'), |
1281 but it might be slow on large directories." | 1036 but it might be slow on large directories." |
1282 :group 'tramp | 1037 :group 'tramp |
1283 :type 'boolean) | 1038 :type 'boolean) |
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. | |
1047 Whenever a pattern matches, the corresponding action is performed. | |
1048 Each item looks like (PATTERN ACTION). | |
1049 | |
1050 The PATTERN should be a symbol, a variable. The value of this | |
1051 variable gives the regular expression to search for. Note that the | |
1052 regexp must match at the end of the buffer, \"\\'\" is implicitly | |
1053 appended to it. | |
1054 | |
1055 The ACTION should also be a symbol, but a function. When the | |
1056 corresponding 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. | |
1066 This list is used for each hop in multi-hop connections. | |
1067 See `tramp-actions-before-shell' for more info." | |
1068 :group 'tramp | |
1069 :type '(repeat (list variable function))) | |
1284 | 1070 |
1285 ;;; Internal Variables: | 1071 ;;; Internal Variables: |
1286 | 1072 |
1287 (defvar tramp-buffer-file-attributes nil | 1073 (defvar tramp-buffer-file-attributes nil |
1288 "Holds the `ls -ild' output for the current buffer. | 1074 "Holds the `ls -ild' output for the current buffer. |
1411 $s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff, $s[0] >> 16 & 0xffff, $s[0] & 0xffff);" | 1197 $s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff, $s[0] >> 16 & 0xffff, $s[0] & 0xffff);" |
1412 ) | 1198 ) |
1413 "Perl script to produce output suitable for use with `file-attributes' | 1199 "Perl script to produce output suitable for use with `file-attributes' |
1414 on the remote file system.") | 1200 on 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 | 1226 Escape 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] | 1231 Escape 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. |
1464 (defconst tramp-file-mode-type-map '((0 . "-") ; Normal file (SVID-v2 and XPG2) | 1235 (defconst tramp-file-mode-type-map '((0 . "-") ; Normal file (SVID-v2 and XPG2) |
1465 (1 . "p") ; fifo | 1236 (1 . "p") ; fifo |
1484 (funcall 'coding-system-p '(dos))) | 1255 (funcall 'coding-system-p '(dos))) |
1485 'dos | 1256 'dos |
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. | |
1262 This 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, |
1492 ;; file-name-directory, file-name-nondirectory, | 1267 ;; file-name-directory, file-name-nondirectory, |
1493 ;; file-name-sans-versions, get-file-buffer. | 1268 ;; file-name-sans-versions, get-file-buffer. |
1534 . tramp-handle-dired-recursive-delete-directory) | 1309 . tramp-handle-dired-recursive-delete-directory) |
1535 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime) | 1310 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime) |
1536 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)) | 1311 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)) |
1537 "Alist of handler functions. | 1312 "Alist of handler functions. |
1538 Operations not mentioned here will be handled by the normal Emacs functions.") | 1313 Operations not mentioned here will be handled by the normal Emacs functions.") |
1539 | |
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 | 1314 |
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) |
1550 "Emit a message depending on verbosity level. | 1318 "Emit a message depending on verbosity level. |
1831 ;; Daniel Pittman <daniel@danann.net> | 1599 ;; Daniel Pittman <daniel@danann.net> |
1832 (defun tramp-handle-file-attributes (filename &optional nonnumeric) | 1600 (defun tramp-handle-file-attributes (filename &optional nonnumeric) |
1833 "Like `file-attributes' for tramp files. | 1601 "Like `file-attributes' for tramp files. |
1834 Optional argument NONNUMERIC means return user and group name | 1602 Optional argument NONNUMERIC means return user and group name |
1835 rather than as numbers." | 1603 rather 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 |
1851 (multi-method method user host path &optional nonnumeric) | 1622 (multi-method method user host path &optional nonnumeric) |
1852 "Implement `file-attributes' for tramp files using the ls(1) command." | 1623 "Implement `file-attributes' for tramp files using the ls(1) command." |
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" |
1859 (tramp-get-ls-command multi-method method user host) | 1634 (tramp-get-ls-command multi-method method user host) |
1860 (if nonnumeric "-ild" "-ildn") | 1635 (if nonnumeric "-ild" "-ildn") |
1932 (multi-method method user host path &optional nonnumeric) | 1707 (multi-method method user host path &optional nonnumeric) |
1933 "Implement `file-attributes' for tramp files using a Perl script. | 1708 "Implement `file-attributes' for tramp files using a Perl script. |
1934 | 1709 |
1935 The Perl command is sent to the remote machine when the connection | 1710 The Perl command is sent to the remote machine when the connection |
1936 is initially created and is kept cached by the remote shell." | 1711 is 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" |
1940 (tramp-shell-quote-argument path))) | 1719 (tramp-shell-quote-argument path))) |
1941 (tramp-wait-for-output) | 1720 (tramp-wait-for-output) |
2202 (substring directory 0 directory-length-1) | 1981 (substring directory 0 directory-length-1) |
2203 directory))))) | 1982 directory))))) |
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 |
2216 multi-method method user host | 1996 multi-method method user host |
2217 (concat "cd " (tramp-shell-quote-argument path)) | 1997 (concat "cd " (tramp-shell-quote-argument path)) |
2233 (push (concat (file-name-as-directory directory) | 2013 (push (concat (file-name-as-directory directory) |
2234 x) | 2014 x) |
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 |
2242 ;; files. We use `ls -ad' to get a list of files (including | 2041 ;; files. We use `ls -ad' to get a list of files (including |
2243 ;; directories), and `find . -type d \! -name . -prune' to get a list | 2042 ;; directories), and `find . -type d \! -name . -prune' to get a list |
2492 (buffer-name))))) | 2291 (buffer-name))))) |
2493 | 2292 |
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)) |
2500 (tramp-barf-unless-okay | 2300 (tramp-barf-unless-okay |
2501 multi-method method user host | 2301 multi-method method user host |
2506 "Couldn't make directory %s" dir))) | 2306 "Couldn't make directory %s" dir))) |
2507 | 2307 |
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)) |
2514 (save-excursion | 2315 (save-excursion |
2515 (tramp-send-command | 2316 (tramp-send-command |
2518 (tramp-shell-quote-argument path))) | 2319 (tramp-shell-quote-argument path))) |
2519 (tramp-wait-for-output)))) | 2320 (tramp-wait-for-output)))) |
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)) |
2526 (save-excursion | 2328 (save-excursion |
2527 (unless (zerop (tramp-send-command-and-check | 2329 (unless (zerop (tramp-send-command-and-check |
2599 ;; `dired-insert-set-properties'. | 2401 ;; `dired-insert-set-properties'. |
2600 | 2402 |
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 |
2607 filename switches wildcard full-directory-p)) | 2410 filename switches wildcard full-directory-p)) |
2608 (tramp-message-for-buffer | 2411 (tramp-message-for-buffer |
2752 | 2555 |
2753 (defun tramp-handle-shell-command (command &optional output-buffer error-buffer) | 2556 (defun tramp-handle-shell-command (command &optional output-buffer error-buffer) |
2754 "Like `shell-command' for tramp files. | 2557 "Like `shell-command' for tramp files. |
2755 This will break if COMMAND prints a newline, followed by the value of | 2558 This 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'" |
2808 default-directory) | 2611 default-directory) |
2809 (tramp-run-real-handler 'shell-command | 2612 (tramp-run-real-handler 'shell-command |
2826 (unless (file-exists-p filename) | 2629 (unless (file-exists-p filename) |
2827 (error "Cannot make local copy of non-existing file `%s'" | 2630 (error "Cannot make local copy of non-existing file `%s'" |
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) |
2835 (save-excursion (set-buffer trampbuf) (erase-buffer)) | 2638 (save-excursion (set-buffer trampbuf) (erase-buffer)) |
2836 (unless (equal | 2639 (unless (equal |
2850 "see buffer `%s' for details") | 2653 "see buffer `%s' for details") |
2851 (tramp-get-rcp-program multi-method method) trampbuf)) | 2654 (tramp-get-rcp-program multi-method method) trampbuf)) |
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, |
2860 ;; tramp-current-user, tramp-current-host. | 2663 ;; tramp-current-user, tramp-current-host. |
2861 (set-buffer (tramp-get-buffer multi-method method user host)) | 2664 (set-buffer (tramp-get-buffer multi-method method user host)) |
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" |
2869 (tramp-get-buffer multi-method method user host)) | 2672 (tramp-get-buffer multi-method method user host)) |
2870 ;; Remove trailing status code | 2673 ;; Remove trailing status code |
2871 (goto-char (point-max)) | 2674 (goto-char (point-max)) |
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*"))) |
2881 (set-buffer tmpbuf) | 2684 (set-buffer tmpbuf) |
2882 (erase-buffer) | 2685 (erase-buffer) |
2884 user host)) | 2687 user host)) |
2885 (tramp-message-for-buffer | 2688 (tramp-message-for-buffer |
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)) |
2897 (kill-buffer tmpbuf)) | 2700 (kill-buffer tmpbuf)) |
2898 ;; If tramp-decoding-function is not defined for this | 2701 ;; If tramp-decoding-function is not defined for this |
2900 (let ((tmpfil2 (tramp-make-temp-file))) | 2703 (let ((tmpfil2 (tramp-make-temp-file))) |
2901 (write-region (point-min) (point-max) tmpfil2) | 2704 (write-region (point-min) (point-max) tmpfil2) |
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 |
2916 multi-method method user host | 2719 multi-method method user host |
2917 5 "Decoding remote file %s...done" filename))) | 2720 5 "Decoding remote file %s...done" filename))) |
2988 (tramp-invoke-ange-ftp 'write-region | 2791 (tramp-invoke-ange-ftp 'write-region |
2989 start end filename append visit lockname confirm)) | 2792 start end filename append visit lockname confirm)) |
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, |
3000 ;; we set `last-coding-system-used' to this saved value. | 2805 ;; we set `last-coding-system-used' to this saved value. |
3001 ;; This way, any intermediary coding systems used while | 2806 ;; This way, any intermediary coding systems used while |
3251 (cons jka (delete jka file-name-handler-alist)))))) | 3056 (cons jka (delete jka file-name-handler-alist)))))) |
3252 (tramp-repair-jka-compr) | 3057 (tramp-repair-jka-compr) |
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) |
3259 (nth 2 tramp-file-name-structure) | 3065 (nth 2 tramp-file-name-structure) |
3260 (nth 4 tramp-file-name-structure)))) | 3066 (nth 4 tramp-file-name-structure)))) |
3648 | 3454 |
3649 ;; ------------------------------------------------------------ | 3455 ;; ------------------------------------------------------------ |
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. |
3656 ACTIONS is a list of items (REGEXP FUN), where REGEXP specifies what | 3462 |
3657 output from the remote end to look for, and FUN specifies the action | 3463 (defun tramp-action-login (p multi-method method user host) |
3658 to 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. |
3663 This starts the command `telnet HOST ARGS'[*], then waits for a remote | 3601 This starts the command `telnet HOST ARGS'[*], then waits for a remote |
3664 login prompt, then sends the user name USER, then waits for a remote | 3602 login prompt, then sends the user name USER, then waits for a remote |
3700 host | 3638 host |
3701 (tramp-get-telnet-args multi-method method))) | 3639 (tramp-get-telnet-args multi-method method))) |
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. |
3745 This starts the command `rsh HOST -l USER'[*], then waits for a remote | 3689 This starts the command `rsh HOST -l USER'[*], then waits for a remote |
3746 password or shell prompt. If a password prompt is seen, the user is | 3690 password or shell prompt. If a password prompt is seen, the user is |
3747 queried for a password, this function sends the password to the remote | 3691 queried for a password, this function sends the password to the remote |
3792 host "-l" user rsh-args) | 3736 host "-l" user rsh-args) |
3793 (apply #'start-process bufnam buf rsh-program | 3737 (apply #'start-process bufnam buf rsh-program |
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. |
3840 This starts `su - USER', then waits for a password prompt. The HOST | 3789 This starts `su - USER', then waits for a password prompt. The HOST |
3841 name must be equal to the local host name or to `localhost'. | 3790 name must be equal to the local host name or to `localhost'. |
3842 | 3791 |
3866 (let* ((default-directory (tramp-temporary-file-directory)) | 3815 (let* ((default-directory (tramp-temporary-file-directory)) |
3867 (coding-system-for-read (unless (and (not (featurep 'xemacs)) | 3816 (coding-system-for-read (unless (and (not (featurep 'xemacs)) |
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 |
3913 user host))))) | 3865 user host))))) |
3914 | 3866 |
3988 the host name, and `%n' is replaced with an end of line character, as | 3940 the host name, and `%n' is replaced with an end of line character, as |
3989 set in `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent | 3941 set in `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent |
3990 character. | 3942 character. |
3991 | 3943 |
3992 If USER is nil, uses the return value of (user-login-name) instead." | 3944 If 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: |
4032 ;; changed `user' to `(or user (user-login-name))' in the places where | 3989 ;; changed `user' to `(or user (user-login-name))' in the places where |
4033 ;; the value is actually used. | 3990 ;; the value is actually used. |
4038 with the user name, `%h' will be replaced with the host name, and `%n' | 3995 with the user name, `%h' will be replaced with the host name, and `%n' |
4039 will be replaced with the value of `tramp-rsh-end-of-line'. You can use | 3996 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 |
4042 If USER is nil, uses the return value of (user-login-name) instead." | 3999 If 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: |
4082 ;; changed `user' to `(or user (user-login-name))' in the places where | 4042 ;; changed `user' to `(or user (user-login-name))' in the places where |
4083 ;; the value is actually used. | 4043 ;; the value is actually used. |
4091 | 4051 |
4092 You can use percent escapes in the COMMAND. `%u' is replaced with the | 4052 You can use percent escapes in the COMMAND. `%u' is replaced with the |
4093 user name, and `%n' is replaced with the value of | 4053 user 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 |
4095 character." | 4055 character." |
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 |
4133 (defun tramp-wait-for-regexp (proc timeout regexp) | 4096 (defun tramp-wait-for-regexp (proc timeout regexp) |
4134 "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds. | 4097 "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds. |
4174 | 4137 |
4175 (defun tramp-enter-password (p prompt) | 4138 (defun tramp-enter-password (p prompt) |
4176 "Prompt for a password and send it to the remote end. | 4139 "Prompt for a password and send it to the remote end. |
4177 Uses PROMPT as a prompt and sends the password to process P." | 4140 Uses 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 |
4182 ;; given in the "File name" very poorly. Then, the local | 4146 ;; given in the "File name" very poorly. Then, the local |
4183 ;; variable tramp-current user will be set to nil. | 4147 ;; variable tramp-current user will be set to nil. |
4433 (concat "tramp_file_attributes () {\n" | 4397 (concat "tramp_file_attributes () {\n" |
4434 tramp-remote-perl | 4398 tramp-remote-perl |
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 |
4467 "ln" tramp-remote-path nil))) | 4421 "ln" tramp-remote-path nil))) |
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) |
4479 (error | 4436 (error |
4480 "Must give both decoding and encoding command in method definition")) | 4437 "Must give both decoding and encoding command in method definition")) |
4493 (buffer-name))) | 4450 (buffer-name))) |
4494 (erase-buffer) | 4451 (erase-buffer) |
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. | |
4473 Each item is a list (ENCODING-COMMAND DECODING-COMMAND | |
4474 ENCODING-FUNCTION DECODING-FUNCTION). | |
4475 | |
4476 Each item can be a string, giving a command, or a symbol, giving | |
4477 a function. | |
4478 | |
4479 The ENCODING-COMMAND should be a command accepting a plain file on | |
4480 standard input and writing the encoded file to standard output. The | |
4481 DECODING-COMMAND should be a command accepting an encoded file on | |
4482 standard input and writing the decoded file to standard output. | |
4483 | |
4484 The ENCODING-FUNCTION and DECODING-FUNCTION functions will be called | |
4485 with two arguments, start and end of region, and are expected to | |
4486 replace the region contents with the encoded or decoded results, | |
4487 respectively.") | |
4488 | |
4489 (defun tramp-find-inline-encoding (multi-method method user host) | |
4490 "Find an inline transfer encoding that works. | |
4491 Goes 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. |
4501 Does not do anything if a connection is already open, but re-opens the | 4566 Does not do anything if a connection is already open, but re-opens the |
4502 connection if a previous connection has died for some reason." | 4567 connection 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) |
4510 multi-method method user host)))) | 4590 multi-method method user host)))) |
4511 | 4591 |
4513 (multi-method method user host command &optional noerase) | 4593 (multi-method method user host command &optional noerase) |
4514 "Send the COMMAND to USER at HOST (logged in using METHOD). | 4594 "Send the COMMAND to USER at HOST (logged in using METHOD). |
4515 Erases temporary buffer before sending the command (unless NOERASE | 4595 Erases temporary buffer before sending the command (unless NOERASE |
4516 is true)." | 4596 is 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)) |
4521 (goto-char (point-max)) | 4602 (goto-char (point-max)) |
4522 (tramp-insert-with-face 'bold (format "$ %s\n" command)))) | 4603 (tramp-insert-with-face 'bold (format "$ %s\n" command)))) |
4925 (error "`tramp-make-tramp-file-format' is nil")) | 5006 (error "`tramp-make-tramp-file-format' is nil")) |
4926 (if multi-method | 5007 (if multi-method |
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? |
4936 (defun tramp-make-tramp-multi-file-name (multi-method method user host path) | 5017 (defun tramp-make-tramp-multi-file-name (multi-method method user host path) |
4937 "Constructs a tramp file name for a multi-hop method." | 5018 "Constructs a tramp file name for a multi-hop method." |
4938 (unless tramp-make-multi-tramp-file-format | 5019 (unless tramp-make-multi-tramp-file-format |
4939 (error "`tramp-make-multi-tramp-file-format' is nil")) | 5020 (error "`tramp-make-multi-tramp-file-format' is nil")) |
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 |
4955 (defun tramp-make-rcp-program-file-name (user host path) | 5036 (defun tramp-make-rcp-program-file-name (user host path) |
4956 "Create a file name suitable to be passed to `rcp'." | 5037 "Create a file name suitable to be passed to `rcp'." |
4995 | 5076 |
4996 (defun tramp-get-remote-ln (multi-method method user host) | 5077 (defun tramp-get-remote-ln (multi-method method user host) |
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. |
5002 If the value is not set for the connection, return `default'" | 5084 If 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) |
5004 (with-current-buffer (tramp-get-buffer multi-method method user host) | 5086 (with-current-buffer (tramp-get-buffer multi-method method user host) |
5005 (let (error) | 5087 (let (error) |
5006 (condition-case nil | 5088 (condition-case nil |
5007 (symbol-value (intern (concat "tramp-connection-property-" property))) | 5089 (symbol-value (intern (concat "tramp-connection-property-" property))) |
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) |
5015 (set (make-local-variable | 5098 (set (make-local-variable |
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) |
5022 (second (or (assoc 'tramp-connection-function | 5130 (second (or (assoc 'tramp-connection-function |
5023 (assoc (or multi-method method tramp-default-method) | 5131 (assoc (or multi-method method tramp-default-method) |
5079 (assoc (or multi-method method tramp-default-method) | 5187 (assoc (or multi-method method tramp-default-method) |
5080 tramp-methods)) | 5188 tramp-methods)) |
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) |
5115 tramp-methods)) | 5195 tramp-methods)) |
5116 (error "Method `%s' didn't specify a telnet program" | 5196 (error "Method `%s' didn't specify a telnet program" |
5120 (second (or (assoc 'tramp-telnet-args | 5200 (second (or (assoc 'tramp-telnet-args |
5121 (assoc (or multi-method method tramp-default-method) | 5201 (assoc (or multi-method method tramp-default-method) |
5122 tramp-methods)) | 5202 tramp-methods)) |
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))))) |
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))))) | |
5125 | 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) |
5129 "Returns a file name in `tramp-auto-save-directory' for autosaving this file." | 5237 "Returns a file name in `tramp-auto-save-directory' for autosaving this file." |
5345 (setq ad-return-value (list name)))) | 5453 (setq ad-return-value (list name)))) |
5346 ;; If it is not a Tramp file, just run the original function. | 5454 ;; If it is not a Tramp file, just run the original function. |
5347 (let ((res ad-do-it)) | 5455 (let ((res ad-do-it)) |
5348 (setq ad-return-value (or res (list name))))))) | 5456 (setq ad-return-value (or res (list name))))))) |
5349 ;; ) | 5457 ;; ) |
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))) | |
5350 | 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 |
5354 (unless (fboundp 'reporter-submit-bug-report) | 5469 (unless (fboundp 'reporter-submit-bug-report) |