annotate lisp/net/tramp.el @ 46567:3dea67668bb0

*** empty log message ***
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 19 Jul 2002 21:26:14 +0000
parents 3996ea20e5e3
children f548d7d0c651
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*-
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5 ;; Author: Kai.Grossjohann@CS.Uni-Dortmund.DE
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6 ;; Keywords: comm, processes
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
9
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
13 ;; any later version.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
14
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
18 ;; GNU General Public License for more details.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
19
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
24
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
25 ;;; Commentary:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
26
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
27 ;; This package provides remote file editing, similar to ange-ftp.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
28 ;; The difference is that ange-ftp uses FTP to transfer files between
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
29 ;; the local and the remote host, whereas tramp.el uses a combination
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
30 ;; of rsh and rcp or other work-alike programs, such as ssh/scp.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
31 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
32 ;; For more detailed instructions, please see the info file, which is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
33 ;; included in the file `tramp.tar.gz' mentioned below.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
34 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
35 ;; Notes:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
36 ;; -----
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
37 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
38 ;; This package only works for Emacs 20 and higher, and for XEmacs 21
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
39 ;; and higher. (XEmacs 20 is missing the `with-timeout' macro. Emacs
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
40 ;; 19 is reported to have other problems. For XEmacs 21, you need the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
41 ;; package `fsf-compat' for the `with-timeout' macro.)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
42 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
43 ;; This version might not work with pre-Emacs 21 VC unless VC is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
44 ;; loaded before tramp.el. Could you please test this and tell me about
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
45 ;; the result? Thanks.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
46 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
47 ;; Also see the todo list at the bottom of this file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
48 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
49 ;; The current version of tramp.el can be retrieved from the following
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
50 ;; URL: ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
51 ;; For your convenience, the *.el file is available separately from
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
52 ;; the same directory.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
53 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
54 ;; There's a mailing list for this, as well. Its name is:
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
55 ;; tramp-devel@mail.freesoftware.fsf.org
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
56 ;; Send a mail with `help' in the subject (!) to the administration
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
57 ;; address for instructions on joining the list. The administration
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
58 ;; address is:
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
59 ;; tramp-devel-request@mail.freesoftware.fsf.org
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
60 ;; You can also use the Web to subscribe, under the following URL:
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
61 ;; http://mail.freesoftware.fsf.org/mailman/listinfo/tramp-devel
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
62 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
63 ;; For the adventurous, the current development sources are available
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
64 ;; via CVS. You can find instructions about this at the following URL:
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
65 ;; http://savannah.gnu.org/projects/tramp/
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
66 ;; Click on "CVS" in the navigation bar near the top.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
67 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
68 ;; Don't forget to put on your asbestos longjohns, first!
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
69
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
70 ;;; Code:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
71
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
72 (defconst tramp-version "2.0.1"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
73 "This version of tramp.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
74 (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
75 "Email address to send bug reports to.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
76
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
77 (require 'timer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
78 (require 'format-spec) ;from Gnus 5.8, also in tar ball
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
79 (require 'base64) ;for the mimencode methods
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
80 (require 'shell)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
81 (require 'advice)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
82
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
83 ;; ;; It does not work to load EFS after loading TRAMP.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
84 ;; (when (fboundp 'efs-file-handler-function)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
85 ;; (require 'efs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
86
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
87 (eval-when-compile
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
88 (require 'cl)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
89 (require 'custom)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
90 ;; Emacs 19.34 compatibility hack -- is this needed?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
91 (or (>= emacs-major-version 20)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
92 (load "cl-seq")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
93
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
94 (unless (boundp 'custom-print-functions)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
95 (defvar custom-print-functions nil)) ; not autoloaded before Emacs 20.4
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
96
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
97 ;;; User Customizable Internal Variables:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
98
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
99 (defgroup tramp nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
100 "Edit remote files with a combination of rsh and rcp or similar programs."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
101 :group 'files)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
102
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
103 (defcustom tramp-verbose 10
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
104 "*Verbosity level for tramp.el. 0 means be silent, 10 is most verbose."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
105 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
106 :type 'integer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
107
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
108 (defcustom tramp-debug-buffer nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
109 "*Whether to send all commands and responses to a debug buffer."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
110 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
111 :type 'boolean)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
112
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
113 (defcustom tramp-auto-save-directory nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
114 "*Put auto-save files in this directory, if set.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
115 The idea is to use a local directory so that auto-saving is faster."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
116 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
117 :type '(choice (const nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
118 string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
119
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
120 (defcustom tramp-sh-program "/bin/sh"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
121 "*Use this program for shell commands on the local host.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
122 This MUST be a Bourne-like shell. This shell is used to execute
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
123 the encoding and decoding command on the local host, so if you
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
124 want to use `~' in those commands, you should choose a shell here
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
125 which groks tilde expansion. `/bin/sh' normally does not
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
126 understand tilde expansion.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
127
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
128 Note that this variable is not used for remote commands. There are
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
129 mechanisms in tramp.el which automatically determine the right shell to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
130 use for the remote host."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
131 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
132 :type '(file :must-match t))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
133
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
134 ;; CCC I have changed all occurrences of comint-quote-filename with
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
135 ;; tramp-shell-quote-argument, except in tramp-handle-expand-many-files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
136 ;; There, comint-quote-filename was removed altogether. If it turns
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
137 ;; out to be necessary there, something will need to be done.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
138 ;;-(defcustom tramp-file-name-quote-list
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
139 ;;- '(?] ?[ ?\| ?& ?< ?> ?\( ?\) ?\; ?\ ?\* ?\? ?\! ?\" ?\' ?\` ?# ?\@ ?\+ )
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
140 ;;- "*Protect these characters from the remote shell.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
141 ;;-Any character in this list is quoted (preceded with a backslash)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
142 ;;-because it means something special to the shell. This takes effect
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
143 ;;-when sending file and directory names to the remote shell.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
144 ;;-
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
145 ;;-See `comint-file-name-quote-list' for details."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
146 ;;- :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
147 ;;- :type '(repeat character))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
148
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
149 (defcustom tramp-methods
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
150 '( ("rcp" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
151 (tramp-rsh-program "rsh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
152 (tramp-rcp-program "rcp")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
153 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
154 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
155 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
156 (tramp-rcp-keep-date-arg "-p")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
157 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
158 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
159 (tramp-encoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
160 (tramp-decoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
161 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
162 (tramp-decoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
163 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
164 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
165 ("scp" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
166 (tramp-rsh-program "ssh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
167 (tramp-rcp-program "scp")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
168 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
169 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
170 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
171 (tramp-rcp-keep-date-arg "-p")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
172 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
173 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
174 (tramp-encoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
175 (tramp-decoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
176 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
177 (tramp-decoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
178 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
179 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
180 ("scp1" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
181 (tramp-rsh-program "ssh1")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
182 (tramp-rcp-program "scp1")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
183 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
184 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
185 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
186 (tramp-rcp-keep-date-arg "-p")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
187 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
188 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
189 (tramp-encoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
190 (tramp-decoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
191 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
192 (tramp-decoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
193 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
194 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
195 ("scp2" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
196 (tramp-rsh-program "ssh2")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
197 (tramp-rcp-program "scp2")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
198 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
199 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
200 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
201 (tramp-rcp-keep-date-arg "-p")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
202 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
203 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
204 (tramp-encoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
205 (tramp-decoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
206 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
207 (tramp-decoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
208 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
209 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
210 ("rsync" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
211 (tramp-rsh-program "ssh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
212 (tramp-rcp-program "rsync")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
213 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
214 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
215 (tramp-rcp-args ("-e" "ssh"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
216 (tramp-rcp-keep-date-arg "-t")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
217 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
218 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
219 (tramp-encoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
220 (tramp-decoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
221 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
222 (tramp-decoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
223 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
224 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
225 ("ru" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
226 (tramp-rsh-program "rsh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
227 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
228 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
229 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
230 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
231 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
232 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
233 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
234 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
235 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
236 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
237 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
238 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
239 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
240 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
241 ("su" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
242 (tramp-rsh-program "ssh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
243 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
244 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
245 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
246 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
247 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
248 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
249 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
250 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
251 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
252 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
253 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
254 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
255 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
256 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
257 ("su1" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
258 (tramp-rsh-program "ssh1")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
259 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
260 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
261 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
262 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
263 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
264 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
265 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
266 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
267 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
268 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
269 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
270 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
271 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
272 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
273 ("su2" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
274 (tramp-rsh-program "ssh2")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
275 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
276 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
277 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
278 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
279 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
280 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
281 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
282 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
283 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
284 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
285 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
286 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
287 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
288 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
289 ("rm" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
290 (tramp-rsh-program "rsh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
291 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
292 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
293 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
294 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
295 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
296 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
297 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
298 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
299 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
300 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
301 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
302 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
303 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
304 ("sm" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
305 (tramp-rsh-program "ssh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
306 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
307 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
308 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
309 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
310 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
311 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
312 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
313 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
314 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
315 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
316 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
317 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
318 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
319 ("smp" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
320 (tramp-rsh-program "ssh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
321 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
322 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
323 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
324 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
325 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
326 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
327 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
328 (tramp-encoding-command "tramp_mimencode")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
329 (tramp-decoding-command "tramp_mimedecode")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
330 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
331 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
332 (tramp-telnet-program nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
333 ("sm1" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
334 (tramp-rsh-program "ssh1")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
335 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
336 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
337 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
338 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
339 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
340 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
341 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
342 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
343 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
344 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
345 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
346 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
347 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
348 ("sm2" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
349 (tramp-rsh-program "ssh2")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
350 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
351 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
352 (tramp-rsh-args ("-e" "none"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
353 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
354 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
355 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
356 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
357 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
358 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
359 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
360 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
361 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
362 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
363 ("tm" (tramp-connection-function tramp-open-connection-telnet)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
364 (tramp-rsh-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
365 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
366 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
367 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
368 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
369 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
370 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
371 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
372 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
373 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
374 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
375 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
376 (tramp-telnet-program "telnet")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
377 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
378 ("tu" (tramp-connection-function tramp-open-connection-telnet)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
379 (tramp-rsh-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
380 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
381 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
382 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
383 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
384 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
385 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
386 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
387 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
388 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
389 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
390 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
391 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
392 (tramp-telnet-program "telnet")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
393 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
394 ("sum" (tramp-connection-function tramp-open-connection-su)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
395 (tramp-rsh-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
396 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
397 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
398 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
399 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
400 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
401 (tramp-su-program "su")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
402 (tramp-su-args ("-" "%u"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
403 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
404 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
405 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
406 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
407 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
408 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
409 ("suu" (tramp-connection-function tramp-open-connection-su)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
410 (tramp-rsh-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
411 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
412 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
413 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
414 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
415 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
416 (tramp-su-program "su")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
417 (tramp-su-args ("-" "%u"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
418 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
419 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
420 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
421 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
422 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
423 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
424 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
425 ("sudm" (tramp-connection-function tramp-open-connection-su)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
426 (tramp-rsh-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
427 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
428 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
429 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
430 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
431 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
432 (tramp-su-program "sudo")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
433 (tramp-su-args ("-u" "%u" "-s"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
434 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
435 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
436 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
437 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
438 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
439 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
440 ("sudu" (tramp-connection-function tramp-open-connection-su)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
441 (tramp-rsh-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
442 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
443 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
444 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
445 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
446 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
447 (tramp-su-program "sudo")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
448 (tramp-su-args ("-u" "%u" "-s"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
449 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
450 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
451 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
452 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
453 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
454 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
455 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
456 ("multi" (tramp-connection-function tramp-open-connection-multi)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
457 (tramp-rsh-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
458 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
459 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
460 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
461 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
462 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
463 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
464 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
465 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
466 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
467 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
468 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
469 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
470 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
471 ("multiu" (tramp-connection-function tramp-open-connection-multi)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
472 (tramp-rsh-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
473 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
474 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
475 (tramp-rsh-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
476 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
477 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
478 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
479 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
480 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
481 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
482 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
483 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
484 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
485 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
486 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
487 ("scpx" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
488 (tramp-rsh-program "ssh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
489 (tramp-rcp-program "scp")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
490 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
491 (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
492 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
493 (tramp-rcp-keep-date-arg "-p")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
494 (tramp-encoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
495 (tramp-decoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
496 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
497 (tramp-decoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
498 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
499 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
500 ("smx" (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
501 (tramp-rsh-program "ssh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
502 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
503 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
504 (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
505 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
506 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
507 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
508 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
509 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
510 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
511 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
512 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
513 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
514 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
515 ("km"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
516 (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
517 (tramp-rsh-program "krlogin")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
518 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
519 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
520 (tramp-rsh-args ("-x"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
521 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
522 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
523 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
524 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
525 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
526 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
527 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
528 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
529 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
530 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
531 ("plinku"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
532 (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
533 (tramp-rsh-program "plink")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
534 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
535 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
536 (tramp-rsh-args ("-ssh")) ;optionally add "-v"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
537 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
538 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
539 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
540 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
541 (tramp-encoding-command "uuencode xxx")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
542 (tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
543 "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
544 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
545 (tramp-decoding-function uudecode-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
546 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
547 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
548 ("plinkm"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
549 (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
550 (tramp-rsh-program "plink")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
551 (tramp-rcp-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
552 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
553 (tramp-rsh-args ("-ssh")) ;optionally add "-v"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
554 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
555 (tramp-rcp-keep-date-arg nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
556 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
557 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
558 (tramp-encoding-command "mimencode -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
559 (tramp-decoding-command "mimencode -u -b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
560 (tramp-encoding-function base64-encode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
561 (tramp-decoding-function base64-decode-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
562 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
563 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
564 ("pscp"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
565 (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
566 (tramp-rsh-program "plink")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
567 (tramp-rcp-program "pscp")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
568 (tramp-remote-sh "/bin/sh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
569 (tramp-rsh-args ("-ssh"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
570 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
571 (tramp-rcp-keep-date-arg "-p")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
572 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
573 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
574 (tramp-encoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
575 (tramp-decoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
576 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
577 (tramp-decoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
578 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
579 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
580 ("fcp"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
581 (tramp-connection-function tramp-open-connection-rsh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
582 (tramp-rsh-program "fsh")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
583 (tramp-rcp-program "fcp")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
584 (tramp-remote-sh "/bin/sh -i")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
585 (tramp-rsh-args ("sh" "-i"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
586 (tramp-rcp-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
587 (tramp-rcp-keep-date-arg "-p")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
588 (tramp-su-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
589 (tramp-su-args nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
590 (tramp-encoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
591 (tramp-decoding-command nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
592 (tramp-encoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
593 (tramp-decoding-function nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
594 (tramp-telnet-program nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
595 (tramp-telnet-args nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
596 )
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
597 "*Alist of methods for remote files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
598 This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
599 Each NAME stands for a remote access method. Each PARAM is a
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
600 pair of the form (KEY VALUE). The following KEYs are defined:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
601 * `tramp-connection-function'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
602 This specifies the function to use to connect to the remote host.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
603 Currently, `tramp-open-connection-rsh', `tramp-open-connection-telnet'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
604 and `tramp-open-connection-su' are defined. See the documentation
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
605 of these functions for more details.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
606 * `tramp-remote-sh'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
607 This specifies the Bourne shell to use on the remote host. This
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
608 MUST be a Bourne-like shell. It is normally not necessary to set
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
609 this to any value other than \"/bin/sh\": tramp wants to use a shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
610 which groks tilde expansion, but it can search for it. Also note
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
611 that \"/bin/sh\" exists on all Unixen, this might not be true for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
612 the value that you decide to use. You Have Been Warned.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
613 * `tramp-rsh-program'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
614 This specifies the name of the program to use for rsh; this might be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
615 the full path to rsh or the name of a workalike program.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
616 * `tramp-rsh-args'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
617 This specifies the list of arguments to pass to the above
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
618 mentioned program. Please note that this is a list of arguments,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
619 that is, normally you don't want to put \"-a -b\" or \"-f foo\"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
620 here. Instead, you want two list elements, one for \"-a\" and one
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
621 for \"-b\", or one for \"-f\" and one for \"foo\".
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
622 * `tramp-rcp-program'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
623 This specifies the name of the program to use for rcp; this might be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
624 the full path to rcp or the name of a workalike program.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
625 * `tramp-rcp-args'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
626 This specifies the list of parameters to pass to the above mentioned
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
627 program, the hints for `tramp-rsh-args' also apply here.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
628 * `tramp-rcp-keep-date-arg'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
629 This specifies the parameter to use for `rcp' when the timestamp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
630 of the original file should be kept. For `rcp', use `-p', for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
631 `rsync', use `-t'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
632 * `tramp-su-program'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
633 This specifies the name of the program to use for `su'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
634 * `tramp-su-args'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
635 This specifies the list of arguments to pass to `su'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
636 \"%u\" is replaced by the user name, use \"%%\" for a literal
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
637 percent character.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
638 * `tramp-encoding-command'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
639 This specifies a command to use to encode the file contents for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
640 transfer. The command should read the raw file contents from
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
641 standard input and write the encoded file contents to standard
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
642 output. In this string, the percent escape \"%f\" should be used
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
643 to indicate the file to convert. Use \"%%\" if you need a literal
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
644 percent character in your command.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
645 * `tramp-decoding-command'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
646 This specifies a command to use to decode file contents encoded
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
647 with `tramp-encoding-command'. The command should read from standard
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
648 input and write to standard output.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
649 * `tramp-encoding-function'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
650 This specifies a function to be called to encode the file contents
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
651 on the local side. This function should accept two arguments
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
652 START and END, the beginning and end of the region to encode. The
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
653 region should be replaced with the encoded contents.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
654 * `tramp-decoding-function'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
655 Same for decoding on the local side.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
656 * `tramp-telnet-program'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
657 Specifies the telnet program to use when using
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
658 `tramp-open-connection-telnet' to log in.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
659 * `tramp-telnet-args'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
660 Specifies list of arguments to pass to `telnet'. The hints for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
661 `tramp-rsh-args' also apply here.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
662
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
663 What does all this mean? Well, you should specify `tramp-rsh-program',
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
664 `tramp-telnet-program' or `tramp-su-program' for all methods; this program
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
665 is used to log in to the remote site. Then, there are two ways to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
666 actually transfer the files between the local and the remote side.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
667 One way is using an additional rcp-like program. If you want to do
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
668 this, set `tramp-rcp-program' in the method.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
669
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
670 Another possibility for file transfer is inline transfer, i.e. the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
671 file is passed through the same buffer used by `tramp-rsh-program'. In
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
672 this case, the file contents need to be protected since the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
673 `tramp-rsh-program' might use escape codes or the connection might not
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
674 be eight-bit clean. Therefore, file contents are encoded for transit.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
675
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
676 Two possibilities for encoding are uuencode/uudecode and mimencode.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
677 For uuencode/uudecode you want to set `tramp-encoding-command' to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
678 something like \"uuencode\" and `tramp-decoding-command' to \"uudecode
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
679 -p\". For mimencode you want to set `tramp-encoding-command' to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
680 something like \"mimencode -b\" and `tramp-decoding-command' to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
681 \"mimencode -b -u\".
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
682
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
683 When using inline transfer, you can use a program or a Lisp function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
684 on the local side to encode or decode the file contents. Set the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
685 `tramp-encoding-function' and `tramp-decoding-function' parameters to nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
686 in order to use the commands or to the function to use. It is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
687 possible to specify one function and the other parameter as nil.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
688
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
689 So, to summarize: if the method is an inline method, you must specify
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
690 `tramp-encoding-command' and `tramp-decoding-command', and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
691 `tramp-rcp-program' must be nil. If the method is out of band, then
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
692 you must specify `tramp-rcp-program' and `tramp-rcp-args' and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
693 `tramp-encoding-command' and `tramp-decoding-command' must be nil.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
694 Every method, inline or out of band, must specify
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
695 `tramp-connection-function' plus the associated arguments (for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
696 example, the telnet program if you chose
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
697 `tramp-open-connection-telnet').
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
698
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
699 Notes:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
700
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
701 When using `tramp-open-connection-su' the phrase `open connection to a
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
702 remote host' sounds strange, but it is used nevertheless, for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
703 consistency. No connection is opened to a remote host, but `su' is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
704 started on the local host. You are not allowed to specify a remote
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
705 host other than `localhost' or the name of the local host.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
706
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
707 Using a uuencode/uudecode inline method is discouraged, please use one
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
708 of the base64 methods instead since base64 encoding is much more
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
709 reliable and the commands are more standardized between the different
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
710 Unix versions. But if you can't use base64 for some reason, please
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
711 note that the default uudecode command does not work well for some
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
712 Unices, in particular AIX and Irix. For AIX, you might want to use
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
713 the following command for uudecode:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
714
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
715 sed '/^begin/d;/^[` ]$/d;/^end/d' | iconv -f uucode -t ISO8859-1
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
716
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
717 For Irix, no solution is known yet."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
718 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
719 :type '(repeat
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
720 (cons string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
721 (set (list (const tramp-connection-function) function)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
722 (list (const tramp-rsh-program)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
723 (choice (const nil) string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
724 (list (const tramp-rcp-program)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
725 (choice (const nil) string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
726 (list (const tramp-remote-sh)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
727 (choice (const nil) string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
728 (list (const tramp-rsh-args) (repeat string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
729 (list (const tramp-rcp-args) (repeat string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
730 (list (const tramp-rcp-keep-date-arg)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
731 (choice (const nil) string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
732 (list (const tramp-su-program)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
733 (choice (const nil) string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
734 (list (const tramp-su-args) (repeat string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
735 (list (const tramp-encoding-command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
736 (choice (const nil) string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
737 (list (const tramp-decoding-command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
738 (choice (const nil) string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
739 (list (const tramp-encoding-function)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
740 (choice (const nil) function))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
741 (list (const tramp-decoding-function)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
742 (choice (const nil) function))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
743 (list (const tramp-telnet-program)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
744 (choice (const nil) string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
745 (list (const tramp-telnet-args) (repeat string))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
746
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
747 (defcustom tramp-multi-methods '("multi" "multiu")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
748 "*List of multi-hop methods.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
749 Each entry in this list should be a method name as mentioned in the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
750 variable `tramp-methods'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
751 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
752 :type '(repeat string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
753
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
754 (defcustom tramp-multi-connection-function-alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
755 '(("telnet" tramp-multi-connect-telnet "telnet %h%n")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
756 ("rsh" tramp-multi-connect-rlogin "rsh %h -l %u%n")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
757 ("ssh" tramp-multi-connect-rlogin "ssh %h -l %u%n")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
758 ("su" tramp-multi-connect-su "su - %u%n")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
759 ("sudo" tramp-multi-connect-su "sudo -u %u -s%n"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
760 "*List of connection functions for multi-hop methods.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
761 Each list item is a list of three items (METHOD FUNCTION COMMAND),
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
762 where METHOD is the name as used in the file name, FUNCTION is the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
763 function to be executed, and COMMAND is the shell command used for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
764 connecting.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
765
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
766 COMMAND may contain percent escapes. `%u' will be replaced with the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
767 user name, `%h' will be replaced with the host name, and `%n' will be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
768 replaced with an end-of-line character, as specified in the variable
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
769 `tramp-rsh-end-of-line'. Use `%%' for a literal percent character.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
770 Note that the interpretation of the percent escapes also depends on
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
771 the FUNCTION. For example, the `%u' escape is forbidden with the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
772 function `tramp-multi-connect-telnet'. See the documentation of the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
773 various functions for details."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
774 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
775 :type '(repeat (list string function string)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
776
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
777 (defcustom tramp-default-method "sm"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
778 ;;(if (featurep 'xemacs) "sm" "ftp")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
779 "*Default method to use for transferring files.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
780 See `tramp-methods' for possibilities.
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
781 Also see `tramp-default-method-alist'.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
782
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
783 Emacs uses a unified filename syntax for Tramp and Ange-FTP.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
784 For backward compatibility, the default value of this variable
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
785 is \"ftp\" on Emacs. But XEmacs uses a separate filename syntax
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
786 for Tramp and EFS, so there the default method is \"sm\"."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
787 :group 'tramp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
788 :type 'string)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
789
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
790 (defcustom tramp-default-method-alist
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
791 (if (featurep 'xemacs)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
792 nil
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
793 '(("\\`ftp\\." "" "ftp")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
794 ("" "\\`\\(anonymous\\|ftp\\)\\'" "ftp")))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
795 "*Default method to use for specific user/host pairs.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
796 This is an alist of items (HOST USER METHOD). The first matching item
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
797 specifies the method to use for a file name which does not specify a
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
798 method. HOST and USER are regular expressions or nil, which is
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
799 interpreted as a regular expression which always matches. If no entry
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
800 matches, the variable `tramp-default-method' takes effect.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
801
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
802 If the file name does not specify the user, lookup is done using the
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
803 empty string for the user name.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
804
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
805 See `tramp-methods' for a list of possibilities for METHOD."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
806 :group 'tramp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
807 :type '(repeat (list (regexp :tag "Host regexp")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
808 (regexp :tag "User regexp")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
809 (string :tag "Method"))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
810
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
811 (defcustom tramp-ftp-method "ftp"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
812 "*When this method name is used, forward all calls to Ange-FTP."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
813 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
814 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
815
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
816 (defcustom tramp-rsh-end-of-line "\n"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
817 "*String used for end of line in rsh connections.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
818 I don't think this ever needs to be changed, so please tell me about it
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
819 if you need to change this."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
820 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
821 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
822
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
823 (defcustom tramp-remote-path
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
824 '("/bin" "/usr/bin" "/usr/sbin" "/usr/local/bin" "/usr/ccs/bin"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
825 "/local/bin" "/local/freeware/bin" "/local/gnu/bin"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
826 "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
827 "*List of directories to search for executables on remote host.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
828 Please notify me about other semi-standard directories to include here.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
829
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
830 You can use `~' in this list, but when searching for a shell which groks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
831 tilde expansion, all directory names starting with `~' will be ignored."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
832 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
833 :type '(repeat string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
834
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
835 (defcustom tramp-login-prompt-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
836 ".*ogin: *$"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
837 "*Regexp matching login-like prompts.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
838 The regexp should match the whole line."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
839 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
840 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
841
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
842 (defcustom tramp-password-prompt-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
843 "^.*\\([pP]assword\\|passphrase.*\\):\^@? *$"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
844 "*Regexp matching password-like prompts.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
845 The regexp should match the whole line.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
846
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
847 The `sudo' program appears to insert a `^@' character into the prompt."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
848 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
849 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
850
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
851 (defcustom tramp-wrong-passwd-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
852 (concat "^.*\\(Permission denied.\\|Login [Ii]ncorrect\\|"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
853 "Received signal [0-9]+\\|Connection \\(refused\\|closed\\)\\|"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
854 "Sorry, try again.\\|Name or service not known\\).*$")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
855 "*Regexp matching a `login failed' message.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
856 The regexp should match the whole line."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
857 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
858 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
859
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
860 (defcustom tramp-temp-name-prefix "tramp."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
861 "*Prefix to use for temporary files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
862 If this is a relative file name (such as \"tramp.\"), it is considered
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
863 relative to the directory name returned by the function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
864 `tramp-temporary-file-directory' (which see). It may also be an
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
865 absolute file name; don't forget to include a prefix for the filename
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
866 part, though."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
867 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
868 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
869
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
870 (defcustom tramp-discard-garbage nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
871 "*If non-nil, try to discard garbage sent by remote shell.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
872 Some shells send such garbage upon connection setup."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
873 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
874 :type 'boolean)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
875
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
876 (defcustom tramp-sh-extra-args '(("/bash\\'" . "--norc"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
877 "*Alist specifying extra arguments to pass to the remote shell.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
878 Entries are (REGEXP . ARGS) where REGEXP is a regular expression
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
879 matching the shell file name and ARGS is a string specifying the
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
880 arguments.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
881
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
882 This variable is only used when Tramp needs to start up another shell
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
883 for tilde expansion. The extra arguments should typically prevent the
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
884 shell from reading its init file."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
885 :group 'tramp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
886 :type '(alist :key-type string :value-type string))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
887
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
888 ;; File name format.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
889
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
890 (defconst tramp-file-name-structure-unified
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
891 (list (concat "\\`/\\(\\([a-zA-Z0-9]+\\):\\)?" ;method
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
892 "\\(\\([^:@/]+\\)@\\)?" ;user
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
893 "\\([^:/]+\\):" ;host
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
894 "\\(.*\\)\\'") ;path
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
895 2 4 5 6)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
896 "Default value for `tramp-file-name-structure' for unified remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
897 On Emacs (not XEmacs), the Tramp and Ange-FTP packages use a unified
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
898 filename space. This value is used for this unified namespace.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
899
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
900 (defconst tramp-file-name-structure-separate
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
901 (list (concat "\\`/\\[\\(\\([a-zA-Z0-9]+\\)/\\)?" ;method
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
902 "\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
903 "\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
904 "\\(.*\\)\\'") ;path
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
905 2 4 5 6)
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
906 "Default value for `tramp-file-name-structure' for separate remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
907 On XEmacs, the Tramp and EFS packages use a separate namespace for
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
908 remote filenames. This value is used in that case. It is designed
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
909 not to clash with the EFS filename syntax.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
910
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
911 (defcustom tramp-file-name-structure
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
912 (if (featurep 'xemacs)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
913 tramp-file-name-structure-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
914 tramp-file-name-structure-unified)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
915 "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
916 the tramp file name structure.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
917
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
918 The first element REGEXP is a regular expression matching a tramp file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
919 name. The regex should contain parentheses around the method name,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
920 the user name, the host name, and the file name parts.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
921
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
922 The second element METHOD is a number, saying which pair of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
923 parentheses matches the method name. The third element USER is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
924 similar, but for the user name. The fourth element HOST is similar,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
925 but for the host name. The fifth element FILE is for the file name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
926 These numbers are passed directly to `match-string', which see. That
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
927 means the opening parentheses are counted to identify the pair.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
928
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
929 See also `tramp-file-name-regexp' and `tramp-make-tramp-file-format'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
930 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
931 :type '(list (regexp :tag "File name regexp")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
932 (integer :tag "Paren pair for method name")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
933 (integer :tag "Paren pair for user name ")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
934 (integer :tag "Paren pair for host name ")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
935 (integer :tag "Paren pair for file name ")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
936
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
937 ;;;###autoload
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
938 (defconst tramp-file-name-regexp-unified
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
939 "\\`/[^/:]+:"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
940 "Value for `tramp-file-name-regexp' for unified remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
941 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
942 Tramp. See `tramp-file-name-structure-unified' for more explanations.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
943
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
944 ;;;###autoload
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
945 (defconst tramp-file-name-regexp-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
946 "\\`/\\[.*\\]"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
947 "Value for `tramp-file-name-regexp' for separate remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
948 XEmacs uses a separate filename syntax for Tramp and EFS.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
949 See `tramp-file-name-structure-separate' for more explanations.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
950
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
951 ;;;###autoload
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
952 (defcustom tramp-file-name-regexp
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
953 (if (featurep 'xemacs)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
954 tramp-file-name-regexp-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
955 tramp-file-name-regexp-unified)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
956 "*Regular expression matching file names handled by tramp.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
957 This regexp should match tramp file names but no other file names.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
958 \(When tramp.el is loaded, this regular expression is prepended to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
959 `file-name-handler-alist', and that is searched sequentially. Thus,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
960 if the tramp entry appears rather early in the `file-name-handler-alist'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
961 and is a bit too general, then some files might be considered tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
962 files which are not really tramp files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
963
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
964 Please note that the entry in `file-name-handler-alist' is made when
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
965 this file (tramp.el) is loaded. This means that this variable must be set
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
966 before loading tramp.el. Alternatively, `file-name-handler-alist' can be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
967 updated after changing this variable.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
968
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
969 Also see `tramp-file-name-structure' and `tramp-make-tramp-file-format'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
970 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
971 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
972
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
973 (defconst tramp-make-tramp-file-format-unified
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
974 "/%m:%u@%h:%p"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
975 "Value for `tramp-make-tramp-file-format' for unified remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
976 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
977 See `tramp-file-name-structure-unified' for more details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
978
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
979 (defconst tramp-make-tramp-file-format-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
980 "/[%m/%u@%h]%p"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
981 "Value for `tramp-make-tramp-file-format' for separate remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
982 XEmacs uses a separate filename syntax for EFS and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
983 See `tramp-file-name-structure-separate' for more details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
984
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
985 (defcustom tramp-make-tramp-file-format
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
986 (if (featurep 'xemacs)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
987 tramp-make-tramp-file-format-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
988 tramp-make-tramp-file-format-unified)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
989 "*Format string saying how to construct tramp file name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
990 `%m' is replaced by the method name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
991 `%u' is replaced by the user name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
992 `%h' is replaced by the host name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
993 `%p' is replaced by the file name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
994 `%%' is replaced by %.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
995
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
996 Also see `tramp-file-name-structure' and `tramp-file-name-regexp'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
997 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
998 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
999
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1000 (defconst tramp-make-tramp-file-user-nil-format-unified
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1001 "/%m:%h:%p"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1002 "Value of `tramp-make-tramp-file-user-nil-format' for unified remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1003 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1004 See `tramp-file-name-structure-unified' for details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1005
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1006 (defconst tramp-make-tramp-file-user-nil-format-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1007 "/[%m/%h]%p"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1008 "Value of `tramp-make-tramp-file-user-nil-format' for separate remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1009 XEmacs uses a separate filename syntax for EFS and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1010 See `tramp-file-name-structure-separate' for details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1011
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1012 (defcustom tramp-make-tramp-file-user-nil-format
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1013 (if (featurep 'xemacs)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1014 tramp-make-tramp-file-user-nil-format-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1015 tramp-make-tramp-file-user-nil-format-unified)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1016 "*Format string saying how to construct tramp file name when the user name is not known.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1017 `%m' is replaced by the method name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1018 `%h' is replaced by the host name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1019 `%p' is replaced by the file name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1020 `%%' is replaced by %.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1021
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1022 Also see `tramp-make-tramp-file-format', `tramp-file-name-structure', and `tramp-file-name-regexp'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1023 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1024 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1025
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1026 (defconst tramp-multi-file-name-structure-unified
46347
3996ea20e5e3 (tramp-multi-file-name-structure-unified): Add
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46307
diff changeset
1027 (list (concat "\\`/\\(\\([a-zA-Z0-9]+\\)?:\\)" ;method
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1028 "\\(\\(%s\\)+\\)" ;hops
46347
3996ea20e5e3 (tramp-multi-file-name-structure-unified): Add
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46307
diff changeset
1029 "\\(.*\\)\\'") ;path
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1030 2 3 -1)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1031 "Value for `tramp-multi-file-name-structure' for unified remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1032 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1033 See `tramp-file-name-structure-unified' for details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1034
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1035 (defconst tramp-file-name-structure-separate
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1036 (list (concat
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1037 ;; prefix
46347
3996ea20e5e3 (tramp-multi-file-name-structure-unified): Add
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46307
diff changeset
1038 "\\`/\\[\\(\\([a-z0-9]+\\)?\\)"
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
1039 ;; regexp specifying the hops
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1040 "\\(\\(%s\\)+\\)"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1041 ;; path name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1042 "\\]\\(.*\\)\\'")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1043 2 ;number of pair to match method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1044 3 ;number of pair to match hops
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1045 -1) ;number of pair to match path
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1046 "Value of `tramp-multi-file-name-structure' for separate remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1047 XEmacs uses a separate filename syntax for EFS and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1048 See `tramp-file-name-structure-separate' for details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1049
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1050 (defcustom tramp-multi-file-name-structure
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1051 (if (featurep 'xemacs)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1052 tramp-multi-file-name-structure-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1053 tramp-multi-file-name-structure-unified)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1054 "*Describes the file name structure of `multi' files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1055 Multi files allow you to contact a remote host in several hops.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1056 This is a list of four elements (REGEXP METHOD HOP PATH).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1057
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1058 The first element, REGEXP, gives a regular expression to match against
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1059 the file name. In this regular expression, `%s' is replaced with the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1060 value of `tramp-multi-file-name-hop-structure'. (Note: in order to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1061 allow multiple hops, you normally want to use something like
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1062 \"\\\\(\\\\(%s\\\\)+\\\\)\" in the regular expression. The outer pair
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1063 of parentheses is used for the HOP element, see below.)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1064
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1065 All remaining elements are numbers. METHOD gives the number of the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1066 paren pair which matches the method name. HOP gives the number of the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1067 paren pair which matches the hop sequence. PATH gives the number of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1068 the paren pair which matches the path name on the remote host.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1069
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1070 PATH can also be negative, which means to count from the end. Ie, a
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1071 value of -1 means the last paren pair.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1072
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1073 I think it would be good if the regexp matches the whole of the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1074 string, but I haven't actually tried what happens if it doesn't..."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1075 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1076 :type '(list (regexp :tag "File name regexp")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1077 (integer :tag "Paren pair for method name")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1078 (integer :tag "Paren pair for hops")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1079 (integer :tag "Paren pair to match path")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1080
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1081 (defconst tramp-multi-file-name-hop-structure-unified
46347
3996ea20e5e3 (tramp-multi-file-name-structure-unified): Add
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46307
diff changeset
1082 (list (concat "\\([a-zA-z0-9_]+\\):" ;hop method
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1083 "\\([^@:/]+\\)@" ;user
46347
3996ea20e5e3 (tramp-multi-file-name-structure-unified): Add
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46307
diff changeset
1084 "\\([^:/]+\\):") ;host
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1085 1 2 3)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1086 "Value of `tramp-multi-file-name-hop-structure' for unified remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1087 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1088 See `tramp-file-name-structure-unified' for details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1089
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1090 (defconst tramp-multi-file-name-hop-structure-separate
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
1091 (list (concat "/\\([a-z0-9_]+\\):" ;hop method
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
1092 "\\([a-z0-9_]+\\)@" ;user
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
1093 "\\([a-z0-9.-]+\\)") ;host
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1094 1 2 3)
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1095 "Value of `tramp-multi-file-name-hop-structure' for separate remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1096 XEmacs uses a separate filename syntax for EFS and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1097 See `tramp-file-name-structure-separate' for details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1098
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1099 (defcustom tramp-multi-file-name-hop-structure
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1100 (if (featurep 'xemacs)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1101 tramp-multi-file-name-hop-structure-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1102 tramp-multi-file-name-hop-structure-unified)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1103 "*Describes the structure of a hop in multi files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1104 This is a list of four elements (REGEXP METHOD USER HOST). First
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1105 element REGEXP is used to match against the hop. Pair number METHOD
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1106 matches the method of one hop, pair number USER matches the user of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1107 one hop, pair number HOST matches the host of one hop.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1108
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1109 This regular expression should match exactly all of one hop."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1110 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1111 :type '(list (regexp :tag "Hop regexp")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1112 (integer :tag "Paren pair for method name")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1113 (integer :tag "Paren pair for user name")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1114 (integer :tag "Paren pair for host name")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1115
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1116 (defconst tramp-make-multi-tramp-file-format-unified
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1117 (list "/%m" ":%m:%u@%h" ":%p")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1118 "Value of `tramp-make-multi-tramp-file-format' for unified remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1119 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1120 See `tramp-file-name-structure-unified' for details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1121
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1122 (defconst tramp-make-multi-tramp-file-format-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1123 (list "/[%m" "/%m:%u@%h" "]%p")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1124 "Value of `tramp-make-multi-tramp-file-format' for separate remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1125 XEmacs uses a separate filename syntax for EFS and Tramp.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1126 See `tramp-file-name-structure-separate' for details.")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1127
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1128 (defcustom tramp-make-multi-tramp-file-format
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1129 (if (featurep 'xemacs)
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1130 tramp-make-multi-tramp-file-format-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1131 tramp-make-multi-tramp-file-format-unified)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1132 "*Describes how to construct a `multi' file name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1133 This is a list of three elements PREFIX, HOP and PATH.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1134
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1135 The first element PREFIX says how to construct the prefix, the second
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1136 element HOP specifies what each hop looks like, and the final element
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1137 PATH says how to construct the path name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1138
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1139 In PREFIX, `%%' means `%' and `%m' means the method name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1140
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1141 In HOP, `%%' means `%' and `%m', `%u', `%h' mean the hop method, hop
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1142 user and hop host, respectively.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1143
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1144 In PATH, `%%' means `%' and `%p' means the path name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1145
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1146 The resulting file name always contains one copy of PREFIX and one
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1147 copy of PATH, but there is one copy of HOP for each hop in the file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1148 name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1149
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1150 Note: the current implementation requires the prefix to contain the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1151 method name, followed by all the hops, and the path name must come
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1152 last."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1153 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1154 :type '(list string string string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1155
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1156 (defcustom tramp-terminal-type "dumb"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1157 "*Value of TERM environment variable for logging in to remote host.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1158 Because Tramp wants to parse the output of the remote shell, it is easily
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1159 confused by ANSI color escape sequences and suchlike. Often, shell init
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1160 files conditionalize this setup based on the TERM environment variable."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1161 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1162 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1163
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1164 (defcustom tramp-completion-without-shell-p nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1165 "*If nil, use shell wildcards for completion, else rely on Lisp only.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1166 Using shell wildcards for completions has the advantage that it can be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1167 fast even in large directories, but completion is always
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1168 case-sensitive. Relying on Lisp only means that case-insensitive
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1169 completion is possible (subject to the variable `completion-ignore-case'),
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1170 but it might be slow on large directories."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1171 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1172 :type 'boolean)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1173
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1174 ;;; Internal Variables:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1175
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1176 (defvar tramp-buffer-file-attributes nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1177 "Holds the `ls -ild' output for the current buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1178 This variable is local to each buffer. It is not used if the remote
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1179 machine groks Perl. If it is used, it's used as an emulation for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1180 the visited file modtime.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1181 (make-variable-buffer-local 'tramp-buffer-file-attributes)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1182
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1183 (defvar tramp-end-of-output "/////"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1184 "String used to recognize end of output.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1185
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1186 (defvar tramp-connection-function nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1187 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1188 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1189 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1190
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1191 (defvar tramp-remote-sh nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1192 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1193 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1194 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1195
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1196 (defvar tramp-rsh-program nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1197 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1198 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1199 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1200
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1201 (defvar tramp-rsh-args nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1202 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1203 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1204 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1205
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1206 (defvar tramp-rcp-program nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1207 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1208 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1209 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1210
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1211 (defvar tramp-rcp-args nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1212 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1213 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1214 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1215
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1216 (defvar tramp-rcp-keep-date-arg nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1217 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1218 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1219 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1220
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1221 (defvar tramp-encoding-command nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1222 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1223 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1224 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1225
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1226 (defvar tramp-decoding-command nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1227 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1228 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1229 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1230
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1231 (defvar tramp-encoding-function nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1232 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1233 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1234 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1235
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1236 (defvar tramp-decoding-function nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1237 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1238 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1239 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1240
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1241 (defvar tramp-telnet-program nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1242 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1243 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1244 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1245
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1246 (defvar tramp-telnet-args nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1247 "This internal variable holds a parameter for `tramp-methods'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1248 In the connection buffer, this variable has the value of the like-named
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1249 method parameter, as specified in `tramp-methods' (which see).")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1250
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1251 ;; CCC `local in each buffer'?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1252 (defvar tramp-ls-command nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1253 "This command is used to get a long listing with numeric user and group ids.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1254 This variable is automatically made buffer-local to each rsh process buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1255 upon opening the connection.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1256
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1257 (defvar tramp-current-multi-method nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1258 "Name of `multi' connection method for this *tramp* buffer, or nil if not multi.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1259 This variable is automatically made buffer-local to each rsh process buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1260 upon opening the connection.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1261
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1262 (defvar tramp-current-method nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1263 "Connection method for this *tramp* buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1264 This variable is automatically made buffer-local to each rsh process buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1265 upon opening the connection.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1266
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1267 (defvar tramp-current-user nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1268 "Remote login name for this *tramp* buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1269 This variable is automatically made buffer-local to each rsh process buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1270 upon opening the connection.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1271
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1272 (defvar tramp-current-host nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1273 "Remote host for this *tramp* buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1274 This variable is automatically made buffer-local to each rsh process buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1275 upon opening the connection.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1276
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1277 (defvar tramp-test-groks-nt nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1278 "Whether the `test' command groks the `-nt' switch.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1279 \(`test A -nt B' tests if file A is newer than file B.)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1280 This variable is automatically made buffer-local to each rsh process buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1281 upon opening the connection.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1282
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1283 (defvar tramp-file-exists-command nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1284 "Command to use for checking if a file exists.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1285 This variable is automatically made buffer-local to each rsh process buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1286 upon opening the connection.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1287
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1288 ;; Perl script to implement `file-attributes' in a Lisp `read'able output.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1289 ;; If you are hacking on this, note that you get *no* output unless this
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1290 ;; spits out a complete line, including the '\n' at the end.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1291 (defconst tramp-perl-file-attributes (concat
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1292 "$f = $ARGV[0];
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1293 @s = lstat($f);
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1294 if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; }
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1295 elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; }
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1296 else { $l = \"nil\" };
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1297 printf(\"(%s %u %u %u (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) (%u %u))\\n\",
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1298 $l, $s[3], $s[4], $s[5], $s[8] >> 16 & 0xffff, $s[8] & 0xffff,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1299 $s[9] >> 16 & 0xffff, $s[9] & 0xffff, $s[10] >> 16 & 0xffff, $s[10] & 0xffff,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1300 $s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff, $s[0] >> 16 & 0xffff, $s[0] & 0xffff);"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1301 )
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1302 "Perl script to produce output suitable for use with `file-attributes'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1303 on the remote file system.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1304
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1305 ;; Perl script to implement `mime-encode'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1306 (defvar tramp-perl-mime-encode (concat
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1307 "sub encode_base64 ($);
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1308 my $buf;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1309 while(read(STDIN, $buf, 60*57)) { print encode_base64($buf) }
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1310 sub encode_base64 ($) {
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1311 my $res = \"\";
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1312 my $eol = \"\n\";
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1313 pos($_[0]) = 0; # ensure start at the beginning
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1314 while ($_[0] =~ /(.{1,45})/gs) {
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1315 $res .= substr(pack(\"u\", $1), 1);
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1316 chop($res);
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1317 }
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1318 $res =~ tr|` -_|AA-Za-z0-9+/|; # `# help emacs
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1319 # fix padding at the end
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1320 my $padding = (3 - length($_[0]) % 3) % 3;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1321 $res =~ s/.{$padding}$/\"=\" x $padding/e if $padding;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1322 # break encoded string into lines of no more than 76 characters each
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1323 if (length $eol) {
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1324 $res =~ s/(.{1,76})/$1$eol/g;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1325 }
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1326 $res;}"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1327
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1328 ;; Perl script to implement `mime-decode'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1329 (defvar tramp-perl-mime-decode (concat
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1330 "sub decode_base64 ($);
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1331 my $buf;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1332 while(read(STDIN, $buf, 60*57)) { print decode_base64($buf) }
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1333 sub decode_base64 ($) {
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1334 local($^W) = 0; # unpack(\"u\",...) gives bogus warning in 5.00[123]
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1335
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1336 my $str = shift;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1337 my $res = \"\";
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1338
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1339 $str =~ tr|A-Za-z0-9+=/||cd; # remove non-base64 chars
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1340 if (length($str) % 4) {
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1341 warn(\"Length of base64 data not a multiple of 4\")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1342 }
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1343 $str =~ s/=+$//; # remove padding
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1344 $str =~ tr|A-Za-z0-9+/| -_|; # convert to uuencoded format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1345 while ($str =~ /(.{1,60})/gs) {
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1346 my $len = chr(32 + length($1)*3/4); # compute length byte
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1347 $res .= unpack(\"u\", $len . $1 ); # uudecode
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1348 }
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1349 $res;}"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1350
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1351 ; These values conform to `file-attributes' from XEmacs 21.2.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1352 ; GNU Emacs and other tools not checked.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1353 (defconst tramp-file-mode-type-map '((0 . "-") ; Normal file (SVID-v2 and XPG2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1354 (1 . "p") ; fifo
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1355 (2 . "c") ; character device
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1356 (3 . "m") ; multiplexed character device (v7)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1357 (4 . "d") ; directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1358 (5 . "?") ; Named special file (XENIX)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1359 (6 . "b") ; block device
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1360 (7 . "?") ; multiplexed block device (v7)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1361 (8 . "-") ; regular file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1362 (9 . "n") ; network special file (HP-UX)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1363 (10 . "l") ; symlink
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1364 (11 . "?") ; ACL shadow inode (Solaris, not userspace)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1365 (12 . "s") ; socket
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1366 (13 . "D") ; door special (Solaris)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1367 (14 . "w")) ; whiteout (BSD)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1368 "A list of file types returned from the `stat' system call.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1369 This is used to map a mode number to a permission string.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1370
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1371 (defvar tramp-dos-coding-system
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1372 (if (and (fboundp 'coding-system-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1373 (funcall 'coding-system-p '(dos)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1374 'dos
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1375 'undecided-dos)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1376 "Some Emacsen know the `dos' coding system, others need `undecided-dos'.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1377
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1378
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1379 ;; New handlers should be added here. The following operations can be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1380 ;; handled using the normal primitives: file-name-as-directory,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1381 ;; file-name-directory, file-name-nondirectory,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1382 ;; file-name-sans-versions, get-file-buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1383 (defconst tramp-file-name-handler-alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1384 '(
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1385 (load . tramp-handle-load)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1386 (make-symbolic-link . tramp-handle-make-symbolic-link)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1387 (file-name-directory . tramp-handle-file-name-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1388 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1389 (file-truename . tramp-handle-file-truename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1390 (file-exists-p . tramp-handle-file-exists-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1391 (file-directory-p . tramp-handle-file-directory-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1392 (file-executable-p . tramp-handle-file-executable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1393 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1394 (file-readable-p . tramp-handle-file-readable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1395 (file-regular-p . tramp-handle-file-regular-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1396 (file-symlink-p . tramp-handle-file-symlink-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1397 (file-writable-p . tramp-handle-file-writable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1398 (file-ownership-preserved-p . tramp-handle-file-ownership-preserved-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1399 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1400 (file-attributes . tramp-handle-file-attributes)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1401 (file-modes . tramp-handle-file-modes)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1402 (file-directory-files . tramp-handle-file-directory-files)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1403 (directory-files . tramp-handle-directory-files)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1404 (file-name-all-completions . tramp-handle-file-name-all-completions)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1405 (file-name-completion . tramp-handle-file-name-completion)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1406 (add-name-to-file . tramp-handle-add-name-to-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1407 (copy-file . tramp-handle-copy-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1408 (rename-file . tramp-handle-rename-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1409 (set-file-modes . tramp-handle-set-file-modes)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1410 (make-directory . tramp-handle-make-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1411 (delete-directory . tramp-handle-delete-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1412 (delete-file . tramp-handle-delete-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1413 (directory-file-name . tramp-handle-directory-file-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1414 (shell-command . tramp-handle-shell-command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1415 (insert-directory . tramp-handle-insert-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1416 (expand-file-name . tramp-handle-expand-file-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1417 (file-local-copy . tramp-handle-file-local-copy)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1418 (insert-file-contents . tramp-handle-insert-file-contents)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1419 (write-region . tramp-handle-write-region)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1420 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1421 (dired-call-process . tramp-handle-dired-call-process)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1422 (dired-recursive-delete-directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1423 . tramp-handle-dired-recursive-delete-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1424 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1425 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1426 "Alist of handler functions.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1427 Operations not mentioned here will be handled by the normal Emacs functions.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1428
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1429 ;;; For better error reporting.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1430
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1431 (defun tramp-version (arg)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1432 "Print version number of tramp.el in minibuffer or current buffer."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1433 (interactive "P")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1434 (if arg (insert tramp-version) (message tramp-version)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1435
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1436 ;;; Internal functions which must come first.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1437
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1438 (defsubst tramp-message (level fmt-string &rest args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1439 "Emit a message depending on verbosity level.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1440 First arg LEVEL says to be quiet if `tramp-verbose' is less than LEVEL. The
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1441 message is emitted only if `tramp-verbose' is greater than or equal to LEVEL.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1442 Calls function `message' with FMT-STRING as control string and the remaining
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1443 ARGS to actually emit the message (if applicable).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1444
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1445 This function expects to be called from the tramp buffer only!"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1446 (when (<= level tramp-verbose)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1447 (apply #'message (concat "tramp: " fmt-string) args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1448 (when tramp-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1449 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1450 (set-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1451 (tramp-get-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1452 tramp-current-multi-method tramp-current-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1453 tramp-current-user tramp-current-host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1454 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1455 (tramp-insert-with-face
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1456 'italic
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1457 (concat "# " (apply #'format fmt-string args) "\n"))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1458
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1459 (defun tramp-message-for-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1460 (multi-method method user host level fmt-string &rest args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1461 "Like `tramp-message' but temporarily switches to the tramp buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1462 First three args METHOD, USER, and HOST identify the tramp buffer to use,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1463 remaining args passed to `tramp-message'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1464 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1465 (set-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1466 (apply 'tramp-message level fmt-string args)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1467
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1468 (defsubst tramp-line-end-position nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1469 "Return point at end of line.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1470 Calls `line-end-position' or `point-at-eol' if defined, else
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1471 own implementation."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1472 (cond
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1473 ((fboundp 'line-end-position) (funcall 'line-end-position))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1474 ((fboundp 'point-at-eol) (funcall 'point-at-eol))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1475 (t (save-excursion (end-of-line) (point)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1476
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1477 (defmacro with-parsed-tramp-file-name (filename var &rest body)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1478 "Parse a Tramp filename and make components available in the body.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1479
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1480 First arg FILENAME is evaluated and dissected into its components.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1481 Second arg VAR is a symbol. It is used as a variable name to hold
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1482 the filename structure. It is also used as a prefix for the variables
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1483 holding the components. For example, if VAR is the symbol `foo', then
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1484 `foo' will be bound to the whole structure, `foo-multi-method' will
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1485 be bound to the multi-method component, and so on for `foo-method',
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1486 `foo-user', `foo-host', `foo-path'.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1487
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1488 Remaining args are Lisp expressions to be evaluated (inside an implicit
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1489 `progn').
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1490
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1491 If VAR is nil, then we bind `v' to the structure and `multi-method',
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1492 `method', `user', `host', `path' to the components."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1493 `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1494 (,(if var (intern (concat (symbol-name var) "-multi-method")) 'multi-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1495 (tramp-file-name-multi-method ,(or var 'v)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1496 (,(if var (intern (concat (symbol-name var) "-method")) 'method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1497 (tramp-file-name-method ,(or var 'v)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1498 (,(if var (intern (concat (symbol-name var) "-user")) 'user)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1499 (tramp-file-name-user ,(or var 'v)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1500 (,(if var (intern (concat (symbol-name var) "-host")) 'host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1501 (tramp-file-name-host ,(or var 'v)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1502 (,(if var (intern (concat (symbol-name var) "-path")) 'path)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1503 (tramp-file-name-path ,(or var 'v))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1504 ,@body))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1505
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1506 (put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1507
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1508 ;;; File Name Handler Functions:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1509
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1510 (defun tramp-handle-make-symbolic-link
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1511 (filename linkname &optional ok-if-already-exists)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1512 "Like `make-symbolic-link' for tramp files.
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1513 If LINKNAME is a non-Tramp file, it is used verbatim as the target of
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1514 the symlink. If LINKNAME is a Tramp file, only the path component is
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1515 used as the target of the symlink.
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1516
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1517 If LINKNAME is a Tramp file and the path component is relative, then
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1518 it is expanded first, before the path component is taken. Note that
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1519 this can give surprising results if the user/host for the source and
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1520 target of the symlink differ."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1521 (with-parsed-tramp-file-name linkname l
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1522 (when (tramp-ange-ftp-file-name-p l-multi-method l-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1523 (tramp-invoke-ange-ftp 'make-symbolic-link
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1524 filename linkname ok-if-already-exists))
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
1525 (let ((ln (tramp-get-remote-ln l-multi-method l-method l-user l-host))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1526 (cwd (file-name-directory l-path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1527 (unless ln
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1528 (signal 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1529 (list "Making a symbolic link."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1530 "ln(1) does not exist on the remote host.")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1531
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1532 ;; Do the 'confirm if exists' thing.
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1533 (when (file-exists-p linkname)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1534 ;; What to do?
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1535 (if (or (null ok-if-already-exists) ; not allowed to exist
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1536 (and (numberp ok-if-already-exists)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1537 (not (yes-or-no-p
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1538 (format
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1539 "File %s already exists; make it a link anyway? "
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1540 l-path)))))
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1541 (signal 'file-already-exists (list "File already exists" l-path))
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1542 (delete-file linkname)))
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1543
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1544 ;; If FILENAME is a Tramp name, use just the path component.
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1545 (when (tramp-tramp-file-p filename)
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1546 (setq filename (tramp-file-name-path
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1547 (tramp-dissect-file-name
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1548 (expand-file-name filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1549
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1550 ;; Right, they are on the same host, regardless of user, method, etc.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1551 ;; We now make the link on the remote machine. This will occur as the user
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1552 ;; that FILENAME belongs to.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1553 (zerop
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1554 (tramp-send-command-and-check
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
1555 l-multi-method l-method l-user l-host
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1556 (format "cd %s && %s -sf %s %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1557 cwd ln
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1558 filename
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
1559 l-path)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1560 t)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1561
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1562
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1563 (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1564 "Like `load' for tramp files. Not implemented!"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1565 (unless (file-name-absolute-p file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1566 (error "Tramp cannot `load' files without absolute path name"))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1567 (with-parsed-tramp-file-name file nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1568 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1569 (tramp-invoke-ange-ftp 'load
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1570 file noerror nomessage nosuffix must-suffix))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1571 (unless nosuffix
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1572 (cond ((file-exists-p (concat file ".elc"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1573 (setq file (concat file ".elc")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1574 ((file-exists-p (concat file ".el"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1575 (setq file (concat file ".el")))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1576 (when must-suffix
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1577 ;; The first condition is always true for absolute file names.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1578 ;; Included for safety's sake.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1579 (unless (or (file-name-directory file)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1580 (string-match "\\.elc?\\'" file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1581 (error "File `%s' does not include a `.el' or `.elc' suffix"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1582 file)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1583 (unless noerror
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1584 (when (not (file-exists-p file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1585 (error "Cannot load nonexistant file `%s'" file)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1586 (if (not (file-exists-p file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1587 nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1588 (unless nomessage
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1589 (message "Loading %s..." file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1590 (let ((local-copy (file-local-copy file)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1591 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1592 (load local-copy noerror t t)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1593 (delete-file local-copy))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1594 (unless nomessage
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1595 (message "Loading %s...done" file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1596 t)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1597
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1598 ;; Path manipulation functions that grok TRAMP paths...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1599 (defun tramp-handle-file-name-directory (file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1600 "Like `file-name-directory' but aware of TRAMP files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1601 ;; everything except the last filename thing is the directory
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1602 (with-parsed-tramp-file-name file nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1603 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1604 (tramp-invoke-ange-ftp 'file-name-directory file))
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1605 ;; For the following condition, two possibilities should be tried:
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1606 ;; (1) (string= path "")
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1607 ;; (2) (or (string= path "") (string= path "/"))
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1608 ;; The second variant fails when completing a "/" directory on
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1609 ;; the remote host, that is a filename which looks like
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1610 ;; "/user@host:/". But maybe wildcards fail with the first variant.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1611 ;; We should do some investigation.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1612 (if (string= path "")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1613 ;; For a filename like "/[foo]", we return "/". The `else'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1614 ;; case would return "/[foo]" unchanged. But if we do that,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1615 ;; then `file-expand-wildcards' ceases to work. It's not
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1616 ;; quite clear to me what's the intuition that tells that this
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1617 ;; behavior is the right behavior, but oh, well.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1618 "/"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1619 ;; run the command on the path portion only
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1620 ;; CCC: This should take into account the remote machine type, no?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1621 ;; --daniel <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1622 (tramp-make-tramp-file-name multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1623 ;; This will not recurse...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1624 (or (file-name-directory path) "")))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1625
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1626 (defun tramp-handle-file-name-nondirectory (file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1627 "Like `file-name-nondirectory' but aware of TRAMP files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1628 (with-parsed-tramp-file-name file nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1629 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1630 (tramp-invoke-ange-ftp 'file-name-nondirectory file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1631 (file-name-nondirectory path)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1632
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1633 (defun tramp-handle-file-truename (filename &optional counter prev-dirs)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1634 "Like `file-truename' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1635 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1636 ;; Ange-FTP does not support truename processing. It returns the
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1637 ;; file name as-is. So that's what we do, too.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1638 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1639 filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1640 (let* ((steps (tramp-split-string path "/"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1641 (pathdir (let ((directory-sep-char ?/))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1642 (file-name-as-directory path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1643 (is-dir (string= path pathdir))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1644 (thisstep nil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1645 (numchase 0)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1646 ;; Don't make the following value larger than necessary.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1647 ;; People expect an error message in a timely fashion when
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1648 ;; something is wrong; otherwise they might think that Emacs
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1649 ;; is hung. Of course, correctness has to come first.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1650 (numchase-limit 20)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1651 (result nil) ;result steps in reverse order
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1652 (curstri "")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1653 symlink-target)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1654 (tramp-message-for-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1655 multi-method method user host
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1656 10 "Finding true name for `%s'" filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1657 (while (and steps (< numchase numchase-limit))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1658 (setq thisstep (pop steps))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1659 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1660 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1661 10 "Check %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1662 (mapconcat 'identity
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1663 (append '("") (reverse result) (list thisstep))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1664 "/"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1665 (setq symlink-target
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1666 (nth 0 (tramp-handle-file-attributes
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1667 (tramp-make-tramp-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1668 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1669 (mapconcat 'identity
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1670 (append '("") (reverse result) (list thisstep))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1671 "/")))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1672 (cond ((string= "." thisstep)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1673 (tramp-message-for-buffer multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1674 10 "Ignoring step `.'"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1675 ((string= ".." thisstep)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1676 (tramp-message-for-buffer multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1677 10 "Processing step `..'")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1678 (pop result))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1679 ((stringp symlink-target)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1680 ;; It's a symlink, follow it.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1681 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1682 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1683 10 "Follow symlink to %s" symlink-target)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1684 (setq numchase (1+ numchase))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1685 (when (file-name-absolute-p symlink-target)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1686 (setq result nil))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1687 (setq steps
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1688 (append (tramp-split-string symlink-target "/") steps)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1689 (t
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1690 ;; It's a file.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1691 (setq result (cons thisstep result)))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1692 (when (>= numchase numchase-limit)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1693 (error "Maximum number (%d) of symlinks exceeded" numchase-limit))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1694 (setq result (reverse result))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1695 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1696 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1697 10 "True name of `%s' is `%s'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1698 filename (mapconcat 'identity (cons "" result) "/"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1699 (tramp-make-tramp-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1700 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1701 (concat (mapconcat 'identity (cons "" result) "/")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1702 (if is-dir "/" ""))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1703
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1704 ;; Basic functions.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1705
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1706 (defun tramp-handle-file-exists-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1707 "Like `file-exists-p' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1708 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1709 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1710 (tramp-invoke-ange-ftp 'file-exists-p filename))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1711 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1712 (zerop (tramp-send-command-and-check
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1713 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1714 (format
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1715 (tramp-get-file-exists-command multi-method method user host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1716 (tramp-shell-quote-argument path)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1717
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1718 ;; CCC: This should check for an error condition and signal failure
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1719 ;; when something goes wrong.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1720 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1721 (defun tramp-handle-file-attributes (filename &optional nonnumeric)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1722 "Like `file-attributes' for tramp files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1723 Optional argument NONNUMERIC means return user and group name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1724 rather than as numbers."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1725 (if (tramp-handle-file-exists-p filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1726 ;; file exists, find out stuff
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1727 (save-excursion
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1728 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1729 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1730 (tramp-invoke-ange-ftp 'file-attributes file))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1731 (if (tramp-get-remote-perl multi-method method user host)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1732 (tramp-handle-file-attributes-with-perl
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1733 multi-method method user host path nonnumeric)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1734 (tramp-handle-file-attributes-with-ls
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1735 multi-method method user host path nonnumeric))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1736 nil)) ; no file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1737
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1738
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1739 (defun tramp-handle-file-attributes-with-ls
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1740 (multi-method method user host path &optional nonnumeric)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1741 "Implement `file-attributes' for tramp files using the ls(1) command."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1742 (let (symlinkp dirp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1743 res-inode res-filemodes res-numlinks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1744 res-uid res-gid res-size res-symlink-target)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1745 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1746 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1747 (format "%s %s %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1748 (tramp-get-ls-command multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1749 (if nonnumeric "-ild" "-ildn")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1750 (tramp-shell-quote-argument path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1751 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1752 ;; parse `ls -l' output ...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1753 ;; ... inode
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1754 (setq res-inode
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1755 (condition-case err
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1756 (read (current-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1757 (invalid-read-syntax
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1758 (when (and (equal (cadr err)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1759 "Integer constant overflow in reader")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1760 (string-match
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1761 "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1762 (caddr err)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1763 (let* ((big (read (substring (caddr err) 0
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1764 (match-beginning 1))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1765 (small (read (match-string 1 (caddr err))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1766 (twiddle (/ small 65536)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1767 (cons (+ big twiddle)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1768 (- small (* twiddle 65536))))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1769 ;; ... file mode flags
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1770 (setq res-filemodes (symbol-name (read (current-buffer))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1771 ;; ... number links
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1772 (setq res-numlinks (read (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1773 ;; ... uid and gid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1774 (setq res-uid (read (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1775 (setq res-gid (read (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1776 (unless nonnumeric
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1777 (unless (numberp res-uid) (setq res-uid -1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1778 (unless (numberp res-gid) (setq res-gid -1)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1779 ;; ... size
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1780 (setq res-size (read (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1781 ;; From the file modes, figure out other stuff.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1782 (setq symlinkp (eq ?l (aref res-filemodes 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1783 (setq dirp (eq ?d (aref res-filemodes 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1784 ;; if symlink, find out file name pointed to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1785 (when symlinkp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1786 (search-forward "-> ")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1787 (setq res-symlink-target
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1788 (buffer-substring (point)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1789 (tramp-line-end-position))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1790 ;; return data gathered
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1791 (list
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1792 ;; 0. t for directory, string (name linked to) for symbolic
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1793 ;; link, or nil.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1794 (or dirp res-symlink-target nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1795 ;; 1. Number of links to file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1796 res-numlinks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1797 ;; 2. File uid.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1798 res-uid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1799 ;; 3. File gid.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1800 res-gid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1801 ;; 4. Last access time, as a list of two integers. First
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1802 ;; integer has high-order 16 bits of time, second has low 16
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1803 ;; bits.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1804 ;; 5. Last modification time, likewise.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1805 ;; 6. Last status change time, likewise.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1806 '(0 0) '(0 0) '(0 0) ;CCC how to find out?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1807 ;; 7. Size in bytes (-1, if number is out of range).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1808 res-size
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1809 ;; 8. File modes, as a string of ten letters or dashes as in ls -l.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1810 res-filemodes
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1811 ;; 9. t iff file's gid would change if file were deleted and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1812 ;; recreated.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1813 nil ;hm?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1814 ;; 10. inode number.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1815 res-inode
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1816 ;; 11. Device number.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1817 -1 ;hm?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1818 )))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1819
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1820 (defun tramp-handle-file-attributes-with-perl
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1821 (multi-method method user host path &optional nonnumeric)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1822 "Implement `file-attributes' for tramp files using a Perl script.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1823
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1824 The Perl command is sent to the remote machine when the connection
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1825 is initially created and is kept cached by the remote shell."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1826 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1827 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1828 (format "tramp_file_attributes %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1829 (tramp-shell-quote-argument path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1830 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1831 (let ((result (read (current-buffer))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1832 (setcar (nthcdr 8 result)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1833 (tramp-file-mode-from-int (nth 8 result)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1834 result))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1835
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1836 (defun tramp-handle-set-visited-file-modtime (&optional time-list)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1837 "Like `set-visited-file-modtime' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1838 (unless (buffer-file-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1839 (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1840 (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1841 (when time-list
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1842 (tramp-run-real-handler 'set-visited-file-modtime (list time-list)))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1843 (let ((f (buffer-file-name))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1844 (coding-system-used nil))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1845 (with-parsed-tramp-file-name f nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1846 ;; This operation is not handled by Ange-FTP!
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1847 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1848 (throw 'tramp-forward-to-ange-ftp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1849 (tramp-run-real-handler 'set-visited-file-modtime
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1850 (list time-list))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1851 (let* ((attr (file-attributes f))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1852 (modtime (nth 5 attr)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1853 ;; We use '(0 0) as a don't-know value. See also
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1854 ;; `tramp-handle-file-attributes-with-ls'.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1855 (when (boundp 'last-coding-system-used)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1856 (setq coding-system-used last-coding-system-used))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1857 (if (not (equal modtime '(0 0)))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1858 (tramp-run-real-handler 'set-visited-file-modtime (list modtime))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1859 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1860 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1861 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1862 (format "%s -ild %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1863 (tramp-get-ls-command multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1864 (tramp-shell-quote-argument path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1865 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1866 (setq attr (buffer-substring (point)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1867 (progn (end-of-line) (point)))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1868 (setq tramp-buffer-file-attributes attr))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1869 (when (boundp 'last-coding-system-used)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1870 (setq last-coding-system-used coding-system-used))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1871 nil))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1872
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1873 ;; CCC continue here
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1874
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1875 ;; This function makes the same assumption as
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1876 ;; `tramp-handle-set-visited-file-modtime'.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1877 (defun tramp-handle-verify-visited-file-modtime (buf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1878 "Like `verify-visited-file-modtime' for tramp files."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1879 (with-current-buffer buf
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1880 (let ((f (buffer-file-name)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1881 (with-parsed-tramp-file-name f nil
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
1882 (when (tramp-ange-ftp-file-name-p multi-method method)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1883 ;; This one requires a hack since the file name is not passed
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1884 ;; on the arg list.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1885 (let ((buffer-file-name (tramp-make-ange-ftp-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1886 user host path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1887 (tramp-invoke-ange-ftp 'verify-visited-file-modtime buf)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1888 (let* ((attr (file-attributes f))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1889 (modtime (nth 5 attr)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1890 (cond ((and attr (not (equal modtime '(0 0))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1891 ;; Why does `file-attributes' return a list (HIGH
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1892 ;; LOW), but `visited-file-modtime' returns a cons
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1893 ;; (HIGH . LOW)?
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1894 (let ((mt (visited-file-modtime)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1895 (< (abs (tramp-time-diff
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1896 modtime (list (car mt) (cdr mt)))) 2)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1897 (attr
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1898 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1899 (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1900 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1901 (format "%s -ild %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1902 (tramp-get-ls-command multi-method method
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1903 user host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1904 (tramp-shell-quote-argument path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1905 (tramp-wait-for-output)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1906 (setq attr (buffer-substring
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1907 (point) (progn (end-of-line) (point)))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1908 (equal tramp-buffer-file-attributes attr))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1909 ;; If file does not exist, say it is not modified.
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
1910 (t nil)))))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1911
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1912 (defadvice clear-visited-file-modtime (after tramp activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1913 "Set `tramp-buffer-file-attributes' back to nil.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1914 Tramp uses this variable as an emulation for the actual modtime of the file,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1915 if the remote host can't provide the modtime."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1916 (setq tramp-buffer-file-attributes nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1917
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1918 (defun tramp-handle-set-file-modes (filename mode)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1919 "Like `set-file-modes' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1920 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1921 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1922 (tramp-invoke-ange-ftp 'set-file-modes filename mode))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1923 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1924 (unless (zerop (tramp-send-command-and-check
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1925 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1926 (format "chmod %s %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1927 (tramp-decimal-to-octal mode)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1928 (tramp-shell-quote-argument path))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1929 (signal 'file-error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1930 (list "Doing chmod"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1931 ;; FIXME: extract the proper text from chmod's stderr.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1932 "error while changing file's mode"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1933 filename))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1934
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1935 ;; Simple functions using the `test' command.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1936
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1937 (defun tramp-handle-file-executable-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1938 "Like `file-executable-p' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1939 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1940 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1941 (tramp-invoke-ange-ftp 'file-executable-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1942 (zerop (tramp-run-test "-x" filename))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1943
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1944 (defun tramp-handle-file-readable-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1945 "Like `file-readable-p' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1946 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1947 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1948 (tramp-invoke-ange-ftp 'file-readable-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1949 (zerop (tramp-run-test "-r" filename))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1950
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1951 (defun tramp-handle-file-accessible-directory-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1952 "Like `file-accessible-directory-p' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1953 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1954 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1955 (tramp-invoke-ange-ftp 'file-accessible-directory-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1956 (and (zerop (tramp-run-test "-d" filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1957 (zerop (tramp-run-test "-r" filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1958 (zerop (tramp-run-test "-x" filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1959
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1960 ;; When the remote shell is started, it looks for a shell which groks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1961 ;; tilde expansion. Here, we assume that all shells which grok tilde
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1962 ;; expansion will also provide a `test' command which groks `-nt' (for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1963 ;; newer than). If this breaks, tell me about it and I'll try to do
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1964 ;; something smarter about it.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1965 (defun tramp-handle-file-newer-than-file-p (file1 file2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1966 "Like `file-newer-than-file-p' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1967 (cond ((not (file-exists-p file1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1968 nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1969 ((not (file-exists-p file2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1970 t)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1971 ;; We are sure both files exist at this point. We assume that
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1972 ;; both files are Tramp files, otherwise we issue an error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1973 ;; message. Todo: make a better error message.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1974 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1975 (save-excursion
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1976 (with-parsed-tramp-file-name file1 v1
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1977 (with-parsed-tramp-file-name file2 v2
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1978 (when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1979 (tramp-ange-ftp-file-name-p v2-multi-method v2-method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1980 (tramp-invoke-ange-ftp 'file-newer-than-file-p
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1981 file1 file2))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1982 (unless (and (equal v1-multi-method v2-multi-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1983 (equal v1-method v2-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1984 (equal v1-user v2-user)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1985 (equal v1-host v2-host))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1986 (signal 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1987 (list "Files must have same method, user, host"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1988 file1 file2)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1989 (unless (and (tramp-tramp-file-p file1)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1990 (tramp-tramp-file-p file2))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1991 (signal 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1992 (list "Files must be tramp files on same host"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1993 file1 file2)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1994 (if (tramp-get-test-groks-nt
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1995 v1-multi-method v1-method v1-user v1-host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1996 (zerop (tramp-run-test2 "test" file1 file2 "-nt"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1997 (zerop (tramp-run-test2 "tramp_test_nt" file1 file2)))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1998
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1999 ;; Functions implemented using the basic functions above.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2000
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2001 (defun tramp-handle-file-modes (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2002 "Like `file-modes' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2003 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2004 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2005 (tramp-invoke-ange-ftp 'file-modes filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2006 (when (file-exists-p filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2007 (tramp-mode-string-to-int
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2008 (nth 8 (tramp-handle-file-attributes filename))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2009
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2010 (defun tramp-handle-file-directory-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2011 "Like `file-directory-p' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2012 ;; Care must be taken that this function returns `t' for symlinks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2013 ;; pointing to directories. Surely the most obvious implementation
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2014 ;; would be `test -d', but that returns false for such symlinks.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2015 ;; CCC: Stefan Monnier says that `test -d' follows symlinks. And
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2016 ;; I now think he's right. So we could be using `test -d', couldn't
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2017 ;; we?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2018 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2019 ;; Alternatives: `cd %s', `test -d %s'
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2020 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2021 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2022 (tramp-invoke-ange-ftp 'file-directory-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2023 (save-excursion
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2024 (zerop
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2025 (tramp-send-command-and-check
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2026 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2027 (format "test -d %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2028 (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2029 t))))) ;run command in subshell
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2030
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2031 (defun tramp-handle-file-regular-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2032 "Like `file-regular-p' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2033 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2034 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2035 (tramp-invoke-ange-ftp 'file-regular-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2036 (and (tramp-handle-file-exists-p filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2037 (eq ?- (aref (nth 8 (tramp-handle-file-attributes filename)) 0)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2038
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2039 (defun tramp-handle-file-symlink-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2040 "Like `file-symlink-p' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2041 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2042 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2043 (tramp-invoke-ange-ftp 'file-symlink-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2044 (let ((x (car (tramp-handle-file-attributes filename))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2045 (when (stringp x) x))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2046
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2047 (defun tramp-handle-file-writable-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2048 "Like `file-writable-p' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2049 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2050 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2051 (tramp-invoke-ange-ftp 'file-writable-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2052 (if (tramp-handle-file-exists-p filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2053 ;; Existing files must be writable.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2054 (zerop (tramp-run-test "-w" filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2055 ;; If file doesn't exist, check if directory is writable.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2056 (and (zerop (tramp-run-test
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2057 "-d" (tramp-handle-file-name-directory filename)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2058 (zerop (tramp-run-test
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2059 "-w" (tramp-handle-file-name-directory filename)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2060
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2061 (defun tramp-handle-file-ownership-preserved-p (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2062 "Like `file-ownership-preserved-p' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2063 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2064 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2065 (tramp-invoke-ange-ftp 'file-ownership-preserved-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2066 (or (not (tramp-handle-file-exists-p filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2067 ;; Existing files must be writable.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2068 (zerop (tramp-run-test "-O" filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2069
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2070 ;; Other file name ops.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2071
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2072 ;; ;; Matthias Köppe <mkoeppe@mail.math.uni-magdeburg.de>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2073 ;; (defun tramp-handle-directory-file-name (directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2074 ;; "Like `directory-file-name' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2075 ;; (if (and (eq (aref directory (- (length directory) 1)) ?/)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2076 ;; (not (eq (aref directory (- (length directory) 2)) ?:)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2077 ;; (substring directory 0 (- (length directory) 1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2078 ;; directory))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2079
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2080 ;; Philippe Troin <phil@fifi.org>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2081 (defun tramp-handle-directory-file-name (directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2082 "Like `directory-file-name' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2083 (with-parsed-tramp-file-name directory nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2084 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2085 (tramp-invoke-ange-ftp 'directory-file-name directory))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2086 (let ((directory-length-1 (1- (length directory))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2087 (save-match-data
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2088 (if (and (eq (aref directory directory-length-1) ?/)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2089 (eq (string-match tramp-file-name-regexp directory) 0)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2090 (/= (match-end 0) directory-length-1))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2091 (substring directory 0 directory-length-1)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2092 directory)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2093
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2094 ;; Directory listings.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2095
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2096 (defun tramp-handle-directory-files (directory &optional full match nosort)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2097 "Like `directory-files' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2098 (with-parsed-tramp-file-name directory nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2099 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2100 (tramp-invoke-ange-ftp 'directory-files
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2101 directory full match nosort))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2102 (let (result x)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2103 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2104 (tramp-barf-unless-okay
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2105 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2106 (concat "cd " (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2107 nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2108 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2109 "tramp-handle-directory-files: couldn't `cd %s'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2110 (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2111 (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2112 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2113 (concat (tramp-get-ls-command multi-method method user host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2114 " -a | cat"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2115 (tramp-wait-for-output)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2116 (goto-char (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2117 (while (zerop (forward-line -1))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2118 (setq x (buffer-substring (point)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2119 (tramp-line-end-position)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2120 (when (or (not match) (string-match match x))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2121 (if full
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2122 (push (concat (file-name-as-directory directory)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2123 x)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2124 result)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2125 (push x result))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2126 (tramp-send-command multi-method method user host "cd")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2127 (tramp-wait-for-output))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2128 result)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2129
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2130 ;; This function should return "foo/" for directories and "bar" for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2131 ;; files. We use `ls -ad' to get a list of files (including
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2132 ;; directories), and `find . -type d \! -name . -prune' to get a list
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2133 ;; of directories.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2134 (defun tramp-handle-file-name-all-completions (filename directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2135 "Like `file-name-all-completions' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2136 (with-parsed-tramp-file-name directory nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2137 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2138 (tramp-invoke-ange-ftp 'file-name-all-completions
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2139 filename directory))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2140 (unless (save-match-data (string-match "/" filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2141 (let* ((nowild tramp-completion-without-shell-p)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2142 result)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2143 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2144 (tramp-barf-unless-okay
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2145 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2146 (format "cd %s" (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2147 nil 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2148 "tramp-handle-file-name-all-completions: Couldn't `cd %s'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2149 (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2150
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2151 ;; Get a list of directories and files, including reliably
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2152 ;; tagging the directories with a trailing '/'. Because I
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2153 ;; rock. --daniel@danann.net
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2154 (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2155 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2156 (format (concat "%s -a %s 2>/dev/null | while read f; do "
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2157 "if test -d \"$f\" 2>/dev/null; "
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2158 "then echo \"$f/\"; else echo \"$f\"; fi; done")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2159 (tramp-get-ls-command multi-method method user host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2160 (if (or nowild (zerop (length filename)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2161 ""
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2162 (format "-d %s*"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2163 (tramp-shell-quote-argument filename)))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2164
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2165 ;; Now grab the output.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2166 (tramp-wait-for-output)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2167 (goto-char (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2168 (while (zerop (forward-line -1))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2169 (push (buffer-substring (point)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2170 (tramp-line-end-position))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2171 result))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2172
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2173 (tramp-send-command multi-method method user host "cd")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2174 (tramp-wait-for-output)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2175
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2176 ;; Return the list.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2177 (if nowild
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2178 (all-completions filename (mapcar 'list result))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2179 result))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2180
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2181
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2182 ;; The following isn't needed for Emacs 20 but for 19.34?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2183 (defun tramp-handle-file-name-completion (filename directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2184 "Like `file-name-completion' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2185 (unless (tramp-tramp-file-p directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2186 (error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2187 "tramp-handle-file-name-completion invoked on non-tramp directory `%s'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2188 directory))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2189 (with-parsed-tramp-file-name directory nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2190 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2191 (tramp-invoke-ange-ftp 'file-name-completion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2192 filename directory))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2193 (try-completion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2194 filename
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2195 (mapcar (lambda (x) (cons x nil))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2196 (tramp-handle-file-name-all-completions filename directory)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2197
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2198 ;; cp, mv and ln
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2199
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2200 (defun tramp-handle-add-name-to-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2201 (filename newname &optional ok-if-already-exists)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2202 "Like `add-name-to-file' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2203 (with-parsed-tramp-file-name filename v1
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2204 (with-parsed-tramp-file-name newname v2
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2205 (let ((ln (when v1 (tramp-get-remote-ln
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2206 v1-multi-method v1-method v1-user v1-host))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2207 (unless (and v1-method v2-method v1-user v2-user v1-host v2-host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2208 (equal v1-multi-method v2-multi-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2209 (equal v1-method v2-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2210 (equal v1-user v2-user)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2211 (equal v1-host v2-host))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2212 (error "add-name-to-file: %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2213 "only implemented for same method, same user, same host"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2214 (when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2215 (tramp-ange-ftp-file-name-p v2-multi-method v2-method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2216 (tramp-invoke-ange-ftp 'add-name-to-file
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2217 filename newname ok-if-already-exists))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2218 (when (tramp-ange-ftp-file-name-p v1-multi-method v1-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2219 (tramp-invoke-ange-ftp 'add-name-to-file
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2220 filename newname ok-if-already-exists))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2221 (when (tramp-ange-ftp-file-name-p v2-multi-method v2-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2222 (tramp-invoke-ange-ftp 'add-name-to-file
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2223 filename newname ok-if-already-exists))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2224 (when (and (not ok-if-already-exists)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2225 (file-exists-p newname)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2226 (not (numberp ok-if-already-exists))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2227 (y-or-n-p
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2228 (format
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2229 "File %s already exists; make it a new name anyway? "
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2230 newname)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2231 (error "add-name-to-file: file %s already exists" newname))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2232 (tramp-barf-unless-okay
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2233 v1-multi-method v1-method v1-user v1-host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2234 (format "%s %s %s" ln (tramp-shell-quote-argument v1-path)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2235 (tramp-shell-quote-argument v2-path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2236 nil 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2237 "error with add-name-to-file, see buffer `%s' for details"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2238 (buffer-name))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2239
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2240 (defun tramp-handle-copy-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2241 (filename newname &optional ok-if-already-exists keep-date)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2242 "Like `copy-file' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2243 ;; Check if both files are local -- invoke normal copy-file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2244 ;; Otherwise, use tramp from local system.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2245 (setq filename (expand-file-name filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2246 (setq newname (expand-file-name newname))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2247 ;; At least one file a tramp file?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2248 (if (or (tramp-tramp-file-p filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2249 (tramp-tramp-file-p newname))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2250 (tramp-do-copy-or-rename-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2251 'copy filename newname ok-if-already-exists keep-date)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2252 (tramp-run-real-handler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2253 'copy-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2254 (list filename newname ok-if-already-exists keep-date))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2255
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2256 (defun tramp-handle-rename-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2257 (filename newname &optional ok-if-already-exists)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2258 "Like `rename-file' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2259 ;; Check if both files are local -- invoke normal rename-file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2260 ;; Otherwise, use tramp from local system.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2261 (setq filename (expand-file-name filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2262 (setq newname (expand-file-name newname))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2263 ;; At least one file a tramp file?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2264 (if (or (tramp-tramp-file-p filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2265 (tramp-tramp-file-p newname))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2266 (tramp-do-copy-or-rename-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2267 'rename filename newname ok-if-already-exists)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2268 (tramp-run-real-handler 'rename-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2269 (list filename newname ok-if-already-exists))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2270
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2271 (defun tramp-do-copy-or-rename-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2272 (op filename newname &optional ok-if-already-exists keep-date)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2273 "Copy or rename a remote file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2274 OP must be `copy' or `rename' and indicates the operation to perform.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2275 FILENAME specifies the file to copy or rename, NEWNAME is the name of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2276 the new file (for copy) or the new name of the file (for rename).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2277 OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2278 KEEP-DATE means to make sure that NEWNAME has the same timestamp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2279 as FILENAME.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2280
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2281 This function is invoked by `tramp-handle-copy-file' and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2282 `tramp-handle-rename-file'. It is an error if OP is neither of `copy'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2283 and `rename'. FILENAME and NEWNAME must be absolute file names."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2284 (unless (memq op '(copy rename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2285 (error "Unknown operation `%s', must be `copy' or `rename'" op))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2286 (unless ok-if-already-exists
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2287 (when (file-exists-p newname)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2288 (signal 'file-already-exists
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2289 (list newname))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2290 (with-parsed-tramp-file-name filename v1
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2291 (with-parsed-tramp-file-name newname v2
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2292 (when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2293 (tramp-ange-ftp-file-name-p v2-multi-method v2-method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2294 (tramp-invoke-ange-ftp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2295 (if (eq op 'copy) 'copy-file 'rename-file)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2296 filename newname ok-if-already-exists keep-date))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2297 (let* ((mmeth (tramp-file-name-multi-method (or v1 v2)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2298 (meth (tramp-file-name-method (or v1 v2)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2299 (rcp-program (tramp-get-rcp-program mmeth meth))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2300 (rcp-args (tramp-get-rcp-args mmeth meth))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2301 (trampbuf (get-buffer-create "*tramp output*")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2302 ;; Check if we can use a shortcut.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2303 (if (and v1-method v2-method
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2304 (equal v1-multi-method v2-multi-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2305 (equal v1-method v2-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2306 (equal v1-host v2-host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2307 (equal v1-user v2-user))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2308 ;; Shortcut: if method, host, user are the same for both
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2309 ;; files, we invoke `cp' or `mv' on the remote host directly.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2310 (tramp-do-copy-or-rename-file-directly
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2311 op
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2312 v1-multi-method v1-method v1-user v1-host v1-path v2-path
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2313 keep-date)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2314 ;; New algorithm: copy file first. Then, if operation is
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2315 ;; `rename', go back and delete the original file if the copy
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2316 ;; was successful.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2317 (if rcp-program
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2318 ;; The following code uses a tramp program to copy the file.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2319 (let ((f1 (if (not v1)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2320 filename
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2321 (tramp-make-rcp-program-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2322 v1-user v1-host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2323 (tramp-shell-quote-argument v1-path))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2324 (f2 (if (not v2)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2325 newname
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2326 (tramp-make-rcp-program-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2327 v2-user v2-host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2328 (tramp-shell-quote-argument v2-path))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2329 (default-directory
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2330 (if (tramp-tramp-file-p default-directory)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2331 (tramp-temporary-file-directory)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2332 default-directory)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2333 (when keep-date
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2334 (add-to-list 'rcp-args
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2335 (tramp-get-rcp-keep-date-arg mmeth meth)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2336 (save-excursion (set-buffer trampbuf) (erase-buffer))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2337 (unless (equal 0 (apply #'call-process
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2338 (tramp-get-rcp-program mmeth meth)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2339 nil trampbuf nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2340 (append rcp-args (list f1 f2))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2341 (pop-to-buffer trampbuf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2342 (error (concat "tramp-do-copy-or-rename-file: %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2343 " didn't work, see buffer `%s' for details")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2344 (tramp-get-rcp-program mmeth meth) trampbuf)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2345 ;; The following code uses an inline method for copying.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2346 ;; Let's start with a simple-minded approach: we create a new
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2347 ;; buffer, insert the contents of the source file into it,
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2348 ;; then write out the buffer. This should work fine, whether
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2349 ;; the source or the target files are tramp files.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2350 ;; CCC TODO: error checking
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2351 (when keep-date
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2352 (tramp-message
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2353 1 (concat "Warning: cannot preserve file time stamp"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2354 " with inline copying across machines")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2355 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2356 (set-buffer trampbuf) (erase-buffer)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2357 (insert-file-contents-literally filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2358 (let ((coding-system-for-write 'no-conversion))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2359 (write-region (point-min) (point-max) newname))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2360
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2361 ;; If the operation was `rename', delete the original file.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2362 (unless (eq op 'copy)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2363 (delete-file filename)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2364
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2365 (defun tramp-do-copy-or-rename-file-directly
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2366 (op multi-method method user host path1 path2 keep-date)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2367 "Invokes `cp' or `mv' on the remote system.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2368 OP must be one of `copy' or `rename', indicating `cp' or `mv',
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2369 respectively. METHOD, USER, and HOST specify the connection.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2370 PATH1 and PATH2 specify the two arguments of `cp' or `mv'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2371 If KEEP-DATE is non-nil, preserve the time stamp when copying."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2372 ;; CCC: What happens to the timestamp when renaming?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2373 (let ((cmd (cond ((and (eq op 'copy) keep-date) "cp -f -p")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2374 ((eq op 'copy) "cp -f")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2375 ((eq op 'rename) "mv -f")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2376 (t (error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2377 "Unknown operation `%s', must be `copy' or `rename'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2378 op)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2379 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2380 (tramp-barf-unless-okay
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2381 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2382 (format "%s %s %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2383 cmd
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2384 (tramp-shell-quote-argument path1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2385 (tramp-shell-quote-argument path2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2386 nil 'file-error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2387 "Copying directly failed, see buffer `%s' for details."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2388 (buffer-name)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2389
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2390 ;; mkdir
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2391 (defun tramp-handle-make-directory (dir &optional parents)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2392 "Like `make-directory' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2393 (with-parsed-tramp-file-name dir nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2394 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2395 (tramp-invoke-ange-ftp 'make-directory dir parents))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2396 (tramp-barf-unless-okay
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2397 multi-method method user host
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2398 (format " %s %s"
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2399 (if parents "mkdir -p" "mkdir")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2400 (tramp-shell-quote-argument path))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2401 nil 'file-error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2402 "Couldn't make directory %s" dir)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2403
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2404 ;; CCC error checking?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2405 (defun tramp-handle-delete-directory (directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2406 "Like `delete-directory' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2407 (with-parsed-tramp-file-name directory nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2408 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2409 (tramp-invoke-ange-ftp 'delete-directory directory))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2410 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2411 (tramp-send-command
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2412 multi-method method user host
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2413 (format "rmdir %s ; echo ok"
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2414 (tramp-shell-quote-argument path)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2415 (tramp-wait-for-output))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2416
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2417 (defun tramp-handle-delete-file (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2418 "Like `delete-file' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2419 (with-parsed-tramp-file-name filename nil
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
2420 (when (tramp-ange-ftp-file-name-p multi-method method)
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
2421 (tramp-invoke-ange-ftp 'delete-file filename))
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
2422 (save-excursion
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
2423 (unless (zerop (tramp-send-command-and-check
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
2424 multi-method method user host
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
2425 (format "rm -f %s"
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
2426 (tramp-shell-quote-argument path))))
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
2427 (signal 'file-error "Couldn't delete Tramp file")))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2428
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2429 ;; Dired.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2430
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2431 ;; CCC: This does not seem to be enough. Something dies when
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2432 ;; we try and delete two directories under TRAMP :/
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2433 (defun tramp-handle-dired-recursive-delete-directory (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2434 "Recursively delete the directory given.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2435 This is like `dired-recursive-delete-directory' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2436 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2437 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2438 (tramp-invoke-ange-ftp 'dired-recursive-delete-directory
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2439 filename))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2440 ;; run a shell command 'rm -r <path>'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2441 ;; Code shamelessly stolen for the dired implementation and, um, hacked :)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2442 (or (tramp-handle-file-exists-p filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2443 (signal
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2444 'file-error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2445 (list "Removing old file name" "no such directory" filename)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2446 ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2447 (tramp-send-command multi-method method user host
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2448 (format "rm -r %s" (tramp-shell-quote-argument path)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2449 ;; Wait for the remote system to return to us...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2450 ;; This might take a while, allow it plenty of time.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2451 (tramp-wait-for-output 120)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2452 ;; Make sure that it worked...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2453 (and (tramp-handle-file-exists-p filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2454 (error "Failed to recusively delete %s" filename))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2455
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2456
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2457 (defun tramp-handle-dired-call-process (program discard &rest arguments)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2458 "Like `dired-call-process' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2459 (with-parsed-tramp-file-name default-directory nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2460 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2461 (let ((default-directory
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2462 (tramp-make-ange-ftp-file-name user host path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2463 (tramp-invoke-ange-ftp 'dired-call-process
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2464 program discard arguments)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2465 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2466 (tramp-barf-unless-okay
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2467 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2468 (format "cd %s" (tramp-shell-quote-argument path))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2469 nil 'file-error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2470 "tramp-handle-dired-call-process: Couldn't `cd %s'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2471 (tramp-shell-quote-argument path))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2472 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2473 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2474 (mapconcat #'tramp-shell-quote-argument (cons program arguments) " "))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2475 (tramp-wait-for-output))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2476 (unless discard
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2477 (insert-buffer (tramp-get-buffer multi-method method user host)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2478 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2479 (prog1
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2480 (tramp-send-command-and-check multi-method method user host nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2481 (tramp-send-command multi-method method user host "cd")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2482 (tramp-wait-for-output)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2483
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2484 ;; Pacify byte-compiler. The function is needed on XEmacs only. I'm
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2485 ;; not sure at all that this is the right way to do it, but let's hope
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2486 ;; it works for now, and wait for a guru to point out the Right Way to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2487 ;; achieve this.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2488 ;;(eval-when-compile
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2489 ;; (unless (fboundp 'dired-insert-set-properties)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2490 ;; (fset 'dired-insert-set-properties 'ignore)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2491 ;; Gerd suggests this:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2492 (eval-when-compile (require 'dired))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2493 ;; Note that dired is required at run-time, too, when it is needed.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2494 ;; It is only needed on XEmacs for the function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2495 ;; `dired-insert-set-properties'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2496
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2497 (defun tramp-handle-insert-directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2498 (filename switches &optional wildcard full-directory-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2499 "Like `insert-directory' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2500 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2501 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2502 (tramp-invoke-ange-ftp 'insert-directory
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2503 filename switches wildcard full-directory-p))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2504 (tramp-message-for-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2505 multi-method method user host 10
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2506 "Inserting directory `ls %s %s', wildcard %s, fulldir %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2507 switches filename (if wildcard "yes" "no")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2508 (if full-directory-p "yes" "no"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2509 (when wildcard
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2510 (setq wildcard (file-name-nondirectory path))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2511 (setq path (file-name-directory path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2512 (when (listp switches)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2513 (setq switches (mapconcat 'identity switches " ")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2514 (unless full-directory-p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2515 (setq switches (concat "-d " switches)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2516 (when wildcard
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2517 (setq switches (concat switches " " wildcard)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2518 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2519 ;; If `full-directory-p', we just say `ls -l FILENAME'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2520 ;; Else we chdir to the parent directory, then say `ls -ld BASENAME'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2521 (if full-directory-p
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2522 (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2523 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2524 (format "%s %s %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2525 (tramp-get-ls-command multi-method method user host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2526 switches
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2527 (if wildcard
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2528 path
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2529 (tramp-shell-quote-argument (concat path ".")))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2530 (tramp-barf-unless-okay
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2531 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2532 (format "cd %s" (tramp-shell-quote-argument
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2533 (file-name-directory path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2534 nil 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2535 "Couldn't `cd %s'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2536 (tramp-shell-quote-argument (file-name-directory path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2537 (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2538 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2539 (format "%s %s %s"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2540 (tramp-get-ls-command multi-method method user host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2541 switches
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2542 (if full-directory-p
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2543 ;; Add "/." to make sure we got complete dir
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2544 ;; listing for symlinks, too.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2545 (concat (file-name-as-directory
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2546 (file-name-nondirectory path)) ".")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2547 (file-name-nondirectory path)))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2548 (sit-for 1) ;needed for rsh but not ssh?
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2549 (tramp-wait-for-output))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2550 (insert-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2551 ;; On XEmacs, we want to call (exchange-point-and-mark t), but
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2552 ;; that doesn't exist on Emacs, so we use this workaround instead.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2553 ;; Since zmacs-region-stays doesn't exist in Emacs, this ought to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2554 ;; be safe. Thanks to Daniel Pittman <daniel@danann.net>.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2555 (let ((zmacs-region-stays t))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2556 (exchange-point-and-mark))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2557 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2558 (tramp-send-command multi-method method user host "cd")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2559 (tramp-wait-for-output))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2560 ;; Another XEmacs specialty follows. What's the right way to do
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2561 ;; it?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2562 (when (and (featurep 'xemacs)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2563 (eq major-mode 'dired-mode))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2564 (save-excursion
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2565 (require 'dired)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2566 (dired-insert-set-properties (point) (mark t))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2567
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2568 ;; Continuation of kluge to pacify byte-compiler.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2569 ;;(eval-when-compile
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2570 ;; (when (eq (symbol-function 'dired-insert-set-properties) 'ignore)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2571 ;; (fmakunbound 'dired-insert-set-properties)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2572
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2573 ;; CCC is this the right thing to do?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2574 (defun tramp-handle-unhandled-file-name-directory (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2575 "Like `unhandled-file-name-directory' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2576 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2577 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2578 (tramp-invoke-ange-ftp 'unhandled-file-name-directory
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2579 filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2580 (expand-file-name "~/")))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2581
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2582 ;; Canonicalization of file names.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2583
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2584 (defun tramp-drop-volume-letter (name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2585 "Cut off unnecessary drive letter from file NAME.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2586 The function `tramp-handle-expand-file-name' calls `expand-file-name'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2587 locally on a remote file name. When the local system is a W32 system
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2588 but the remote system is Unix, this introduces a superfluous drive
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2589 letter into the file name. This function removes it.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2590
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2591 Doesn't do anything if the NAME does not start with a drive letter."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2592 (if (and (> (length name) 1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2593 (char-equal (aref name 1) ?:)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2594 (let ((c1 (aref name 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2595 (or (and (>= c1 ?A) (<= c1 ?Z))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2596 (and (>= c1 ?a) (<= c1 ?z)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2597 (substring name 2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2598 name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2599
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2600 (defun tramp-handle-expand-file-name (name &optional dir)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2601 "Like `expand-file-name' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2602 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2603 (setq dir (or dir default-directory "/"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2604 ;; Unless NAME is absolute, concat DIR and NAME.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2605 (unless (file-name-absolute-p name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2606 (setq name (concat (file-name-as-directory dir) name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2607 ;; If NAME is not a tramp file, run the real handler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2608 (if (not (tramp-tramp-file-p name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2609 (tramp-run-real-handler 'expand-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2610 (list name nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2611 ;; Dissect NAME.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2612 (with-parsed-tramp-file-name name nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2613 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2614 (tramp-invoke-ange-ftp 'expand-file-name name nil))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2615 (unless (file-name-absolute-p path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2616 (setq path (concat "~/" path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2617 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2618 ;; Tilde expansion if necessary. This needs a shell which
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2619 ;; groks tilde expansion! The function `tramp-find-shell' is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2620 ;; supposed to find such a shell on the remote host. Please
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2621 ;; tell me about it when this doesn't work on your system.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2622 (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2623 (let ((uname (match-string 1 path))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2624 (fname (match-string 2 path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2625 ;; CCC fanatic error checking?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2626 (set-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2627 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2628 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2629 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2630 (format "cd %s; pwd" uname)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2631 t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2632 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2633 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2634 (setq uname (buffer-substring (point) (tramp-line-end-position)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2635 (setq path (concat uname fname))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2636 (erase-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2637 ;; No tilde characters in file name, do normal
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2638 ;; expand-file-name (this does "/./" and "/../"). We bind
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2639 ;; directory-sep-char here for XEmacs on Windows, which would
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2640 ;; otherwise use backslash.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2641 (let ((directory-sep-char ?/))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2642 (tramp-make-tramp-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2643 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2644 (tramp-drop-volume-letter
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2645 (tramp-run-real-handler 'expand-file-name (list path)))))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2646
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2647 ;; Remote commands.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2648
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2649 (defun tramp-handle-shell-command (command &optional output-buffer error-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2650 "Like `shell-command' for tramp files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2651 This will break if COMMAND prints a newline, followed by the value of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2652 `tramp-end-of-output', followed by another newline."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2653 (if (tramp-tramp-file-p default-directory)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2654 (with-parsed-tramp-file-name default-directory nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2655 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2656 (let ((default-directory (tramp-make-ange-ftp-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2657 user host path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2658 (tramp-invoke-ange-ftp 'shell-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2659 command output-buffer error-buffer)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2660 (let (status)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2661 (when (string-match "&[ \t]*\\'" command)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2662 (error "Tramp doesn't grok asynchronous shell commands, yet"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2663 (when error-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2664 (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2665 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2666 (tramp-barf-unless-okay
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2667 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2668 (format "cd %s" (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2669 nil 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2670 "tramp-handle-shell-command: Couldn't `cd %s'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2671 (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2672 (tramp-send-command multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2673 (concat command "; tramp_old_status=$?"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2674 ;; This will break if the shell command prints "/////"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2675 ;; somewhere. Let's just hope for the best...
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2676 (tramp-wait-for-output))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2677 (unless output-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2678 (setq output-buffer (get-buffer-create "*Shell Command Output*"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2679 (set-buffer output-buffer)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2680 (erase-buffer))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2681 (unless (bufferp output-buffer)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2682 (setq output-buffer (current-buffer)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2683 (set-buffer output-buffer)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2684 (insert-buffer (tramp-get-buffer multi-method method user host))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2685 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2686 (tramp-send-command multi-method method user host "cd")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2687 (tramp-wait-for-output)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2688 (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2689 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2690 (concat "tramp_set_exit_status $tramp_old_status;"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2691 " echo tramp_exit_status $?"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2692 (tramp-wait-for-output)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2693 (goto-char (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2694 (unless (search-backward "tramp_exit_status " nil t)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2695 (error "Couldn't find exit status of `%s'" command))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2696 (skip-chars-forward "^ ")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2697 (setq status (read (current-buffer))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2698 (unless (zerop (buffer-size))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2699 (pop-to-buffer output-buffer))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2700 status)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2701 ;; The following is only executed if something strange was
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2702 ;; happening. Emit a helpful message and do it anyway.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2703 (message "tramp-handle-shell-command called with non-tramp directory: `%s'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2704 default-directory)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2705 (tramp-run-real-handler 'shell-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2706 (list command output-buffer error-buffer)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2707
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2708 ;; File Editing.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2709
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2710 (defsubst tramp-make-temp-file ()
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2711 (funcall (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2712 (expand-file-name tramp-temp-name-prefix
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2713 (tramp-temporary-file-directory))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2714
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2715 (defun tramp-handle-file-local-copy (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2716 "Like `file-local-copy' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2717 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2718 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2719 (tramp-invoke-ange-ftp 'file-local-copy filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2720 (let ((trampbuf (get-buffer-create "*tramp output*"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2721 tmpfil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2722 (unless (file-exists-p filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2723 (error "Cannot make local copy of non-existing file `%s'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2724 filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2725 (setq tmpfil (tramp-make-temp-file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2726 (cond ((tramp-get-rcp-program multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2727 ;; Use tramp-like program for file transfer.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2728 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2729 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2730 5 "Fetching %s to tmp file %s..." filename tmpfil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2731 (save-excursion (set-buffer trampbuf) (erase-buffer))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2732 (unless (equal
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2733 0
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2734 (apply #'call-process
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2735 (tramp-get-rcp-program multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2736 nil trampbuf nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2737 (append (tramp-get-rcp-args multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2738 (list
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2739 (tramp-make-rcp-program-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2740 user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2741 (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2742 tmpfil))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2743 (pop-to-buffer trampbuf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2744 (error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2745 (concat "tramp-handle-file-local-copy: `%s' didn't work, "
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2746 "see buffer `%s' for details")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2747 (tramp-get-rcp-program multi-method method) trampbuf))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2748 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2749 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2750 5 "Fetching %s to tmp file %s...done" filename tmpfil))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2751 ((and (tramp-get-encoding-command multi-method method)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2752 (tramp-get-decoding-command multi-method method))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2753 ;; Use inline encoding for file transfer.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2754 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2755 ;; Following line for setting tramp-current-method,
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2756 ;; tramp-current-user, tramp-current-host.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2757 (set-buffer (tramp-get-buffer multi-method method user host))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2758 (tramp-message 5 "Encoding remote file %s..." filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2759 (tramp-barf-unless-okay
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2760 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2761 (concat (tramp-get-encoding-command multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2762 " < " (tramp-shell-quote-argument path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2763 nil 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2764 "Encoding remote file failed, see buffer `%s' for details"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2765 (tramp-get-buffer multi-method method user host))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2766 ;; Remove trailing status code
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2767 (goto-char (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2768 (delete-region (point) (progn (forward-line -1) (point)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2769
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2770 (tramp-message 5 "Decoding remote file %s..." filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2771 (if (and (tramp-get-decoding-function multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2772 (fboundp (tramp-get-decoding-function
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2773 multi-method method)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2774 ;; If tramp-decoding-function is defined for this
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2775 ;; method, we call it.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2776 (let ((tmpbuf (get-buffer-create " *tramp tmp*")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2777 (set-buffer tmpbuf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2778 (erase-buffer)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2779 (insert-buffer (tramp-get-buffer multi-method method
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2780 user host))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2781 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2782 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2783 6 "Decoding remote file %s with function %s..."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2784 filename
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2785 (tramp-get-decoding-function multi-method method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2786 (set-buffer tmpbuf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2787 (let ((coding-system-for-write 'no-conversion))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2788 (funcall (tramp-get-decoding-function
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2789 multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2790 (point-min)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2791 (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2792 (write-region (point-min) (point-max) tmpfil))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2793 (kill-buffer tmpbuf))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2794 ;; If tramp-decoding-function is not defined for this
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2795 ;; method, we invoke tramp-decoding-command instead.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2796 (let ((tmpfil2 (tramp-make-temp-file)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2797 (write-region (point-min) (point-max) tmpfil2)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2798 (tramp-message
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2799 6 "Decoding remote file %s with command %s..."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2800 filename
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2801 (tramp-get-decoding-command multi-method method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2802 (call-process
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2803 tramp-sh-program
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2804 tmpfil2 ;input
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2805 nil ;output
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2806 nil ;display
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2807 "-c" (concat (tramp-get-decoding-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2808 multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2809 " > " tmpfil))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2810 (delete-file tmpfil2)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2811 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2812 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2813 5 "Decoding remote file %s...done" filename)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2814
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2815 (t (error "Wrong method specification for `%s'" method)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2816 tmpfil)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2817
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2818
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2819 (defun tramp-handle-insert-file-contents
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2820 (filename &optional visit beg end replace)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2821 "Like `insert-file-contents' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2822 (barf-if-buffer-read-only)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2823 (setq filename (expand-file-name filename))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2824 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2825 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2826 (tramp-invoke-ange-ftp 'insert-file-contents
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2827 filename visit beg end replace))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2828 (if (not (tramp-handle-file-exists-p filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2829 (progn
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2830 (when visit
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2831 (setq buffer-file-name filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2832 (set-visited-file-modtime)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2833 (set-buffer-modified-p nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2834 (signal 'file-error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2835 (format "File `%s' not found on remote host" filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2836 (list (tramp-handle-expand-file-name filename) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2837 (let ((local-copy (tramp-handle-file-local-copy filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2838 (coding-system-used nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2839 (result nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2840 (when visit
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2841 (setq buffer-file-name filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2842 (set-visited-file-modtime)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2843 (set-buffer-modified-p nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2844 (tramp-message-for-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2845 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2846 9 "Inserting local temp file `%s'..." local-copy)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2847 (setq result
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2848 (tramp-run-real-handler 'insert-file-contents
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2849 (list local-copy nil beg end replace)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2850 ;; Now `last-coding-system-used' has right value. Remember it.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2851 (when (boundp 'last-coding-system-used)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2852 (setq coding-system-used last-coding-system-used))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2853 (tramp-message 9 "Inserting local temp file `%s'...done" local-copy)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2854 (delete-file local-copy)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2855 (when (boundp 'last-coding-system-used)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2856 (setq last-coding-system-used coding-system-used))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2857 (list (expand-file-name filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2858 (second result))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2859
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2860 ;; CCC grok APPEND, LOCKNAME, CONFIRM
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2861 (defun tramp-handle-write-region
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2862 (start end filename &optional append visit lockname confirm)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2863 "Like `write-region' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2864 (unless (eq append nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2865 (error "Cannot append to file using tramp (`%s')" filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2866 (setq filename (expand-file-name filename))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2867 ;; Following part commented out because we don't know what to do about
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2868 ;; file locking, and it does not appear to be a problem to ignore it.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2869 ;; Ange-ftp ignores it, too.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2870 ;; (when (and lockname (stringp lockname))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2871 ;; (setq lockname (expand-file-name lockname)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2872 ;; (unless (or (eq lockname nil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2873 ;; (string= lockname filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2874 ;; (error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2875 ;; "tramp-handle-write-region: LOCKNAME must be nil or equal FILENAME"))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2876 ;; XEmacs takes a coding system as the sevent argument, not `confirm'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2877 (when (and (not (featurep 'xemacs))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2878 confirm (file-exists-p filename))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2879 (unless (y-or-n-p (format "File %s exists; overwrite anyway? "
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2880 filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2881 (error "File not overwritten")))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2882 (with-parsed-tramp-file-name filename nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2883 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2884 (tramp-invoke-ange-ftp 'write-region
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2885 start end filename append visit lockname confirm))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2886 (let ((curbuf (current-buffer))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2887 (rcp-program (tramp-get-rcp-program multi-method method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2888 (rcp-args (tramp-get-rcp-args multi-method method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2889 (encoding-command (tramp-get-encoding-command multi-method method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2890 (encoding-function
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2891 (tramp-get-encoding-function multi-method method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2892 (decoding-command (tramp-get-decoding-command multi-method method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2893 (trampbuf (get-buffer-create "*tramp output*"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2894 ;; We use this to save the value of `last-coding-system-used'
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2895 ;; after writing the tmp file. At the end of the function,
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2896 ;; we set `last-coding-system-used' to this saved value.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2897 ;; This way, any intermediary coding systems used while
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2898 ;; talking to the remote shell or suchlike won't hose this
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2899 ;; variable. This approach was snarfed from ange-ftp.el.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2900 coding-system-used
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2901 tmpfil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2902 ;; Write region into a tmp file. This isn't really needed if we
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2903 ;; use an encoding function, but currently we use it always
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2904 ;; because this makes the logic simpler.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2905 (setq tmpfil (tramp-make-temp-file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2906 ;; We say `no-message' here because we don't want the visited file
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2907 ;; modtime data to be clobbered from the temp file. We call
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2908 ;; `set-visited-file-modtime' ourselves later on.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2909 (tramp-run-real-handler
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2910 'write-region
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2911 (if confirm ; don't pass this arg unless defined for backward compat.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2912 (list start end tmpfil append 'no-message lockname confirm)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2913 (list start end tmpfil append 'no-message lockname)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2914 ;; Now, `last-coding-system-used' has the right value. Remember it.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2915 (when (boundp 'last-coding-system-used)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2916 (setq coding-system-used last-coding-system-used))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2917 ;; This is a bit lengthy due to the different methods possible for
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2918 ;; file transfer. First, we check whether the method uses an rcp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2919 ;; program. If so, we call it. Otherwise, both encoding and
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2920 ;; decoding command must be specified. However, if the method
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2921 ;; _also_ specifies an encoding function, then that is used for
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2922 ;; encoding the contents of the tmp file.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2923 (cond (rcp-program
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2924 ;; use rcp-like program for file transfer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2925 (let ((argl (append rcp-args
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2926 (list
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2927 tmpfil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2928 (tramp-make-rcp-program-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2929 user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2930 (tramp-shell-quote-argument path))))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2931 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2932 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2933 6 "Writing tmp file using `%s'..." rcp-program)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2934 (save-excursion (set-buffer trampbuf) (erase-buffer))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2935 (when tramp-debug-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2936 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2937 (set-buffer (tramp-get-debug-buffer multi-method
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2938 method user host))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2939 (goto-char (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2940 (tramp-insert-with-face
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2941 'bold (format "$ %s %s\n" rcp-program
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2942 (mapconcat 'identity argl " ")))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2943 (unless (equal 0
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2944 (apply #'call-process
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2945 rcp-program nil trampbuf nil argl))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2946 (pop-to-buffer trampbuf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2947 (error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2948 "Cannot write region to file `%s', command `%s' failed"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2949 filename rcp-program))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2950 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2951 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2952 6 "Transferring file using `%s'...done"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2953 rcp-program)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2954 ((and encoding-command decoding-command)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2955 ;; Use inline file transfer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2956 (let ((tmpbuf (get-buffer-create " *tramp file transfer*")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2957 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2958 ;; Encode tmpfil into tmpbuf
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2959 (tramp-message-for-buffer multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2960 5 "Encoding region...")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2961 (set-buffer tmpbuf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2962 (erase-buffer)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2963 ;; Use encoding function or command.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2964 (if (and encoding-function
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2965 (fboundp encoding-function))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2966 (progn
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2967 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2968 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2969 6 "Encoding region using function...")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2970 (insert-file-contents-literally tmpfil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2971 ;; CCC. The following `let' is a workaround for
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2972 ;; the base64.el that comes with pgnus-0.84. If
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2973 ;; both of the following conditions are
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2974 ;; satisfied, it tries to write to a local file
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2975 ;; in default-directory, but at this point,
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2976 ;; default-directory is remote.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2977 ;; (CALL-PROCESS-REGION can't write to remote
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2978 ;; files, it seems.) The file in question is a
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2979 ;; tmp file anyway.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2980 (let ((default-directory
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2981 (tramp-temporary-file-directory)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2982 (funcall encoding-function (point-min) (point-max)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2983 (goto-char (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2984 (unless (bolp)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2985 (newline)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2986 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2987 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2988 6 "Encoding region using command...")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2989 (unless (equal 0
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2990 (call-process
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2991 tramp-sh-program
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2992 tmpfil ;input = local tmp file
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2993 t ;output is current buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2994 nil ;don't redisplay
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2995 "-c"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2996 encoding-command))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2997 (pop-to-buffer trampbuf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2998 (error (concat "Cannot write to `%s', local encoding"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2999 " command `%s' failed")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3000 filename encoding-command)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3001 ;; Send tmpbuf into remote decoding command which
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3002 ;; writes to remote file. Because this happens on the
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3003 ;; remote host, we cannot use the function.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3004 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3005 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3006 5 "Decoding region into remote file %s..." filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3007 (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3008 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3009 (format "%s >%s <<'EOF'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3010 decoding-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3011 (tramp-shell-quote-argument path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3012 (set-buffer tmpbuf)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3013 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3014 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3015 6 "Sending data to remote host...")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3016 (tramp-send-region multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3017 (point-min) (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3018 ;; wait for remote decoding to complete
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3019 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3020 multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3021 6 "Sending end of data token...")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3022 (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3023 multi-method method user host "EOF")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3024 (tramp-message-for-buffer
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3025 multi-method method user host 6
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3026 "Waiting for remote host to process data...")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3027 (set-buffer (tramp-get-buffer multi-method method user host))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3028 (tramp-wait-for-output)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3029 (tramp-barf-unless-okay
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3030 multi-method method user host nil nil 'file-error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3031 (concat "Couldn't write region to `%s',"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3032 " decode using `%s' failed")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3033 filename decoding-command)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3034 (tramp-message 5 "Decoding region into remote file %s...done"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3035 filename)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3036 (kill-buffer tmpbuf))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3037 (t
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3038 (error
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3039 (concat "Method `%s' should specify both encoding and "
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3040 "decoding command or an rcp program")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3041 method)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3042 (delete-file tmpfil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3043 (unless (equal curbuf (current-buffer))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3044 (error "Buffer has changed from `%s' to `%s'"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3045 curbuf (current-buffer)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3046 (when (eq visit t)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3047 (set-visited-file-modtime))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3048 ;; Make `last-coding-system-used' have the right value.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3049 (when (boundp 'last-coding-system-used)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3050 (setq last-coding-system-used coding-system-used))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3051 (when (or (eq visit t)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3052 (eq visit nil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3053 (stringp visit))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3054 (message "Wrote %s" filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3055
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3056 ;; Call down to the real handler.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3057 ;; Because EFS does not play nicely with TRAMP (both systems match an
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3058 ;; TRAMP path) it is needed to disable efs as well as tramp for the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3059 ;; operation.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3060 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3061 ;; Other than that, this is the canon file-handler code that the doco
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3062 ;; says should be used here. Which is nice.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3063 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3064 ;; Under XEmacs current, EFS also hooks in as
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3065 ;; efs-sifn-handler-function to handle any path with environment
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3066 ;; variables. This has two implications:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3067 ;; 1) That EFS may not be completely dead (yet) for TRAMP paths
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3068 ;; 2) That TRAMP might want to do the same thing.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3069 ;; Details as they come in.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3070 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3071 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3072
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3073 ;; (defun tramp-run-real-handler (operation args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3074 ;; "Invoke normal file name handler for OPERATION.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3075 ;; This inhibits EFS and Ange-FTP, too, because they conflict with tramp.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3076 ;; First arg specifies the OPERATION, remaining ARGS are passed to the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3077 ;; OPERATION."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3078 ;; (let ((inhibit-file-name-handlers
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3079 ;; (list 'tramp-file-name-handler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3080 ;; 'efs-file-handler-function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3081 ;; 'ange-ftp-hook-function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3082 ;; (and (eq inhibit-file-name-operation operation)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3083 ;; inhibit-file-name-handlers)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3084 ;; (inhibit-file-name-operation operation))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3085 ;; (apply operation args)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3086
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3087 (defun tramp-run-real-handler (operation args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3088 "Invoke normal file name handler for OPERATION.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3089 First arg specifies the OPERATION, second arg is a list of arguments to
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3090 pass to the OPERATION."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3091 (let ((inhibit-file-name-handlers
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3092 (list 'tramp-file-name-handler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3093 (and (eq inhibit-file-name-operation operation)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3094 inhibit-file-name-handlers)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3095 (inhibit-file-name-operation operation))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3096 (apply operation args)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3097
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3098 ;; Main function.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3099 ;;;###autoload
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3100 (defun tramp-file-name-handler (operation &rest args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3101 "Invoke tramp file name handler.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3102 Falls back to normal file name handler if no tramp file name handler exists."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3103 (let ((fn (assoc operation tramp-file-name-handler-alist)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3104 (if fn
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3105 (catch 'tramp-forward-to-ange-ftp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3106 (save-match-data (apply (cdr fn) args)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3107 (tramp-run-real-handler operation args))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3108
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3109 ;; Register in file name handler alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3110 ;;;###autoload
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3111 (add-to-list 'file-name-handler-alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3112 (cons tramp-file-name-regexp 'tramp-file-name-handler))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3113
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3114 ;; To handle EFS, the following functions need to be dealt with:
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3115 ;;
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3116 ;; * dired-before-readin-hook contains efs-dired-before-readin
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3117 ;; * file-name-handler-alist contains efs-file-handler-function
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3118 ;; and efs-root-handler-function and efs-sifn-handler-function
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3119 ;; * find-file-hooks contains efs-set-buffer-mode
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3120 ;;
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3121 ;; But it won't happen for EFS since the XEmacs maintainers
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3122 ;; don't want to use a unified filename syntax.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3123 (defun tramp-disable-ange-ftp ()
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3124 "Turn Ange-FTP off.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3125 This is useful for unified remoting. See
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3126 `tramp-file-name-structure-unified' and
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3127 `tramp-file-name-structure-separate' for details. Requests suitable
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3128 for Ange-FTP will be forwarded to Ange-FTP. Also see the variables
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3129 `tramp-ftp-method', `tramp-default-method', and
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3130 `tramp-default-method-alist'.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3131
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3132 This function is not needed in Emacsen which include Tramp, but is
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3133 present for backward compatibility."
46060
40298ba8e901 (tramp-handle-ange-ftp): Fix typo.
Andreas Schwab <schwab@suse.de>
parents: 46048
diff changeset
3134 (let ((a1 (rassq 'ange-ftp-hook-function file-name-handler-alist))
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3135 (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3136 (setq file-name-handler-alist
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3137 (delete a1 (delete a2 file-name-handler-alist)))))
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
3138 (tramp-disable-ange-ftp)
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3139
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3140 (defun tramp-repair-jka-compr ()
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3141 "If jka-compr is already loaded, move it to the front of
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3142 `file-name-handler-alist'. On Emacs 21.4 or so this will not be
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3143 necessary anymore."
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3144 (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist)))
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3145 (when jka
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3146 (setq file-name-handler-alist
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3147 (cons jka (delete jka file-name-handler-alist))))))
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
3148 (tramp-repair-jka-compr)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3149
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3150 (defun tramp-invoke-ange-ftp (operation &rest args)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3151 "Invoke the Ange-FTP handler function and throw."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3152 (let ((ange-ftp-name-format
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3153 (list (nth 0 tramp-file-name-structure)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3154 (nth 3 tramp-file-name-structure)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3155 (nth 2 tramp-file-name-structure)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3156 (nth 4 tramp-file-name-structure))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3157 (throw 'tramp-forward-to-ange-ftp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3158 (apply 'ange-ftp-hook-function operation args))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3159
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3160 (defun tramp-ange-ftp-file-name-p (multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3161 "Check if it's a filename that should be forwarded to Ange-FTP."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3162 (and (null multi-method) (string= method tramp-ftp-method)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3163
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3164
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3165 ;;; Interactions with other packages:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3166
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3167 ;; -- complete.el --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3168
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3169 ;; This function contributed by Ed Sabol
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3170 (defun tramp-handle-expand-many-files (name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3171 "Like `PC-expand-many-files' for tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3172 (with-parsed-tramp-file-name name nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3173 (when (tramp-ange-ftp-file-name-p multi-method method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3174 (tramp-invoke-ange-ftp 'expand-many-files name))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3175 (save-match-data
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3176 (if (or (string-match "\\*" name)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3177 (string-match "\\?" name)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3178 (string-match "\\[.*\\]" name))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3179 (save-excursion
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3180 ;; Dissect NAME.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3181 (let (bufstr)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3182 ;; Perhaps invoke Ange-FTP.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3183 (when (string= method tramp-ftp-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3184 (signal 'tramp-run-ange-ftp (list 0)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3185 ;; CCC: To do it right, we should quote certain characters
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3186 ;; in the file name, but since the echo command is going to
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3187 ;; break anyway when there are spaces in the file names, we
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3188 ;; don't bother.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3189 ;;-(let ((comint-file-name-quote-list
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3190 ;;- (set-difference tramp-file-name-quote-list
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3191 ;;- '(?\* ?\? ?[ ?]))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3192 ;;- (tramp-send-command
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3193 ;;- multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3194 ;;- (format "echo %s" (comint-quote-filename path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3195 ;;- (tramp-wait-for-output))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3196 (tramp-send-command multi-method method user host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3197 (format "echo %s" path))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3198 (tramp-wait-for-output)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3199 (setq bufstr (buffer-substring (point-min)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3200 (tramp-line-end-position)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3201 (goto-char (point-min))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3202 (if (string-equal path bufstr)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3203 nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3204 (insert "(\"")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3205 (while (search-forward " " nil t)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3206 (delete-backward-char 1)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3207 (insert "\" \""))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3208 (goto-char (point-max))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3209 (delete-backward-char 1)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3210 (insert "\")")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3211 (goto-char (point-min))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3212 (mapcar
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3213 (function (lambda (x)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3214 (tramp-make-tramp-file-name multi-method method
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3215 user host x)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3216 (read (current-buffer))))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3217 (list (tramp-handle-expand-file-name name))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3218
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3219 ;; Check for complete.el and override PC-expand-many-files if appropriate.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3220 (eval-when-compile
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3221 (defun tramp-save-PC-expand-many-files (name))); avoid compiler warning
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3222
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3223 (defun tramp-setup-complete ()
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3224 (fset 'tramp-save-PC-expand-many-files
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3225 (symbol-function 'PC-expand-many-files))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3226 (defun PC-expand-many-files (name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3227 (if (tramp-tramp-file-p name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3228 (tramp-handle-expand-many-files name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3229 (tramp-save-PC-expand-many-files name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3230
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3231 ;; Why isn't eval-after-load sufficient?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3232 (if (fboundp 'PC-expand-many-files)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3233 (tramp-setup-complete)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3234 (eval-after-load "complete" '(tramp-setup-complete)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3235
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3236
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3237
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3238
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3239 ;;; Internal Functions:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3240
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3241 (defun tramp-set-auto-save ()
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3242 (when (and (buffer-file-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3243 (tramp-tramp-file-p (buffer-file-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3244 auto-save-default)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3245 (auto-save-mode 1)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3246 (add-hook 'find-file-hooks 'tramp-set-auto-save t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3247
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3248 (defun tramp-run-test (switch filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3249 "Run `test' on the remote system, given a SWITCH and a FILENAME.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3250 Returns the exit code of the `test' program."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3251 (let ((v (tramp-dissect-file-name filename)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3252 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3253 (tramp-send-command-and-check
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3254 (tramp-file-name-multi-method v) (tramp-file-name-method v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3255 (tramp-file-name-user v) (tramp-file-name-host v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3256 (format "test %s %s" switch
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3257 (tramp-shell-quote-argument (tramp-file-name-path v)))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3258
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3259 (defun tramp-run-test2 (program file1 file2 &optional switch)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3260 "Run `test'-like PROGRAM on the remote system, given FILE1, FILE2.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3261 The optional SWITCH is inserted between the two files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3262 Returns the exit code of the `test' PROGRAM. Barfs if the methods,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3263 hosts, or files, disagree."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3264 (let* ((v1 (tramp-dissect-file-name file1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3265 (v2 (tramp-dissect-file-name file2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3266 (mmethod1 (tramp-file-name-multi-method v1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3267 (mmethod2 (tramp-file-name-multi-method v2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3268 (method1 (tramp-file-name-method v1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3269 (method2 (tramp-file-name-method v2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3270 (user1 (tramp-file-name-user v1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3271 (user2 (tramp-file-name-user v2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3272 (host1 (tramp-file-name-host v1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3273 (host2 (tramp-file-name-host v2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3274 (path1 (tramp-file-name-path v1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3275 (path2 (tramp-file-name-path v2)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3276 (unless (and method1 method2 host1 host2
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3277 (equal mmethod1 mmethod2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3278 (equal method1 method2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3279 (equal user1 user2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3280 (equal host1 host2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3281 (error "tramp-run-test2: %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3282 "only implemented for same method, same user, same host"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3283 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3284 (tramp-send-command-and-check
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3285 mmethod1 method1 user1 host1
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3286 (format "%s %s %s %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3287 program
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3288 (tramp-shell-quote-argument path1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3289 (or switch "")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3290 (tramp-shell-quote-argument path2))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3291
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3292 (defun tramp-buffer-name (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3293 "A name for the connection buffer for USER at HOST using METHOD."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3294 (cond (multi-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3295 (tramp-buffer-name-multi-method "tramp" multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3296 (user
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3297 (format "*tramp/%s %s@%s*" method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3298 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3299 (format "*tramp/%s %s*" method host))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3300
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3301 (defun tramp-buffer-name-multi-method (prefix multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3302 "A name for the multi method connection buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3303 MULTI-METHOD gives the multi method, METHOD the array of methods,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3304 USER the array of user names, HOST the array of host names."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3305 (unless (and (= (length method) (length user))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3306 (= (length method) (length host)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3307 (error "Syntax error in multi method (implementation error)"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3308 (let ((len (length method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3309 (i 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3310 string-list)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3311 (while (< i len)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3312 (setq string-list
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3313 (cons (if (aref user i)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3314 (format "%s#%s@%s:" (aref method i)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3315 (aref user i) (aref host i))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3316 (format "%s@%s:" (aref method i) (aref host i)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3317 string-list))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3318 (incf i))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3319 (format "*%s/%s %s*"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3320 prefix multi-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3321 (apply 'concat (reverse string-list)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3322
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3323 (defun tramp-get-buffer (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3324 "Get the connection buffer to be used for USER at HOST using METHOD."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3325 (get-buffer-create (tramp-buffer-name multi-method method user host)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3326
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3327 (defun tramp-debug-buffer-name (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3328 "A name for the debug buffer for USER at HOST using METHOD."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3329 (cond (multi-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3330 (tramp-buffer-name-multi-method "debug tramp"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3331 multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3332 (user
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3333 (format "*debug tramp/%s %s@%s*" method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3334 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3335 (format "*debug tramp/%s %s*" method host))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3336
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3337 (defun tramp-get-debug-buffer (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3338 "Get the debug buffer for USER at HOST using METHOD."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3339 (get-buffer-create (tramp-debug-buffer-name multi-method method user host)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3340
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3341 (defun tramp-find-executable (multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3342 progname dirlist ignore-tilde)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3343 "Searches for PROGNAME in all directories mentioned in DIRLIST.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3344 First args METHOD, USER and HOST specify the connection, PROGNAME
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3345 is the program to search for, and DIRLIST gives the list of directories
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3346 to search. If IGNORE-TILDE is non-nil, directory names starting
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3347 with `~' will be ignored.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3348
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3349 Returns the full path name of PROGNAME, if found, and nil otherwise.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3350
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3351 This function expects to be in the right *tramp* buffer."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3352 (let (result)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3353 (when ignore-tilde
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3354 ;; Remove all ~/foo directories from dirlist. In Emacs 20,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3355 ;; `remove' is in CL, and we want to avoid CL dependencies.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3356 (let (newdl d)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3357 (while dirlist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3358 (setq d (car dirlist))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3359 (setq dirlist (cdr dirlist))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3360 (unless (char-equal ?~ (aref d 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3361 (setq newdl (cons d newdl))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3362 (setq dirlist (nreverse newdl))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3363 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3364 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3365 (format (concat "while read d; "
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3366 "do if test -x $d/%s -a -f $d/%s; "
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3367 "then echo tramp_executable $d/%s; "
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3368 "break; fi; done <<'EOF'")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3369 progname progname progname))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3370 (mapcar (lambda (d)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3371 (tramp-send-command multi-method method user host d))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3372 dirlist)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3373 (tramp-send-command multi-method method user host "EOF")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3374 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3375 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3376 (when (search-backward "tramp_executable " nil t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3377 (skip-chars-forward "^ ")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3378 (skip-chars-forward " ")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3379 (buffer-substring (point) (tramp-line-end-position)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3380
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3381 (defun tramp-set-remote-path (multi-method method user host var dirlist)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3382 "Sets the remote environment VAR to existing directories from DIRLIST.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3383 I.e., for each directory in DIRLIST, it is tested whether it exists and if
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3384 so, it is added to the environment variable VAR."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3385 (let ((existing-dirs
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3386 (mapcar
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3387 (lambda (x)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3388 (when (and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3389 (file-exists-p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3390 (tramp-make-tramp-file-name multi-method method user host x))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3391 (file-directory-p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3392 (tramp-make-tramp-file-name multi-method method user host x)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3393 x))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3394 dirlist)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3395 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3396 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3397 (concat var "="
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3398 (mapconcat 'identity (delq nil existing-dirs) ":")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3399 "; export " var))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3400 (tramp-wait-for-output)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3401
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3402 ;; -- communication with external shell --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3403
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3404 (defun tramp-find-file-exists-command (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3405 "Find a command on the remote host for checking if a file exists.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3406 Here, we are looking for a command which has zero exit status if the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3407 file exists and nonzero exit status otherwise."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3408 (make-local-variable 'tramp-file-exists-command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3409 (tramp-message 10 "Finding command to check if file exists")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3410 (let ((existing
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3411 (tramp-make-tramp-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3412 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3413 "/")) ;assume this file always exists
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3414 (nonexisting
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3415 (tramp-make-tramp-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3416 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3417 "/ this file does not exist "))) ;assume this never exists
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3418 ;; The algorithm is as follows: we try a list of several commands.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3419 ;; For each command, we first run `$cmd /' -- this should return
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3420 ;; true, as the root directory always exists. And then we run
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3421 ;; `$cmd /this\ file\ does\ not\ exist', hoping that the file indeed
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3422 ;; does not exist. This should return false. We use the first
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3423 ;; command we find that seems to work.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3424 ;; The list of commands to try is as follows:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3425 ;; `ls -d' This works on most systems, but NetBSD 1.4
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3426 ;; has a bug: `ls' always returns zero exit
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3427 ;; status, even for files which don't exist.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3428 ;; `test -e' Some Bourne shells have a `test' builtin
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3429 ;; which does not know the `-e' option.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3430 ;; `/bin/test -e' For those, the `test' binary on disk normally
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3431 ;; provides the option. Alas, the binary
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3432 ;; is sometimes `/bin/test' and sometimes it's
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3433 ;; `/usr/bin/test'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3434 ;; `/usr/bin/test -e' In case `/bin/test' does not exist.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3435 (unless (or
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3436 (and (setq tramp-file-exists-command "ls -d %s")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3437 (tramp-handle-file-exists-p existing)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3438 (not (tramp-handle-file-exists-p nonexisting)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3439 (and (setq tramp-file-exists-command "test -e %s")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3440 (tramp-handle-file-exists-p existing)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3441 (not (tramp-handle-file-exists-p nonexisting)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3442 (and (setq tramp-file-exists-command "/bin/test -e %s")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3443 (tramp-handle-file-exists-p existing)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3444 (not (tramp-handle-file-exists-p nonexisting)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3445 (and (setq tramp-file-exists-command "/usr/bin/test -e %s")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3446 (tramp-handle-file-exists-p existing)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3447 (not (tramp-handle-file-exists-p nonexisting))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3448 (error "Couldn't find command to check if file exists."))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3449
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3450
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3451 ;; CCC test ksh or bash found for tilde expansion?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3452 (defun tramp-find-shell (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3453 "Find a shell on the remote host which groks tilde expansion."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3454 (let ((shell nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3455 (tramp-send-command multi-method method user host "echo ~root")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3456 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3457 (cond
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3458 ((string-match "^~root$" (buffer-string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3459 (setq shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3460 (or (tramp-find-executable multi-method method user host
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3461 "bash" tramp-remote-path t)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3462 (tramp-find-executable multi-method method user host
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3463 "ksh" tramp-remote-path t)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3464 (unless shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3465 (error "Couldn't find a shell which groks tilde expansion"))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3466 ;; Find arguments for this shell.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3467 (let ((alist tramp-sh-extra-args)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3468 item extra-args)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3469 (while (and alist (null extra-args))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3470 (setq item (pop alist))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3471 (when (string-match (car item) shell)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3472 (setq extra-args (cdr item))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3473 (when extra-args (setq shell (concat shell " " extra-args))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3474 (tramp-message
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3475 5 "Starting remote shell `%s' for tilde expansion..." shell)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3476 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3477 multi-method method user host
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3478 (concat "PS1='$ ' ; exec " shell)) ;
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3479 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3480 (get-buffer-process (current-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3481 60 (format "\\(\\$ *\\|\\(%s\\)\\'\\)" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3482 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3483 (error "Couldn't find remote `%s' prompt." shell))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3484 (process-send-string nil (format "PS1='%s%s%s'; PS2=''; PS3=''%s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3485 tramp-rsh-end-of-line
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3486 tramp-end-of-output
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3487 tramp-rsh-end-of-line
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3488 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3489 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3490 (tramp-send-command multi-method method user host "echo hello")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3491 (tramp-message 5 "Waiting for remote `%s' to start up..." shell)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3492 (unless (tramp-wait-for-output 5)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3493 (unless (tramp-wait-for-output 5)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3494 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3495 (error "Couldn't start remote `%s', see buffer `%s' for details"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3496 shell (buffer-name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3497 (tramp-message 5 "Waiting for remote `%s' to start up...done" shell))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3498 (t (tramp-message 5 "Remote `%s' groks tilde expansion, good"
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3499 (tramp-get-remote-sh multi-method method))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3500
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3501 (defun tramp-check-ls-command (multi-method method user host cmd)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3502 "Checks whether the given `ls' executable groks `-n'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3503 METHOD, USER and HOST specify the connection, CMD (the full path name of)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3504 the `ls' executable. Returns t if CMD supports the `-n' option, nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3505 otherwise."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3506 (tramp-message 9 "Checking remote `%s' command for `-n' option"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3507 cmd)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3508 (when (tramp-handle-file-executable-p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3509 (tramp-make-tramp-file-name multi-method method user host cmd))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3510 (let ((result nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3511 (tramp-message 7 "Testing remote command `%s' for -n..." cmd)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3512 (setq result
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3513 (tramp-send-command-and-check
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3514 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3515 (format "%s -lnd / >/dev/null"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3516 cmd)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3517 (tramp-message 7 "Testing remote command `%s' for -n...%s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3518 cmd
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3519 (if (zerop result) "okay" "failed"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3520 (zerop result))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3521
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3522 (defun tramp-check-ls-commands (multi-method method user host cmd dirlist)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3523 "Checks whether the given `ls' executable in one of the dirs groks `-n'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3524 Returns nil if none was found, else the command is returned."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3525 (let ((dl dirlist)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3526 (result nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3527 ;; It would be better to use the CL function `find', but
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3528 ;; we don't want run-time dependencies on CL.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3529 (while (and dl (not result))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3530 (let ((x (concat (file-name-as-directory (car dl)) cmd)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3531 (when (tramp-check-ls-command multi-method method user host x)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3532 (setq result x)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3533 (setq dl (cdr dl)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3534 result))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3535
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3536 (defun tramp-find-ls-command (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3537 "Finds an `ls' command which groks the `-n' option, returning nil if failed.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3538 \(This option prints numeric user and group ids in a long listing.)"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3539 (tramp-message 9 "Finding a suitable `ls' command")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3540 (or
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3541 (tramp-check-ls-commands multi-method method user host "ls" tramp-remote-path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3542 (tramp-check-ls-commands multi-method method user host "gnuls" tramp-remote-path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3543 (tramp-check-ls-commands multi-method method user host "gls" tramp-remote-path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3544
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3545 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3546 ;; -- Functions for establishing connection --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3547 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3548
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3549 (defun tramp-process-actions
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3550 (multi-method method user host actions &optional timeout)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3551 "Process given ACTIONS for login specified via first four args.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3552 ACTIONS is a list of items (REGEXP FUN), where REGEXP specifies what
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3553 output from the remote end to look for, and FUN specifies the action
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3554 to take when the regexp matches."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3555 nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3556
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3557 (defun tramp-open-connection-telnet (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3558 "Open a connection using a telnet METHOD.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3559 This starts the command `telnet HOST ARGS'[*], then waits for a remote
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3560 login prompt, then sends the user name USER, then waits for a remote
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3561 password prompt. It queries the user for the password, then sends the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3562 password to the remote host.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3563
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3564 If USER is nil, uses value returned by `(user-login-name)' instead.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3565
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3566 Recognition of the remote shell prompt is based on the variable
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3567 `shell-prompt-pattern' which must be set up correctly.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3568
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3569 Please note that it is NOT possible to use this connection method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3570 together with an out-of-band transfer method! You must use an inline
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3571 transfer method.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3572
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3573 Maybe the different regular expressions need to be tuned.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3574
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3575 * Actually, the telnet program as well as the args to be used can be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3576 specified in the method parameters, see the variable `tramp-methods'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3577 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3578 (when (tramp-method-out-of-band-p multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3579 (error "Cannot use out-of-band method `%s' with telnet connection method"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3580 method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3581 (when multi-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3582 (error "Cannot multi-connect using telnet connection method"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3583 (tramp-pre-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3584 (tramp-message 7 "Opening connection for %s@%s using %s..."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3585 (or user (user-login-name)) host method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3586 (let ((process-environment (copy-sequence process-environment)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3587 (setenv "TERM" tramp-terminal-type)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3588 (let* ((default-directory (tramp-temporary-file-directory))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3589 (coding-system-for-read (unless (and (not (featurep 'xemacs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3590 (> emacs-major-version 20))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3591 tramp-dos-coding-system))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3592 (p (apply 'start-process
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3593 (tramp-buffer-name multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3594 (tramp-get-buffer multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3595 (tramp-get-telnet-program multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3596 host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3597 (tramp-get-telnet-args multi-method method)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3598 (found nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3599 (pw nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3600 (process-kill-without-query p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3601 (tramp-message 9 "Waiting for login prompt...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3602 (unless (tramp-wait-for-regexp p nil tramp-login-prompt-regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3603 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3604 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3605 (error "Couldn't find remote login prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3606 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3607 ;; Remote login defaults to local one.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3608 (tramp-message 9 "Sending login name %s" (or user (user-login-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3609 (process-send-string p (concat (or user (user-login-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3610 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3611 (tramp-message 9 "Waiting for password prompt...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3612 (unless (setq found (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3613 p nil tramp-password-prompt-regexp))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3614 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3615 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3616 (error "Couldn't find remote password prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3617 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3618 (setq pw (tramp-read-passwd (car found)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3619 (tramp-message 9 "Sending password")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3620 (process-send-string p (concat pw tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3621 (tramp-message 9 "Waiting 30s for remote shell to come up...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3622 (unless (setq found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3623 (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3624 p 30 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3625 tramp-wrong-passwd-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3626 shell-prompt-pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3627 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3628 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3629 (error "Couldn't find remote shell prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3630 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3631 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3632 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3633 (error "Login failed: %s" (nth 1 found)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3634 (tramp-open-connection-setup-interactive-shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3635 p multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3636 (tramp-post-connection multi-method method user host)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3637
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3638 ;; HHH: Changed to handle the case when USER is nil.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3639 (defun tramp-open-connection-rsh (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3640 "Open a connection using an rsh METHOD.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3641 This starts the command `rsh HOST -l USER'[*], then waits for a remote
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3642 password or shell prompt. If a password prompt is seen, the user is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3643 queried for a password, this function sends the password to the remote
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3644 host and waits for a shell prompt.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3645
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3646 If USER is nil, start the command `rsh HOST'[*] instead
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3647
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3648 Recognition of the remote shell prompt is based on the variable
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3649 `shell-prompt-pattern' which must be set up correctly.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3650
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3651 Please note that it is NOT possible to use this connection method with
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3652 an out-of-band transfer method if this function asks the user for a
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3653 password! You must use an inline transfer method in this case.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3654 Sadly, the transfer method cannot be switched on the fly, instead you
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3655 must specify the right method in the file name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3656
46010
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3657 Kludgy feature: if HOST has the form \"xx#yy\", then yy is assumed to
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3658 be a port number for ssh, and \"-p yy\" will be added to the list of
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3659 arguments, and xx will be used as the host name to connect to.
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3660
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3661 * Actually, the rsh program to be used can be specified in the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3662 method parameters, see the variable `tramp-methods'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3663 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3664 (when multi-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3665 (error "Cannot multi-connect using rsh connection method"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3666 (tramp-pre-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3667 (if user
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3668 (tramp-message 7 "Opening connection for %s@%s using %s..."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3669 user host method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3670 (tramp-message 7 "Opening connection at %s using %s..." host method))
46010
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3671 (let ((process-environment (copy-sequence process-environment))
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3672 (bufnam (tramp-buffer-name multi-method method user host))
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3673 (buf (tramp-get-buffer multi-method method user host))
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3674 (rsh-program (tramp-get-rsh-program multi-method method))
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3675 (rsh-args (tramp-get-rsh-args multi-method method)))
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3676 ;; The following should be changed. We need a more general
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3677 ;; mechanism to parse extra host args.
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3678 (when (string-match "\\([^#]*\\)#\\(.*\\)" host)
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3679 (setq rsh-args (cons "-p" (cons (match-string 2 host) rsh-args)))
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3680 (setq host (match-string 1 host)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3681 (setenv "TERM" tramp-terminal-type)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3682 (let* ((default-directory (tramp-temporary-file-directory))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3683 (coding-system-for-read (unless (and (not (featurep 'xemacs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3684 (> emacs-major-version 20))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3685 tramp-dos-coding-system))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3686 (p (if user
46010
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3687 (apply #'start-process bufnam buf rsh-program
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3688 host "-l" user rsh-args)
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3689 (apply #'start-process bufnam buf rsh-program
d07b0e5f80b9 (tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46009
diff changeset
3690 host rsh-args)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3691 (found nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3692 (process-kill-without-query p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3693 (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3694 (setq found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3695 (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3696 p 60
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3697 (format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3698 "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3699 tramp-password-prompt-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3700 shell-prompt-pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3701 (unless found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3702 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3703 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3704 (error "Couldn't find remote shell or passwd prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3705 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3706 (when (tramp-method-out-of-band-p multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3707 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3708 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3709 (error (concat "Out of band method `%s' not applicable"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3710 " for remote shell asking for a password")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3711 method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3712 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3713 (tramp-message 9 "Sending password...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3714 (tramp-enter-password p (nth 1 found))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3715 (tramp-message 9 "Sent password, waiting 60s for remote shell prompt")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3716 (setq found (tramp-wait-for-regexp p 60
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3717 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3718 tramp-wrong-passwd-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3719 shell-prompt-pattern))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3720 (unless found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3721 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3722 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3723 (error "Couldn't find remote shell prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3724 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3725 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3726 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3727 (error "Login failed: %s" (nth 1 found)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3728 (tramp-message 7 "Initializing remote shell")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3729 (tramp-open-connection-setup-interactive-shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3730 p multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3731 (tramp-post-connection multi-method method user host)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3732
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3733 ;; HHH: Changed. Now utilizes (or user (user-login-name)) instead of USER.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3734 (defun tramp-open-connection-su (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3735 "Open a connection using the `su' program with METHOD.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3736 This starts `su - USER', then waits for a password prompt. The HOST
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3737 name must be equal to the local host name or to `localhost'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3738
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3739 If USER is nil, uses value returned by user-login-name instead.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3740
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3741 Recognition of the remote shell prompt is based on the variable
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3742 `shell-prompt-pattern' which must be set up correctly. Note that the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3743 other user may have a different shell prompt than you do, so it is not
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3744 at all unlikely that this variable is set up wrongly!"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3745 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3746 (when (tramp-method-out-of-band-p multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3747 (error "Cannot use out-of-band method `%s' with `su' connection method"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3748 method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3749 (unless (or (string-match (concat "^" (regexp-quote host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3750 (system-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3751 (string= "localhost" host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3752 (error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3753 "Cannot connect to different host `%s' with `su' connection method"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3754 host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3755 (when (not user)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3756 (error "Must give user name for `su' connection method"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3757 (tramp-pre-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3758 (tramp-message 7 "Opening connection for `%s' using `%s'..."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3759 (or user (user-login-name)) method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3760 (let ((process-environment (copy-sequence process-environment)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3761 (setenv "TERM" tramp-terminal-type)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3762 (let* ((default-directory (tramp-temporary-file-directory))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3763 (coding-system-for-read (unless (and (not (featurep 'xemacs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3764 (> emacs-major-version 20))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3765 tramp-dos-coding-system))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3766 (p (apply 'start-process
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3767 (tramp-buffer-name multi-method method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3768 user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3769 (tramp-get-buffer multi-method method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3770 user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3771 (tramp-get-su-program multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3772 (mapcar
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3773 '(lambda (x)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3774 (format-spec
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3775 x (list (cons ?u user))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3776 (tramp-get-su-args multi-method method))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3777 (found nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3778 (pw nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3779 (process-kill-without-query p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3780 (tramp-message 9 "Waiting 30s for shell or password prompt...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3781 (unless (setq found (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3782 p 30
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3783 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3784 tramp-password-prompt-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3785 shell-prompt-pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3786 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3787 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3788 (error "Couldn't find shell or password prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3789 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3790 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3791 (setq pw (tramp-read-passwd (car found)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3792 (tramp-message 9 "Sending password")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3793 (process-send-string p (concat pw tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3794 (tramp-message 9 "Waiting 30s for remote shell to come up...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3795 (unless (setq found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3796 (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3797 p 30 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3798 tramp-wrong-passwd-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3799 shell-prompt-pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3800 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3801 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3802 (error "Couldn't find remote shell prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3803 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3804 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3805 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3806 (error "`su' failed: %s" (nth 1 found))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3807 (tramp-open-connection-setup-interactive-shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3808 p multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3809 (tramp-post-connection multi-method method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3810 user host)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3811
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3812 ;; HHH: Not Changed. Multi method. It is not clear to me how this can
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3813 ;; handle not giving a user name in the "file name".
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3814 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3815 ;; This is more difficult than for the single-hop method. In the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3816 ;; multi-hop-method, the desired behaviour should be that the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3817 ;; user must specify names for the telnet hops of which the user
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3818 ;; name is different than the "original" name (or different from
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3819 ;; the previous hop.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3820 (defun tramp-open-connection-multi (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3821 "Open a multi-hop connection using METHOD.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3822 This uses a slightly changed file name syntax. The idea is to say
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3823 [multi/telnet:u1@h1/rsh:u2@h2]/path/to/file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3824 This will use telnet to log in as u1 to h1, then use rsh from there to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3825 log in as u2 to h2."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3826 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3827 (unless multi-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3828 (error "Multi-hop open connection function called on non-multi method"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3829 (when (tramp-method-out-of-band-p multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3830 (error "No out of band multi-hop connections"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3831 (unless (and (arrayp method) (not (stringp method)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3832 (error "METHOD must be an array of strings for multi methods"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3833 (unless (and (arrayp user) (not (stringp user)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3834 (error "USER must be an array of strings for multi methods"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3835 (unless (and (arrayp host) (not (stringp host)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3836 (error "HOST must be an array of strings for multi methods"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3837 (unless (and (= (length method) (length user))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3838 (= (length method) (length host)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3839 (error "Arrays METHOD, USER, HOST must have equal length"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3840 (tramp-pre-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3841 (tramp-message 7 "Opening `%s' connection..." multi-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3842 (let ((process-environment (copy-sequence process-environment)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3843 (setenv "TERM" tramp-terminal-type)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3844 (let* ((default-directory (tramp-temporary-file-directory))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3845 (coding-system-for-read (unless (and (not (featurep 'xemacs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3846 (> emacs-major-version 20))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3847 tramp-dos-coding-system))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3848 (p (start-process (tramp-buffer-name multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3849 (tramp-get-buffer multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3850 tramp-sh-program))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3851 (num-hops (length method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3852 (i 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3853 (process-kill-without-query p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3854 (tramp-message 9 "Waiting 60s for local shell to come up...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3855 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3856 p 60 (format "%s\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3857 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3858 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3859 (error "Couldn't find local shell prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3860 ;; Now do all the connections as specified.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3861 (while (< i num-hops)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3862 (let* ((m (aref method i))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3863 (u (aref user i))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3864 (h (aref host i))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3865 (entry (assoc m tramp-multi-connection-function-alist))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3866 (multi-func (nth 1 entry))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3867 (command (nth 2 entry)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3868 ;; The multi-funcs don't need to do save-match-data, as that
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3869 ;; is done here.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3870 (funcall multi-func p m u h command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3871 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3872 (incf i)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3873 (tramp-open-connection-setup-interactive-shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3874 p multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3875 (tramp-post-connection multi-method method user host)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3876
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3877 ;; HHH: Changed. Multi method. Don't know how to handle this in the case
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3878 ;; of no user name provided. Hack to make it work as it did before:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3879 ;; changed `user' to `(or user (user-login-name))' in the places where
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3880 ;; the value is actually used.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3881 (defun tramp-multi-connect-telnet (p method user host command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3882 "Issue `telnet' command.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3883 Uses shell COMMAND to issue a `telnet' command to log in as USER to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3884 HOST. You can use percent escapes in COMMAND: `%h' is replaced with
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3885 the host name, and `%n' is replaced with an end of line character, as
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3886 set in `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3887 character.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3888
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3889 If USER is nil, uses the return value of (user-login-name) instead."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3890 (let ((cmd (format-spec command (list (cons ?h host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3891 (cons ?n tramp-rsh-end-of-line))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3892 (cmd1 (format-spec command (list (cons ?h host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3893 (cons ?n ""))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3894 found pw)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3895 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3896 (tramp-message 9 "Sending telnet command `%s'" cmd1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3897 (process-send-string p cmd)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3898 (tramp-message 9 "Waiting 30s for login prompt from %s" host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3899 (unless (tramp-wait-for-regexp p 30 tramp-login-prompt-regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3900 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3901 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3902 (error "Couldn't find login prompt from host %s" host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3903 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3904 (tramp-message 9 "Sending login name %s" (or user (user-login-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3905 (process-send-string p (concat (or user (user-login-name)) tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3906 (tramp-message 9 "Waiting for password prompt")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3907 (unless (setq found (tramp-wait-for-regexp p nil tramp-password-prompt-regexp))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3908 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3909 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3910 (error "Couldn't find password prompt from host %s" host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3911 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3912 (setq pw (tramp-read-passwd
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3913 (format "Password for %s@%s, %s" (or user (user-login-name)) host found)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3914 (tramp-message 9 "Sending password")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3915 (process-send-string p (concat pw tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3916 (tramp-message 9 "Waiting 60s for remote shell to come up...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3917 (unless (setq found (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3918 p 60 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3919 tramp-wrong-passwd-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3920 shell-prompt-pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3921 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3922 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3923 (error "Couldn't find shell prompt from host %s" host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3924 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3925 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3926 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3927 (error "Login to %s failed: %s" (nth 2 found)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3928
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3929 ;; HHH: Changed. Multi method. Don't know how to handle this in the case
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3930 ;; of no user name provided. Hack to make it work as it did before:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3931 ;; changed `user' to `(or user (user-login-name))' in the places where
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3932 ;; the value is actually used.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3933 (defun tramp-multi-connect-rlogin (p method user host command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3934 "Issue `rlogin' command.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3935 Uses shell COMMAND to issue an `rlogin' command to log in as USER to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3936 HOST. You can use percent escapes in COMMAND. `%u' will be replaced
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3937 with the user name, `%h' will be replaced with the host name, and `%n'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3938 will be replaced with the value of `tramp-rsh-end-of-line'. You can use
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3939 `%%' if you want to use a literal percent character.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3940
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3941 If USER is nil, uses the return value of (user-login-name) instead."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3942 (let ((cmd (format-spec command (list (cons ?h host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3943 (cons ?u (or user (user-login-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3944 (cons ?n tramp-rsh-end-of-line))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3945 (cmd1 (format-spec command (list (cons ?h host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3946 (cons ?u (or user (user-login-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3947 (cons ?n ""))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3948 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3949 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3950 (tramp-message 9 "Sending rlogin command `%s'" cmd1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3951 (process-send-string p cmd)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3952 (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3953 (unless (setq found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3954 (tramp-wait-for-regexp p 60
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3955 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3956 tramp-password-prompt-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3957 shell-prompt-pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3958 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3959 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3960 (error "Couldn't find remote shell or passwd prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3961 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3962 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3963 (tramp-message 9 "Sending password...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3964 (tramp-enter-password p (nth 1 found))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3965 (tramp-message 9 "Sent password, waiting 60s for remote shell prompt")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3966 (setq found (tramp-wait-for-regexp p 60
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3967 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3968 tramp-wrong-passwd-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3969 shell-prompt-pattern))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3970 (unless found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3971 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3972 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3973 (error "Couldn't find remote shell prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3974 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3975 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3976 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3977 (error "Login failed: %s" (nth 1 found)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3978
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3979 ;; HHH: Changed. Multi method. Don't know how to handle this in the case
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3980 ;; of no user name provided. Hack to make it work as it did before:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3981 ;; changed `user' to `(or user (user-login-name))' in the places where
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3982 ;; the value is actually used.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3983 (defun tramp-multi-connect-su (p method user host command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3984 "Issue `su' command.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3985 Uses shell COMMAND to issue a `su' command to log in as USER on
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3986 HOST. The HOST name is ignored, this just changes the user id on the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3987 host currently logged in to.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3988
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3989 If USER is nil, uses the return value of (user-login-name) instead.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3990
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3991 You can use percent escapes in the COMMAND. `%u' is replaced with the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3992 user name, and `%n' is replaced with the value of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3993 `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3994 character."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3995 (let ((cmd (format-spec command (list (cons ?u (or user (user-login-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3996 (cons ?n tramp-rsh-end-of-line))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3997 (cmd1 (format-spec command (list (cons ?u (or user (user-login-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3998 (cons ?n ""))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3999 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4000 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4001 (tramp-message 9 "Sending su command `%s'" cmd1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4002 (process-send-string p cmd)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4003 (tramp-message 9 "Waiting 60s for shell or passwd prompt for %s" (or user (user-login-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4004 (unless (setq found (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4005 p 60 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4006 tramp-password-prompt-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4007 shell-prompt-pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4008 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4009 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4010 (error "Couldn't find shell or passwd prompt for %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4011 (or user (user-login-name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4012 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4013 (tramp-message 9 "Sending password...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4014 (tramp-enter-password p (nth 1 found))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4015 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4016 (tramp-message 9 "Sent password, waiting 60s for remote shell prompt")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4017 (setq found (tramp-wait-for-regexp p 60
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4018 (format "\\(%s\\)\\|\\(%s\\)\\'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4019 tramp-wrong-passwd-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4020 shell-prompt-pattern))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4021 (unless found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4022 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4023 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4024 (error "Couldn't find remote shell prompt"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4025 (when (nth 1 found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4026 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4027 (kill-process p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4028 (error "Login failed: %s" (nth 1 found)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4029
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4030 ;; Utility functions.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4031
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4032 (defun tramp-wait-for-regexp (proc timeout regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4033 "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4034 Expects the output of PROC to be sent to the current buffer. Returns
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4035 the string that matched, or nil. Waits indefinitely if TIMEOUT is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4036 nil."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4037 (let ((found nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4038 (start-time (current-time)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4039 (cond (timeout
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4040 ;; Work around a bug in XEmacs 21, where the timeout
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4041 ;; expires faster than it should. This degenerates
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4042 ;; to polling for buggy XEmacsen, but oh, well.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4043 (while (and (not found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4044 (< (tramp-time-diff (current-time) start-time)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4045 timeout))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4046 (with-timeout (timeout)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4047 (while (not found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4048 (accept-process-output proc 1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4049 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4050 (setq found (when (re-search-forward regexp nil t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4051 (tramp-match-string-list)))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4052 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4053 (while (not found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4054 (accept-process-output proc 1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4055 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4056 (setq found (when (re-search-forward regexp nil t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4057 (tramp-match-string-list))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4058 (when tramp-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4059 (append-to-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4060 (tramp-get-debug-buffer tramp-current-multi-method tramp-current-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4061 tramp-current-user tramp-current-host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4062 (point-min) (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4063 (when (not found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4064 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4065 (set-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4066 (tramp-get-debug-buffer tramp-current-multi-method tramp-current-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4067 tramp-current-user tramp-current-host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4068 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4069 (insert "[[Regexp `" regexp "' not found"
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
4070 (if timeout (format " in %d secs" timeout) "")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4071 "]]"))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4072 found))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4073
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4074 (defun tramp-enter-password (p prompt)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4075 "Prompt for a password and send it to the remote end.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4076 Uses PROMPT as a prompt and sends the password to process P."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4077 (let ((pw (tramp-read-passwd prompt)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4078 (process-send-string p (concat pw tramp-rsh-end-of-line))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4079
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4080 ;; HHH: Not Changed. This might handle the case where USER is not
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4081 ;; given in the "File name" very poorly. Then, the local
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4082 ;; variable tramp-current user will be set to nil.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4083 (defun tramp-pre-connection (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4084 "Do some setup before actually logging in.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4085 METHOD, USER and HOST specify the connection."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4086 (set-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4087 (set (make-local-variable 'tramp-current-multi-method) multi-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4088 (set (make-local-variable 'tramp-current-method) method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4089 (set (make-local-variable 'tramp-current-user) user)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4090 (set (make-local-variable 'tramp-current-host) host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4091 (set (make-local-variable 'inhibit-eol-conversion) nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4092 (erase-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4093
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4094 (defun tramp-open-connection-setup-interactive-shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4095 (p multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4096 "Set up an interactive shell.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4097 Mainly sets the prompt and the echo correctly. P is the shell process
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4098 to set up. METHOD, USER and HOST specify the connection."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4099 ;; Wait a bit in case the remote end feels like sending a little
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4100 ;; junk first. It seems that fencepost.gnu.org does this when doing
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4101 ;; a Kerberos login.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4102 (sit-for 1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4103 (tramp-discard-garbage-erase-buffer p multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4104 (process-send-string nil (format "exec %s%s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4105 (tramp-get-remote-sh multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4106 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4107 (when tramp-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4108 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4109 (set-buffer (tramp-get-debug-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4110 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4111 (tramp-insert-with-face
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4112 'bold (format "$ exec %s\n" (tramp-get-remote-sh multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4113 (tramp-message 9 "Waiting 30s for remote `%s' to come up..."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4114 (tramp-get-remote-sh multi-method method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4115 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4116 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4117 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4118 (error "Remote `%s' didn't come up. See buffer `%s' for details"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4119 (tramp-get-remote-sh multi-method method) (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4120 (tramp-message 9 "Setting up remote shell environment")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4121 (tramp-discard-garbage-erase-buffer p multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4122 (process-send-string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4123 nil (format "stty -inlcr -echo kill '^U'%s" tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4124 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4125 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4126 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4127 (error "Couldn't `stty -echo', see buffer `%s'" (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4128 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4129 (process-send-string nil (format "TERM=dumb; export TERM%s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4130 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4131 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4132 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4133 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4134 (error "Couldn't `TERM=dumb; export TERM', see buffer `%s'" (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4135 ;; Try to set up the coding system correctly.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4136 ;; CCC this can't be the right way to do it. Hm.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4137 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4138 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4139 (tramp-message 9 "Determining coding system")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4140 (process-send-string nil (format "echo foo ; echo bar %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4141 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4142 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4143 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4144 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4145 (error "Couldn't `echo foo; echo bar' to determine line endings'"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4146 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4147 (if (featurep 'mule)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4148 ;; Use MULE to select the right EOL convention for communicating
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4149 ;; with the process.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4150 (let* ((cs (or (process-coding-system p) (cons 'undecided 'undecided)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4151 cs-decode cs-encode)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4152 (when (symbolp cs) (setq cs (cons cs cs)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4153 (setq cs-decode (car cs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4154 (setq cs-encode (cdr cs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4155 (unless cs-decode (setq cs-decode 'undecided))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4156 (unless cs-encode (setq cs-encode 'undecided))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4157 (setq cs-encode (tramp-coding-system-change-eol-conversion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4158 cs-encode 'unix))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4159 (when (search-forward "\r" nil t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4160 (setq cs-decode (tramp-coding-system-change-eol-conversion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4161 cs-decode 'dos)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4162 (set-buffer-process-coding-system cs-decode cs-encode))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4163 ;; Look for ^M and do something useful if found.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4164 (when (search-forward "\r" nil t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4165 ;; We have found a ^M but cannot frob the process coding system
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4166 ;; because we're running on a non-MULE Emacs. Let's try
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4167 ;; stty, instead.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4168 (tramp-message 9 "Trying `stty -onlcr'")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4169 (process-send-string nil (format "stty -onlcr%s" tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4170 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4171 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4172 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4173 (error "Couldn't `stty -onlcr', see buffer `%s'" (buffer-name))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4174 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4175 (tramp-message
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4176 9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1'")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4177 (process-send-string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4178 nil (format "HISTFILE=$HOME/.tramp_history; HISTSIZE=1%s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4179 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4180 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4181 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4182 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4183 (error (concat "Couldn't `HISTFILE=$HOME/.tramp_history; "
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4184 "HISTSIZE=1', see buffer `%s'")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4185 (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4186 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4187 (tramp-message 9 "Waiting 30s for `set +o vi +o emacs'")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4188 (process-send-string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4189 nil (format "set +o vi +o emacs%s" ;mustn't `>/dev/null' with AIX?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4190 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4191 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4192 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4193 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4194 (error "Couldn't `set +o vi +o emacs', see buffer `%s'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4195 (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4196 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4197 (tramp-message 9 "Waiting 30s for `unset MAIL MAILCHECK MAILPATH'")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4198 (process-send-string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4199 nil (format "unset MAIL MAILCHECK MAILPATH 1>/dev/null 2>/dev/null%s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4200 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4201 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4202 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4203 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4204 (error "Couldn't `unset MAIL MAILCHECK MAILPATH', see buffer `%s'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4205 (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4206 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4207 (tramp-message 9 "Waiting 30s for `unset CDPATH'")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4208 (process-send-string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4209 nil (format "unset CDPATH%s" tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4210 (unless (tramp-wait-for-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4211 p 30 (format "\\(\\$ *\\|%s\\)\\'" shell-prompt-pattern))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4212 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4213 (error "Couldn't `unset CDPATH', see buffer `%s'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4214 (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4215 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4216 (tramp-message 9 "Setting shell prompt")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4217 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4218 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4219 (format "PS1='%s%s%s'; PS2=''; PS3=''"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4220 tramp-rsh-end-of-line
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4221 tramp-end-of-output
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4222 tramp-rsh-end-of-line))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4223 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4224 (tramp-send-command multi-method method user host "echo hello")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4225 (tramp-message 9 "Waiting for remote `%s' to come up..."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4226 (tramp-get-remote-sh multi-method method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4227 (unless (tramp-wait-for-output 5)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4228 (unless (tramp-wait-for-output 5)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4229 (pop-to-buffer (buffer-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4230 (error "Couldn't set remote shell prompt. See buffer `%s' for details"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4231 (buffer-name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4232 (tramp-message 7 "Waiting for remote `%s' to come up...done"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4233 (tramp-get-remote-sh multi-method method)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4234
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4235 (defun tramp-post-connection (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4236 "Prepare a remote shell before being able to work on it.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4237 METHOD, USER and HOST specify the connection.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4238 Among other things, this finds a shell which groks tilde expansion,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4239 tries to find an `ls' command which groks the `-n' option, sets the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4240 locale to C and sets up the remote shell search path."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4241 ;; Search for a good shell before searching for a command which
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4242 ;; checks if a file exists. This is done because Tramp wants to use
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4243 ;; "test foo; echo $?" to check if various conditions hold, and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4244 ;; there are buggy /bin/sh implementations which don't execute the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4245 ;; "echo $?" part if the "test" part has an error. In particular,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4246 ;; the Solaris /bin/sh is a problem. I'm betting that all systems
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4247 ;; with buggy /bin/sh implementations will have a working bash or
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4248 ;; ksh. Whee...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4249 (tramp-find-shell multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4250 (tramp-find-file-exists-command multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4251 (sit-for 1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4252 ;; Without (sit-for 0.1) at least, my machine will almost always blow
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4253 ;; up on 'not numberp /root' - a race that causes the 'echo ~root'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4254 ;; output of (tramp-find-shell) to show up along with the output of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4255 ;; (tramp-find-ls-command) testing.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4256 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4257 ;; I can't work out why this is a problem though. The (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4258 ;; call in (tramp-find-shell) *should* make this not happen, I thought.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4259 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4260 ;; After much debugging I couldn't find any problem with the implementation
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4261 ;; of that function though. The workaround stays for me at least. :/
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4262 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4263 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4264 (make-local-variable 'tramp-ls-command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4265 (setq tramp-ls-command (tramp-find-ls-command multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4266 (unless tramp-ls-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4267 (tramp-message
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4268 1
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4269 "Danger! Couldn't find ls which groks -n. Muddling through anyway")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4270 (setq tramp-ls-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4271 (tramp-find-executable multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4272 "ls" tramp-remote-path nil)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4273 (unless tramp-ls-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4274 (error "Fatal error: Couldn't find remote executable `ls'"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4275 (tramp-message 5 "Using remote command `%s' for getting directory listings"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4276 tramp-ls-command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4277 (tramp-send-command multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4278 (concat "tramp_set_exit_status () {" tramp-rsh-end-of-line
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4279 "return $1" tramp-rsh-end-of-line
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4280 "}"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4281 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4282 ;; Set remote PATH variable.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4283 (tramp-set-remote-path multi-method method user host "PATH" tramp-remote-path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4284 ;; Tell remote shell to use standard time format, needed for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4285 ;; parsing `ls -l' output.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4286 (tramp-send-command multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4287 "LC_TIME=C; export LC_TIME; echo huhu")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4288 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4289 (tramp-send-command multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4290 "mesg n; echo huhu")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4291 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4292 (tramp-send-command multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4293 "biff n ; echo huhu")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4294 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4295 ;; Unalias ls(1) to work around issues with those silly people who make it
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4296 ;; spit out ANSI escapes or whatever.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4297 (tramp-send-command multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4298 "unalias ls; echo huhu")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4299 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4300 ;; Does `test A -nt B' work? Use abominable `find' construct if it
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4301 ;; doesn't. BSD/OS 4.0 wants the parentheses around the command,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4302 ;; for otherwise the shell crashes.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4303 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4304 (make-local-variable 'tramp-test-groks-nt)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4305 (tramp-send-command multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4306 "( test / -nt / )")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4307 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4308 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4309 (setq tramp-test-groks-nt
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4310 (looking-at (format "\n%s\n" (regexp-quote tramp-end-of-output))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4311 (unless tramp-test-groks-nt
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4312 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4313 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4314 (concat "tramp_test_nt () {" tramp-rsh-end-of-line
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4315 "test -n \"`find $1 -prune -newer $2 -print`\"" tramp-rsh-end-of-line
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4316 "}")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4317 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4318 ;; Find a `perl'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4319 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4320 (let ((tramp-remote-perl
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4321 (or (tramp-find-executable multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4322 "perl5" tramp-remote-path nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4323 (tramp-find-executable multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4324 "perl" tramp-remote-path nil))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4325 (when tramp-remote-perl
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4326 (tramp-set-connection-property "perl" tramp-remote-perl multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4327 ;; Set up stat in Perl if we can.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4328 (when tramp-remote-perl
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4329 (tramp-message 5 "Sending the Perl `file-attributes' implementation.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4330 (tramp-send-linewise
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4331 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4332 (concat "tramp_file_attributes () {\n"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4333 tramp-remote-perl
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4334 " -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4335 "}"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4336 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4337 (when (string= (tramp-get-encoding-command multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4338 "tramp_mimencode")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4339 (tramp-message 5 "Sending the Perl `mime-encode' implementation.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4340 (tramp-send-linewise
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4341 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4342 (concat "tramp_mimencode () {\n"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4343 (if (tramp-find-executable multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4344 "mimencode" tramp-remote-path t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4345 "mimencode -b $1"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4346 (concat tramp-remote-perl
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4347 " -e '" tramp-perl-mime-encode "' $1 2>/dev/null"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4348 "\n}"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4349 (tramp-wait-for-output))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4350 (when (string= (tramp-get-decoding-command multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4351 "tramp_mimedecode")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4352 (tramp-message 5 "Sending the Perl `mime-decode' implementation.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4353 (tramp-send-linewise
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4354 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4355 (concat "tramp_mimedecode () {\n"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4356 (if (tramp-find-executable multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4357 "mimencode" tramp-remote-path t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4358 "mimencode -u -b $1"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4359 (concat tramp-remote-perl
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4360 " -e '" tramp-perl-mime-decode "' $1 2>/dev/null"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4361 "\n}"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4362 (tramp-wait-for-output)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4363 ;; Find ln(1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4364 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4365 (let ((ln (tramp-find-executable multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4366 "ln" tramp-remote-path nil)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4367 (when ln
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4368 (tramp-set-connection-property "ln" ln multi-method method user host)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4369 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4370 ;; If encoding/decoding command are given, test to see if they work.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4371 ;; CCC: Maybe it would be useful to run the encoder both locally and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4372 ;; remotely to see if they produce the same result.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4373 (let ((decoding (tramp-get-decoding-command multi-method method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4374 (encoding (tramp-get-encoding-command multi-method method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4375 (magic-string "xyzzy"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4376 (when (and (or decoding encoding) (not (and decoding encoding)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4377 (tramp-kill-process multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4378 (error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4379 "Must give both decoding and encoding command in method definition"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4380 (when (and decoding encoding)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4381 (tramp-message
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4382 5
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4383 "Checking to see if encoding/decoding commands work on remote host...")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4384 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4385 multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4386 (format "echo %s | %s | %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4387 (tramp-shell-quote-argument magic-string) encoding decoding))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4388 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4389 (unless (looking-at (regexp-quote magic-string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4390 (tramp-kill-process multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4391 (error "Remote host cannot execute de/encoding commands. See buffer `%s' for details"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4392 (buffer-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4393 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4394 (tramp-message
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4395 5 "Checking to see if encoding/decoding commands work on remote host...done"))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4396
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4397
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4398 (defun tramp-maybe-open-connection (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4399 "Maybe open a connection to HOST, logging in as USER, using METHOD.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4400 Does not do anything if a connection is already open, but re-opens the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4401 connection if a previous connection has died for some reason."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4402 (let ((p (get-buffer-process (tramp-get-buffer multi-method method user host))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4403 (unless (and p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4404 (processp p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4405 (memq (process-status p) '(run open)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4406 (when (and p (processp p))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4407 (delete-process p))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4408 (funcall (tramp-get-connection-function multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4409 multi-method method user host))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4410
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4411 (defun tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4412 (multi-method method user host command &optional noerase)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4413 "Send the COMMAND to USER at HOST (logged in using METHOD).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4414 Erases temporary buffer before sending the command (unless NOERASE
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4415 is true)."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4416 (tramp-maybe-open-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4417 (when tramp-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4418 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4419 (set-buffer (tramp-get-debug-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4420 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4421 (tramp-insert-with-face 'bold (format "$ %s\n" command))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4422 (let ((proc nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4423 (set-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4424 (unless noerase (erase-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4425 (setq proc (get-buffer-process (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4426 (process-send-string proc
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4427 (concat command tramp-rsh-end-of-line))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4428
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4429 ;; It seems that Tru64 Unix does not like it if long strings are sent
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4430 ;; to it in one go. (This happens when sending the Perl
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4431 ;; `file-attributes' implementation, for instance.) Therefore, we
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4432 ;; have this function which waits a bit at each line.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4433 (defun tramp-send-linewise
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4434 (multi-method method user host string &optional noerase)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4435 "Send the STRING to USER at HOST linewise.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4436 Erases temporary buffer before sending the STRING (unless NOERASE
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4437 is true).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4438
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4439 The STRING is expected to use Unix line-endings, but the lines sent to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4440 the remote host use line-endings as defined in the variable
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4441 `tramp-rsh-end-of-line'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4442 (tramp-maybe-open-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4443 (when tramp-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4444 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4445 (set-buffer (tramp-get-debug-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4446 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4447 (tramp-insert-with-face 'bold (format "$ %s\n" string))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4448 (let ((proc nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4449 (lines (split-string string "\n")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4450 (set-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4451 (unless noerase (erase-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4452 (setq proc (get-buffer-process (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4453 (mapcar (lambda (x)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4454 (sleep-for 0.1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4455 (process-send-string proc
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4456 (concat x tramp-rsh-end-of-line)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4457 lines)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4458
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4459 (defun tramp-wait-for-output (&optional timeout)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4460 "Wait for output from remote rsh command."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4461 (let ((proc (get-buffer-process (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4462 (found nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4463 (start-time (current-time))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4464 (end-of-output (concat "^"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4465 (regexp-quote tramp-end-of-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4466 "$")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4467 ;; Algorithm: get waiting output. See if last line contains
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4468 ;; end-of-output sentinel. If not, wait a bit and again get
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4469 ;; waiting output. Repeat until timeout expires or end-of-output
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4470 ;; sentinel is seen. Will hang if timeout is nil and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4471 ;; end-of-output sentinel never appears.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4472 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4473 (cond (timeout
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4474 ;; Work around an XEmacs bug, where the timeout expires
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4475 ;; faster than it should. This degenerates into polling
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4476 ;; for buggy XEmacsen, but oh, well.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4477 (while (and (not found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4478 (< (tramp-time-diff (current-time) start-time)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4479 timeout))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4480 (with-timeout (timeout)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4481 (while (not found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4482 (accept-process-output proc 1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4483 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4484 (forward-line -1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4485 (setq found (looking-at end-of-output))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4486 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4487 (while (not found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4488 (accept-process-output proc 1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4489 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4490 (forward-line -1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4491 (setq found (looking-at end-of-output))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4492 ;; At this point, either the timeout has expired or we have found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4493 ;; the end-of-output sentinel.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4494 (when found
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4495 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4496 (forward-line -2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4497 (delete-region (point) (point-max)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4498 ;; Add output to debug buffer if appropriate.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4499 (when tramp-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4500 (append-to-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4501 (tramp-get-debug-buffer tramp-current-multi-method tramp-current-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4502 tramp-current-user tramp-current-host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4503 (point-min) (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4504 (when (not found)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4505 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4506 (set-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4507 (tramp-get-debug-buffer tramp-current-multi-method tramp-current-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4508 tramp-current-user tramp-current-host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4509 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4510 (insert "[[Remote prompt `" end-of-output "' not found"
46048
05db6f1e91ca (tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46010
diff changeset
4511 (if timeout (format " in %d secs" timeout) "")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4512 "]]"))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4513 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4514 ;; Return value is whether end-of-output sentinel was found.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4515 found))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4516
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4517 (defun tramp-match-string-list (&optional string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4518 "Returns list of all match strings.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4519 That is, (list (match-string 0) (match-string 1) ...), according to the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4520 number of matches."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4521 (let* ((nmatches (/ (length (match-data)) 2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4522 (i (- nmatches 1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4523 (res nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4524 (while (>= i 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4525 (setq res (cons (match-string i string) res))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4526 (setq i (- i 1)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4527 res))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4528
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4529 (defun tramp-send-command-and-check (multi-method method user host command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4530 &optional subshell)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4531 "Run COMMAND and check its exit status.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4532 MULTI-METHOD and METHOD specify how to log in (as USER) to the remote HOST.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4533 Sends `echo $?' along with the COMMAND for checking the exit status. If
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4534 COMMAND is nil, just sends `echo $?'. Returns the exit status found.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4535
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4536 If the optional argument SUBSHELL is non-nil, the command is executed in
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4537 a subshell, ie surrounded by parentheses."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4538 (tramp-send-command multi-method method user host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4539 (concat (if subshell "( " "")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4540 command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4541 (if command " 2>/dev/null; " "")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4542 "echo tramp_exit_status $?"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4543 (if subshell " )" " ")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4544 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4545 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4546 (unless (search-backward "tramp_exit_status " nil t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4547 (error "Couldn't find exit status of `%s'" command))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4548 (skip-chars-forward "^ ")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4549 (read (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4550
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4551 (defun tramp-barf-unless-okay (multi-method method user host command subshell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4552 signal fmt &rest args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4553 "Run COMMAND, check exit status, throw error if exit status not okay.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4554 Similar to `tramp-send-command-and-check' but accepts two more arguments
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4555 FMT and ARGS which are passed to `error'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4556 (unless (zerop (tramp-send-command-and-check
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4557 multi-method method user host command subshell))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4558 ;; CCC: really pop-to-buffer? Maybe it's appropriate to be more
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4559 ;; silent.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4560 (pop-to-buffer (current-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4561 (funcall 'signal signal (apply 'format fmt args))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4562
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4563 (defun tramp-send-region (multi-method method user host start end)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4564 "Send the region from START to END to remote command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4565 running as USER on HOST using METHOD."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4566 (let ((proc (get-buffer-process
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4567 (tramp-get-buffer multi-method method user host))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4568 (unless proc
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4569 (error "Can't send region to remote host -- not logged in"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4570 (process-send-region proc start end)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4571 (when tramp-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4572 (append-to-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4573 (tramp-get-debug-buffer multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4574 start end))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4575
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4576 (defun tramp-send-eof (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4577 "Send EOF to the remote end.
46151
eff75835ac2e (tramp-send-eof): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 46060
diff changeset
4578 METHOD, HOST and USER specify the connection."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4579 (let ((proc (get-buffer-process
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4580 (tramp-get-buffer multi-method method user host))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4581 (unless proc
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4582 (error "Can't send EOF to remote host -- not logged in"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4583 (process-send-eof proc)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4584 ; (process-send-string proc "\^D")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4585
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4586 (defun tramp-kill-process (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4587 "Kill the connection process used by Tramp.
46151
eff75835ac2e (tramp-send-eof): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 46060
diff changeset
4588 MULTI-METHOD, METHOD, USER, and HOST specify the connection."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4589 (let ((proc (get-buffer-process
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4590 (tramp-get-buffer multi-method method user host))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4591 (kill-process proc)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4592
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4593 (defun tramp-discard-garbage-erase-buffer (p multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4594 "Erase buffer, then discard subsequent garbage.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4595 If `tramp-discard-garbage' is nil, just erase buffer."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4596 (if (not tramp-discard-garbage)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4597 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4598 (while (prog1 (erase-buffer) (accept-process-output p 0.25))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4599 (when tramp-debug-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4600 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4601 (set-buffer (tramp-get-debug-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4602 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4603 (tramp-insert-with-face
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4604 'bold (format "Additional characters detected\n")))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4605
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4606 (defun tramp-mode-string-to-int (mode-string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4607 "Converts a ten-letter `drwxrwxrwx'-style mode string into mode bits."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4608 (let* ((mode-chars (string-to-vector mode-string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4609 (owner-read (aref mode-chars 1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4610 (owner-write (aref mode-chars 2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4611 (owner-execute-or-setid (aref mode-chars 3))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4612 (group-read (aref mode-chars 4))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4613 (group-write (aref mode-chars 5))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4614 (group-execute-or-setid (aref mode-chars 6))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4615 (other-read (aref mode-chars 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4616 (other-write (aref mode-chars 8))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4617 (other-execute-or-sticky (aref mode-chars 9)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4618 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4619 (logior
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4620 (case owner-read
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4621 (?r (tramp-octal-to-decimal "00400")) (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4622 (t (error "Second char `%c' must be one of `r-'" owner-read)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4623 (case owner-write
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4624 (?w (tramp-octal-to-decimal "00200")) (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4625 (t (error "Third char `%c' must be one of `w-'" owner-write)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4626 (case owner-execute-or-setid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4627 (?x (tramp-octal-to-decimal "00100"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4628 (?S (tramp-octal-to-decimal "04000"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4629 (?s (tramp-octal-to-decimal "04100"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4630 (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4631 (t (error "Fourth char `%c' must be one of `xsS-'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4632 owner-execute-or-setid)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4633 (case group-read
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4634 (?r (tramp-octal-to-decimal "00040")) (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4635 (t (error "Fifth char `%c' must be one of `r-'" group-read)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4636 (case group-write
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4637 (?w (tramp-octal-to-decimal "00020")) (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4638 (t (error "Sixth char `%c' must be one of `w-'" group-write)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4639 (case group-execute-or-setid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4640 (?x (tramp-octal-to-decimal "00010"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4641 (?S (tramp-octal-to-decimal "02000"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4642 (?s (tramp-octal-to-decimal "02010"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4643 (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4644 (t (error "Seventh char `%c' must be one of `xsS-'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4645 group-execute-or-setid)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4646 (case other-read
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4647 (?r (tramp-octal-to-decimal "00004")) (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4648 (t (error "Eighth char `%c' must be one of `r-'" other-read)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4649 (case other-write
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4650 (?w (tramp-octal-to-decimal "00002")) (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4651 (t (error "Nineth char `%c' must be one of `w-'" other-write)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4652 (case other-execute-or-sticky
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4653 (?x (tramp-octal-to-decimal "00001"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4654 (?T (tramp-octal-to-decimal "01000"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4655 (?t (tramp-octal-to-decimal "01001"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4656 (?- 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4657 (t (error "Tenth char `%c' must be one of `xtT-'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4658 other-execute-or-sticky)))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4659
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4660
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4661 (defun tramp-file-mode-from-int (mode)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4662 "Turn an integer representing a file mode into an ls(1)-like string."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4663 (let ((type (cdr (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4664 (user (logand (lsh mode -6) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4665 (group (logand (lsh mode -3) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4666 (other (logand (lsh mode -0) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4667 (suid (> (logand (lsh mode -9) 4) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4668 (sgid (> (logand (lsh mode -9) 2) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4669 (sticky (> (logand (lsh mode -9) 1) 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4670 (setq user (tramp-file-mode-permissions user suid "s"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4671 (setq group (tramp-file-mode-permissions group sgid "s"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4672 (setq other (tramp-file-mode-permissions other sticky "t"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4673 (concat type user group other)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4674
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4675
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4676 (defun tramp-file-mode-permissions (perm suid suid-text)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4677 "Convert a permission bitset into a string.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4678 This is used internally by `tramp-file-mode-from-int'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4679 (let ((r (> (logand perm 4) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4680 (w (> (logand perm 2) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4681 (x (> (logand perm 1) 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4682 (concat (or (and r "r") "-")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4683 (or (and w "w") "-")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4684 (or (and suid x suid-text) ; suid, execute
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4685 (and suid (upcase suid-text)) ; suid, !execute
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4686 (and x "x") "-")))) ; !suid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4687
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4688
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4689 (defun tramp-decimal-to-octal (i)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4690 "Return a string consisting of the octal digits of I.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4691 Not actually used. Use `(format \"%o\" i)' instead?"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4692 (cond ((< i 0) (error "Cannot convert negative number to octal"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4693 ((not (integerp i)) (error "Cannot convert non-integer to octal"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4694 ((zerop i) "0")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4695 (t (concat (tramp-decimal-to-octal (/ i 8))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4696 (number-to-string (% i 8))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4697
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4698
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4699 ;;(defun tramp-octal-to-decimal (ostr)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4700 ;; "Given a string of octal digits, return a decimal number."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4701 ;; (cond ((null ostr) 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4702 ;; ((string= "" ostr) 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4703 ;; (t (let ((last (aref ostr (1- (length ostr))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4704 ;; (rest (substring ostr 0 (1- (length ostr)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4705 ;; (unless (and (>= last ?0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4706 ;; (<= last ?7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4707 ;; (error "Not an octal digit: %c" last))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4708 ;; (+ (- last ?0) (* 8 (tramp-octal-to-decimal rest)))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4709 ;; Kudos to Gerd Moellmann for this suggestion.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4710 (defun tramp-octal-to-decimal (ostr)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4711 "Given a string of octal digits, return a decimal number."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4712 (let ((x (or ostr "")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4713 ;; `save-match' is in `tramp-mode-string-to-int' which calls this.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4714 (unless (string-match "\\`[0-7]*\\'" x)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4715 (error "Non-octal junk in string `%s'" x))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4716 (string-to-number ostr 8)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4717
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4718 (defun tramp-shell-case-fold (string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4719 "Converts STRING to shell glob pattern which ignores case."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4720 (mapconcat
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4721 (lambda (c)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4722 (if (equal (downcase c) (upcase c))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4723 (vector c)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4724 (format "[%c%c]" (downcase c) (upcase c))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4725 string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4726 ""))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4727
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4728
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4729 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4730 ;; -- TRAMP file names --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4731 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4732 ;; Conversion functions between external representation and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4733 ;; internal data structure. Convenience functions for internal
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4734 ;; data structure.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4735
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4736 (defstruct tramp-file-name multi-method method user host path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4737
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4738 (defun tramp-tramp-file-p (name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4739 "Return t iff NAME is a tramp file."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4740 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4741 (string-match tramp-file-name-regexp name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4742
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4743 ;; HHH: Changed. Used to assign the return value of (user-login-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4744 ;; to the `user' part of the structure if a user name was not
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4745 ;; provided, now it assigns nil.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4746 (defun tramp-dissect-file-name (name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4747 "Return an `tramp-file-name' structure.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4748 The structure consists of remote method, remote user, remote host and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4749 remote path name."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4750 (let (method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4751 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4752 (unless (string-match (nth 0 tramp-file-name-structure) name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4753 (error "Not a tramp file name: %s" name))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4754 (setq method (match-string (nth 1 tramp-file-name-structure) name))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4755 (if (and method (member method tramp-multi-methods))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4756 ;; If it's a multi method, the file name structure contains
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4757 ;; arrays of method, user and host.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4758 (tramp-dissect-multi-file-name name)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4759 ;; Normal method. First, find out default method.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4760 (let ((user (match-string (nth 2 tramp-file-name-structure) name))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4761 (host (match-string (nth 3 tramp-file-name-structure) name))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4762 (path (match-string (nth 4 tramp-file-name-structure) name)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4763 (when (not method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4764 (setq method (tramp-find-default-method user host)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4765 (make-tramp-file-name
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4766 :multi-method nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4767 :method method
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4768 :user (or user nil)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4769 :host host
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4770 :path path))))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4771
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4772 (defun tramp-find-default-method (user host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4773 "Look up the right method to use in `tramp-default-method-alist'."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4774 (let ((choices tramp-default-method-alist)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4775 (method tramp-default-method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4776 item)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4777 (while choices
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4778 (setq item (pop choices))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4779 (when (and (string-match (nth 0 item) host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4780 (string-match (nth 1 item) (or user "")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4781 (setq method (nth 2 item))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4782 (setq choices nil)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4783 method))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4784
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4785 ;; HHH: Not Changed. Multi method. Will probably not handle the case where
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4786 ;; a user name is not provided in the "file name" very well.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4787 (defun tramp-dissect-multi-file-name (name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4788 "Not implemented yet."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4789 (let ((regexp (nth 0 tramp-multi-file-name-structure))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4790 (method-index (nth 1 tramp-multi-file-name-structure))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4791 (hops-index (nth 2 tramp-multi-file-name-structure))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4792 (path-index (nth 3 tramp-multi-file-name-structure))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4793 (hop-regexp (nth 0 tramp-multi-file-name-hop-structure))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4794 (hop-method-index (nth 1 tramp-multi-file-name-hop-structure))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4795 (hop-user-index (nth 2 tramp-multi-file-name-hop-structure))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4796 (hop-host-index (nth 3 tramp-multi-file-name-hop-structure))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4797 method hops len hop-methods hop-users hop-hosts path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4798 (unless (string-match (format regexp hop-regexp) name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4799 (error "Not a multi tramp file name: %s" name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4800 (setq method (match-string method-index name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4801 (setq hops (match-string hops-index name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4802 (setq len (/ (length (match-data t)) 2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4803 (when (< path-index 0) (incf path-index len))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4804 (setq path (match-string path-index name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4805 (let ((index 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4806 (while (string-match hop-regexp hops index)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4807 (setq index (match-end 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4808 (setq hop-methods
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4809 (cons (match-string hop-method-index hops) hop-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4810 (setq hop-users
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4811 (cons (match-string hop-user-index hops) hop-users))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4812 (setq hop-hosts
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4813 (cons (match-string hop-host-index hops) hop-hosts))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4814 (make-tramp-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4815 :multi-method method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4816 :method (apply 'vector (reverse hop-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4817 :user (apply 'vector (reverse hop-users))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4818 :host (apply 'vector (reverse hop-hosts))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4819 :path path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4820
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4821 (defun tramp-make-tramp-file-name (multi-method method user host path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4822 "Constructs a tramp file name from METHOD, USER, HOST and PATH."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4823 (unless tramp-make-tramp-file-format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4824 (error "`tramp-make-tramp-file-format' is nil"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4825 (if multi-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4826 (tramp-make-tramp-multi-file-name multi-method method user host path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4827 (if user
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4828 (format-spec tramp-make-tramp-file-format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4829 (list (cons ?m method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4830 (cons ?u user)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4831 (cons ?h host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4832 (cons ?p path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4833 (format-spec tramp-make-tramp-file-user-nil-format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4834 (list (cons ?m method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4835 (cons ?h host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4836 (cons ?p path))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4837
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4838 ;; CCC: Henrik Holm: Not Changed. Multi Method. What should be done
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4839 ;; with this when USER is nil?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4840 (defun tramp-make-tramp-multi-file-name (multi-method method user host path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4841 "Constructs a tramp file name for a multi-hop method."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4842 (unless tramp-make-multi-tramp-file-format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4843 (error "`tramp-make-multi-tramp-file-format' is nil"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4844 (let* ((prefix-format (nth 0 tramp-make-multi-tramp-file-format))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4845 (hop-format (nth 1 tramp-make-multi-tramp-file-format))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4846 (path-format (nth 2 tramp-make-multi-tramp-file-format))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4847 (prefix (format-spec prefix-format (list (cons ?m multi-method))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4848 (hops "")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4849 (path (format-spec path-format (list (cons ?p path))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4850 (i 0)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4851 (len (length method)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4852 (while (< i len)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4853 (let ((m (aref method i))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4854 (u (aref user i))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4855 (h (aref host i)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4856 (setq hops (concat hops
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4857 (format-spec
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4858 hop-format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4859 (list (cons ?m m)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4860 (cons ?u u)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4861 (cons ?h h)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4862 (incf i)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4863 (concat prefix hops path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4864
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4865 (defun tramp-make-rcp-program-file-name (user host path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4866 "Create a file name suitable to be passed to `rcp'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4867 (if user
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4868 (format "%s@%s:%s" user host path)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4869 (format "%s:%s" host path)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4870
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4871 (defun tramp-make-ange-ftp-file-name (user host path)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4872 "Given user, host, and path, return an Ange-FTP filename."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4873 (if user
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4874 (format "/%s@%s:%s" user host path)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4875 (format "/%s:%s" host path)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4876
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4877 (defun tramp-method-out-of-band-p (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4878 "Return t if this is an out-of-band method, nil otherwise.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4879 It is important to check for this condition, since it is not possible
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4880 to enter a password for the `tramp-rcp-program'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4881 (tramp-get-rcp-program multi-method method))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4882
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4883 ;; Variables local to connection.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4884
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4885 (defun tramp-get-ls-command (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4886 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4887 (tramp-maybe-open-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4888 (set-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4889 tramp-ls-command))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4890
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4891 (defun tramp-get-test-groks-nt (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4892 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4893 (tramp-maybe-open-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4894 (set-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4895 tramp-test-groks-nt))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4896
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4897 (defun tramp-get-file-exists-command (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4898 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4899 (tramp-maybe-open-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4900 (set-buffer (tramp-get-buffer multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4901 tramp-file-exists-command))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4902
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4903 (defun tramp-get-remote-perl (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4904 (tramp-get-connection-property "perl" nil multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4905
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4906 (defun tramp-get-remote-ln (multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4907 (tramp-get-connection-property "ln" nil multi-method method user host))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4908
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4909 ;; Get a property of a TRAMP connection.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4910 (defun tramp-get-connection-property (property default multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4911 "Get the named property for the connection.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4912 If the value is not set for the connection, return `default'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4913 (tramp-maybe-open-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4914 (with-current-buffer (tramp-get-buffer multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4915 (let (error)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4916 (condition-case nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4917 (symbol-value (intern (concat "tramp-connection-property-" property)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4918 (error default)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4919
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4920 ;; Set a property of a TRAMP connection.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4921 (defun tramp-set-connection-property (property value multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4922 "Set the named property of a TRAMP connection."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4923 (tramp-maybe-open-connection multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4924 (with-current-buffer (tramp-get-buffer multi-method method user host)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4925 (set (make-local-variable
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4926 (intern (concat "tramp-connection-property-" property)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4927 value)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4928
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4929
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4930
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4931 (defun tramp-get-connection-function (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4932 (second (or (assoc 'tramp-connection-function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4933 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4934 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4935 (error "Method `%s' didn't specify a connection function"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4936 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4937
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4938 (defun tramp-get-remote-sh (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4939 (second (or (assoc 'tramp-remote-sh
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4940 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4941 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4942 (error "Method `%s' didn't specify a remote shell"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4943 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4944
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4945 (defun tramp-get-rsh-program (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4946 (second (or (assoc 'tramp-rsh-program
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4947 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4948 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4949 (error "Method `%s' didn't specify an rsh program"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4950 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4951
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4952 (defun tramp-get-rsh-args (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4953 (second (or (assoc 'tramp-rsh-args
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4954 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4955 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4956 (error "Method `%s' didn't specify rsh args"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4957 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4958
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4959 (defun tramp-get-rcp-program (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4960 (second (or (assoc 'tramp-rcp-program
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4961 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4962 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4963 (error "Method `%s' didn't specify an rcp program"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4964 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4965
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4966 (defun tramp-get-rcp-args (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4967 (second (or (assoc 'tramp-rcp-args
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4968 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4969 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4970 (error "Method `%s' didn't specify rcp args"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4971 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4972
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4973 (defun tramp-get-rcp-keep-date-arg (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4974 (second (or (assoc 'tramp-rcp-keep-date-arg
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4975 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4976 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4977 (error "Method `%s' didn't specify `keep-date' arg for tramp"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4978 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4979
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4980 (defun tramp-get-su-program (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4981 (second (or (assoc 'tramp-su-program
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4982 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4983 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4984 (error "Method `%s' didn't specify a su program"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4985 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4986
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4987 (defun tramp-get-su-args (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4988 (second (or (assoc 'tramp-su-args
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4989 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4990 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4991 (error "Method `%s' didn't specify su args"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4992 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4993
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4994 (defun tramp-get-encoding-command (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4995 (second (or (assoc 'tramp-encoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4996 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4997 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4998 (error "Method `%s' didn't specify an encoding command"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4999 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5000
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5001 (defun tramp-get-decoding-command (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5002 (second (or (assoc 'tramp-decoding-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5003 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5004 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5005 (error "Method `%s' didn't specify a decoding command"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5006 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5007
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5008 (defun tramp-get-encoding-function (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5009 (second (or (assoc 'tramp-encoding-function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5010 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5011 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5012 (error "Method `%s' didn't specify an encoding function"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5013 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5014
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5015 (defun tramp-get-decoding-function (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5016 (second (or (assoc 'tramp-decoding-function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5017 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5018 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5019 (error "Method `%s' didn't specify a decoding function"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5020 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5021
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5022 (defun tramp-get-telnet-program (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5023 (second (or (assoc 'tramp-telnet-program
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5024 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5025 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5026 (error "Method `%s' didn't specify a telnet program"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5027 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5028
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5029 (defun tramp-get-telnet-args (multi-method method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5030 (second (or (assoc 'tramp-telnet-args
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5031 (assoc (or multi-method method tramp-default-method)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5032 tramp-methods))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5033 (error "Method `%s' didn't specify telnet args"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5034 (or multi-method method)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5035
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5036 ;; Auto saving to a special directory.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5037
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5038 (defun tramp-make-auto-save-file-name (fn)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5039 "Returns a file name in `tramp-auto-save-directory' for autosaving this file."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5040 (when tramp-auto-save-directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5041 (unless (file-exists-p tramp-auto-save-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5042 (make-directory tramp-auto-save-directory t)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5043 ;; jka-compr doesn't like auto-saving, so by appending "~" to the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5044 ;; file name we make sure that jka-compr isn't used for the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5045 ;; auto-save file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5046 (let ((buffer-file-name (expand-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5047 (tramp-subst-strs-in-string '(("_" . "|")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5048 ("/" . "_a")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5049 (":" . "_b")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5050 ("|" . "__")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5051 ("[" . "_l")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5052 ("]" . "_r"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5053 fn)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5054 tramp-auto-save-directory)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5055 (make-auto-save-file-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5056
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5057 (defadvice make-auto-save-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5058 (around tramp-advice-make-auto-save-file-name () activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5059 "Invoke `tramp-make-auto-save-file-name' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5060 (if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5061 tramp-auto-save-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5062 (setq ad-return-value
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5063 (tramp-make-auto-save-file-name (buffer-file-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5064 ad-do-it))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5065
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5066 (defun tramp-subst-strs-in-string (alist string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5067 "Replace all occurrences of the string FROM with TO in STRING.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5068 ALIST is of the form ((FROM . TO) ...)."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5069 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5070 (while alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5071 (let* ((pr (car alist))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5072 (from (car pr))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5073 (to (cdr pr)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5074 (while (string-match (regexp-quote from) string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5075 (setq string (replace-match to t t string)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5076 (setq alist (cdr alist))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5077 string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5078
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5079 (defun tramp-insert-with-face (face string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5080 "Insert text with a specific face."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5081 (let ((start (point)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5082 (insert string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5083 (add-text-properties start (point) (list 'face face))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5084
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5085 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5086 ;; -- Compatibility functions section --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5087 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5088
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5089 (defun tramp-temporary-file-directory ()
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5090 "Return name of directory for temporary files (compat function).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5091 For Emacs, this is the variable `temporary-file-directory', for XEmacs
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5092 this is the function `temp-directory'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5093 (cond ((boundp 'temporary-file-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5094 (symbol-value 'temporary-file-directory))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5095 ((fboundp 'temp-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5096 (funcall (symbol-function 'temp-directory))) ;pacify byte-compiler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5097 ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5098 (file-name-as-directory (getenv "TEMP")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5099 ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5100 (file-name-as-directory (getenv "TMP")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5101 ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5102 (file-name-as-directory (getenv "TMPDIR")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5103 ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5104 (t (message (concat "Neither `temporary-file-directory' nor "
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5105 "`temp-directory' is defined -- using /tmp."))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5106 (file-name-as-directory "/tmp"))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5107
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5108 (defun tramp-read-passwd (prompt)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5109 "Read a password from user (compat function).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5110 Invokes `read-passwd' if that is defined, else `ange-ftp-read-passwd'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5111 (apply
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5112 (if (fboundp 'read-passwd) #'read-passwd #'ange-ftp-read-passwd)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5113 (list prompt)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5114
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5115 (defun tramp-time-diff (t1 t2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5116 "Return the difference between the two times, in seconds.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5117 T1 and T2 are time values (as returned by `current-time' for example).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5118
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5119 NOTE: This function will fail if the time difference is too large to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5120 fit in an integer."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5121 ;; Pacify byte-compiler with `symbol-function'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5122 (cond ((fboundp 'subtract-time)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5123 (cadr (funcall (symbol-function 'subtract-time) t1 t2)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5124 ((fboundp 'itimer-time-difference)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5125 (floor (funcall
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5126 (symbol-function 'itimer-time-difference)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5127 (if (< (length t1) 3) (append t1 '(0)) t1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5128 (if (< (length t2) 3) (append t2 '(0)) t2))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5129 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5130 ;; snarfed from Emacs 21 time-date.el
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5131 (cadr (let ((borrow (< (cadr t1) (cadr t2))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5132 (list (- (car t1) (car t2) (if borrow 1 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5133 (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2))))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5134
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5135 (defun tramp-coding-system-change-eol-conversion (coding-system eol-type)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5136 "Return a coding system like CODING-SYSTEM but with given EOL-TYPE.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5137 EOL-TYPE can be one of `dos', `unix', or `mac'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5138 (cond ((fboundp 'coding-system-change-eol-conversion)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5139 (apply #'coding-system-change-eol-conversion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5140 (list coding-system eol-type)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5141 ((fboundp 'subsidiary-coding-system)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5142 (apply
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5143 #'subsidiary-coding-system
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5144 (list coding-system
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5145 (cond ((eq eol-type 'dos) 'crlf)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5146 ((eq eol-type 'unix) 'lf)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5147 ((eq eol-type 'mac) 'cr)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5148 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5149 (error "Unknown EOL-TYPE `%s', must be %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5150 eol-type
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5151 "`dos', `unix', or `mac'"))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5152 (t (error "Can't change EOL conversion -- is MULE missing?"))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5153
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5154 (defun tramp-split-string (string pattern)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5155 "Like `split-string' but omit empty strings.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5156 In Emacs, (split-string \"/foo/bar\" \"/\") returns (\"foo\" \"bar\").
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5157 This is, the first, empty, element is omitted. In XEmacs, the first
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5158 element is not omitted.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5159
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5160 Note: this function has been written for `tramp-handle-file-truename'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5161 If you want to use it for something else, you'll have to check whether
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5162 it does the right thing."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5163 (delete "" (split-string string pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5164
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5165 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5166 ;; -- Kludges section --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5167 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5168
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5169 ;; Currently (as of Emacs 20.5), the function `shell-quote-argument'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5170 ;; does not deal well with newline characters. Newline is replaced by
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5171 ;; backslash newline. But if, say, the string `a backslash newline b'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5172 ;; is passed to a shell, the shell will expand this into "ab",
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5173 ;; completely omitting the newline. This is not what was intended.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5174 ;; It does not appear to be possible to make the function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5175 ;; `shell-quote-argument' work with newlines without making it
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5176 ;; dependent on the shell used. But within this package, we know that
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5177 ;; we will always use a Bourne-like shell, so we use an approach which
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5178 ;; groks newlines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5179 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5180 ;; The approach is simple: we call `shell-quote-argument', then
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5181 ;; massage the newline part of the result.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5182 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5183 ;; This function should produce a string which is grokked by a Unix
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5184 ;; shell, even if the Emacs is running on Windows. Since this is the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5185 ;; kludges section, we bind `system-type' in such a way that
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5186 ;; `shell-quote-arguments' behaves as if on Unix.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5187 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5188 ;; Thanks to Mario DeWeerd for the hint that it is sufficient for this
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5189 ;; function to work with Bourne-like shells.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5190 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5191 ;; CCC: This function should be rewritten so that
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5192 ;; `shell-quote-argument' is not used. This way, we are safe from
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5193 ;; changes in `shell-quote-argument'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5194 (defun tramp-shell-quote-argument (s)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5195 "Similar to `shell-quote-argument', but groks newlines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5196 Only works for Bourne-like shells."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5197 (let ((system-type 'not-windows))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5198 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5199 (let ((result (shell-quote-argument s))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5200 (nl (regexp-quote (format "\\%s" tramp-rsh-end-of-line))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5201 (when (and (>= (length result) 2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5202 (string= (substring result 0 2) "\\~"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5203 (setq result (substring result 1)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5204 (while (string-match nl result)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5205 (setq result (replace-match (format "'%s'" tramp-rsh-end-of-line)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5206 t t result)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5207 result))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5208
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5209 ;; ;; EFS hooks itself into the file name handling stuff in more places
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5210 ;; ;; than just `file-name-handler-alist'. The following tells EFS to stay
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5211 ;; ;; away from tramp.el paths.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5212 ;; ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5213 ;; ;; This is needed because EFS installs (efs-dired-before-readin) into
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5214 ;; ;; 'dired-before-readin-hook'. This prevents EFS from opening an FTP
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5215 ;; ;; connection to help it's dired process. Not that I have any real
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5216 ;; ;; idea *why* this is helpful to dired.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5217 ;; ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5218 ;; ;; Anyway, this advice fixes the problem (with a sledgehammer :)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5219 ;; ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5220 ;; ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5221 ;; ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5222 ;; ;; CCC: when the other defadvice calls have disappeared, make sure
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5223 ;; ;; not to call defadvice unless it's necessary. How do we find out whether
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5224 ;; ;; it is necessary? (featurep 'efs) is surely the wrong way --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5225 ;; ;; EFS might nicht be loaded yet.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5226 ;; (defadvice efs-ftp-path (around dont-match-tramp-path activate protect)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5227 ;; "Cause efs-ftp-path to fail when the path is a TRAMP path."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5228 ;; (if (tramp-tramp-file-p (ad-get-arg 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5229 ;; nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5230 ;; ad-do-it))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5231
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5232 ;; We currently use "[" and "]" in the filename format. In Emacs
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5233 ;; 20.x, this means that Emacs wants to expand wildcards if
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5234 ;; `find-file-wildcards' is non-nil, and then barfs because no
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5235 ;; expansion could be found. We detect this situation and do
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5236 ;; something really awful: we have `file-expand-wildcards' return the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5237 ;; original filename if it can't expand anything. Let's just hope
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5238 ;; that this doesn't break anything else.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5239 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5240 ;; Another problem is that the check is done by Emacs version, which
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5241 ;; is really not what we want to do. Oh, well.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5242
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5243 ;;(when (and (not (featurep 'xemacs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5244 ;; (= emacs-major-version 20))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5245 ;; It seems that this advice is needed in Emacs 21, too.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5246 (defadvice file-expand-wildcards (around tramp-fix activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5247 (let ((name (ad-get-arg 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5248 (if (tramp-tramp-file-p name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5249 ;; If it's a Tramp file, dissect it and look if wildcards
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5250 ;; need to be expanded at all.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5251 (let ((v (tramp-dissect-file-name name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5252 (if (string-match "[[*?]" (tramp-file-name-path v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5253 (let ((res ad-do-it))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5254 (setq ad-return-value (or res (list name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5255 (setq ad-return-value (list name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5256 ;; If it is not a Tramp file, just run the original function.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5257 (let ((res ad-do-it))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5258 (setq ad-return-value (or res (list name)))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5259 ;; )
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5260
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5261 ;; Make the `reporter` functionality available for making bug reports about
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5262 ;; the package. A most useful piece of code.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5263
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5264 (unless (fboundp 'reporter-submit-bug-report)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5265 (autoload 'reporter-submit-bug-report "reporter"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5266
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5267 (defun tramp-bug ()
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5268 "Submit a bug report to the TRAMP developers."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5269 (interactive)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5270 (require 'reporter)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5271 (let ((reporter-prompt-for-summary-p t))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5272 (reporter-submit-bug-report
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5273 tramp-bug-report-address ; to-address
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5274 (format "tramp (%s)" tramp-version) ; package name and version
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5275 `(;; Current state
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5276 tramp-ls-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5277 tramp-test-groks-nt
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5278 tramp-file-exists-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5279 tramp-current-multi-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5280 tramp-current-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5281 tramp-current-user
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5282 tramp-current-host
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5283
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5284 ;; System defaults
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5285 tramp-auto-save-directory ; vars to dump
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5286 tramp-default-method
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5287 tramp-rsh-end-of-line
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5288 tramp-remote-path
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5289 tramp-login-prompt-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5290 tramp-password-prompt-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5291 tramp-wrong-passwd-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5292 tramp-temp-name-prefix
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5293 tramp-file-name-structure
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5294 tramp-file-name-regexp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5295 tramp-multi-file-name-structure
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5296 tramp-multi-file-name-hop-structure
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5297 tramp-multi-methods
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5298 tramp-multi-connection-function-alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5299 tramp-make-tramp-file-format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5300 tramp-end-of-output
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5301
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5302 ;; Non-tramp variables of interest
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5303 shell-prompt-pattern
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5304 backup-by-copying
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5305 backup-by-copying-when-linked
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5306 backup-by-copying-when-mismatch
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5307 ,(when (boundp 'backup-by-copying-when-privileged-mismatch)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5308 'backup-by-copying-when-privileged-mismatch)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5309 file-name-handler-alist)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5310 nil ; pre-hook
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5311 nil ; post-hook
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5312 "\
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5313 Enter your bug report in this message, including as much detail as you
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5314 possibly can about the problem, what you did to cause it and what the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5315 local and remote machines are.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5316
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5317 If you can give a simple set of instructions to make this bug happen
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5318 reliably, please include those. Thank you for helping kill bugs in
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5319 TRAMP.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5320 --bug report follows this line--")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5321
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5322 (defalias 'tramp-submit-bug 'tramp-bug)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5323
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5324 (provide 'tramp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5325
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5326 ;; Make sure that we get integration with the VC package.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5327 ;; When it is loaded, we need to pull in the integration module.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5328 ;; This must come after (provide 'tramp) because tramp-vc.el
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5329 ;; requires tramp.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5330 (eval-after-load "vc"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5331 '(require 'tramp-vc))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5332
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5333 ;;; TODO:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5334
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
5335 ;; * Revise the comments near the beginning of the file.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5336 ;; * Cooperate with PCL-CVS. It uses start-process, which doesn't
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5337 ;; work for remote files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5338 ;; * Rewrite `tramp-shell-quote-argument' to abstain from using
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5339 ;; `shell-quote-argument'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5340 ;; * Completion gets confused when you leave out the method name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5341 ;; * Support `dired-compress-file' filename handler.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5342 ;; * In Emacs 21, `insert-directory' shows total number of bytes used
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5343 ;; by the files in that directory. Add this here.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5344 ;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5345 ;; * Make ffap.el grok Tramp filenames. (Eli Tziperman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5346 ;; * When logging in, keep looking for questions according to an alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5347 ;; and then invoke the right function.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5348 ;; * Case-insensitive filename completion. (Norbert Goevert.)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5349 ;; * Running CVS remotely doesn't appear to work right. It thinks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5350 ;; files are locked by somebody else even if I'm the locking user.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5351 ;; Sometimes, one gets `No CVSROOT specified' errors from CVS.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5352 ;; (Skip Montanaro)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5353 ;; * Don't use globbing for directories with many files, as this is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5354 ;; likely to produce long command lines, and some shells choke on
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5355 ;; long command lines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5356 ;; * Find out about the new auto-save mechanism in Emacs 21 and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5357 ;; do the right thing.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5358 ;; * `vc-directory' does not work. It never displays any files, even
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5359 ;; if it does show files when run locally.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5360 ;; * Allow correction of passwords, if the remote end allows this.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5361 ;; (Mark Hershberger)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5362 ;; * Make sure permissions of tmp file are good.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5363 ;; (Nelson Minar <nelson@media.mit.edu>)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5364 ;; * Grok passwd prompts with scp? (David Winter
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5365 ;; <winter@nevis1.nevis.columbia.edu>). Maybe just do `ssh -l user
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5366 ;; host', then wait a while for the passwd or passphrase prompt. If
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5367 ;; there is one, remember the passwd/phrase.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5368 ;; * How to deal with MULE in `insert-file-contents' and `write-region'?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5369 ;; * Do asynchronous `shell-command's.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5370 ;; * Grok `append' parameter for `write-region'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5371 ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5372 ;; * abbreviate-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5373 ;; * grok ~ in tramp-remote-path (Henrik Holm <henrikh@tele.ntnu.no>)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5374 ;; * `C' in dired gives error `not tramp file name'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5375 ;; * Also allow to omit user names when doing multi-hop. Not sure yet
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5376 ;; what the user names should default to, though.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5377 ;; * better error checking. At least whenever we see something
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5378 ;; strange when doing zerop, we should kill the process and start
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5379 ;; again. (Greg Stark)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5380 ;; * Add caching for filename completion. (Greg Stark)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5381 ;; Of course, this has issues with usability (stale cache bites)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5382 ;; -- <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5383 ;; * Provide a local cache of old versions of remote files for the rsync
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5384 ;; transfer method to use. (Greg Stark)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5385 ;; * Remove unneeded parameters from methods.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5386 ;; * Invoke rsync once for copying a whole directory hierarchy.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5387 ;; (Francesco Potort́)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5388 ;; * Should we set PATH ourselves or should we rely on the remote end
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5389 ;; to do it?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5390 ;; * Do the autoconf thing.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5391 ;; * Make it work for XEmacs 20, which is missing `with-timeout'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5392 ;; * Allow non-Unix remote systems. (More a long-term thing.)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5393 ;; * Make it work for different encodings, and for different file name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5394 ;; encodings, too. (Daniel Pittman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5395 ;; * Change applicable functions to pass a struct tramp-file-name rather
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5396 ;; than the individual items MULTI-METHOD, METHOD, USER, HOST, PATH.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5397 ;; * Implement asynchronous shell commands.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5398 ;; * Clean up unused *tramp/foo* buffers after a while. (Pete Forman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5399 ;; * Progress reports while copying files. (Michael Kifer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5400 ;; * `Smart' connection method that uses inline for small and out of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5401 ;; band for large files. (Michael Kifer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5402 ;; * Don't search for perl5 and perl. Instead, only search for perl and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5403 ;; then look if it's the right version (with `perl -v').
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5404 ;; * When editing a remote CVS controlled file as a different user, VC
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5405 ;; gets confused about the file locking status. Try to find out why
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5406 ;; the workaround doesn't work.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5407 ;; * When user is running ssh-agent, it would be useful to add the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5408 ;; passwords typed by the user to that agent. This way, the next time
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5409 ;; round, the users don't have to type all this in again.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5410 ;; This would be especially useful for start-process, I think.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5411 ;; An easy way to implement start-process is to open a second shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5412 ;; connection which is inconvenient if the user has to reenter
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5413 ;; passwords.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5414 ;; * Change `copy-file' to grok the case where the filename handler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5415 ;; for the source and the target file are different. Right now,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5416 ;; it looks at the source file and then calls that handler, if
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5417 ;; there is one. But since ange-ftp, for instance, does not know
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5418 ;; about Tramp, it does not do the right thing if the target file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5419 ;; name is a Tramp name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5420
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5421 ;; Functions for file-name-handler-alist:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5422 ;; diff-latest-backup-file -- in diff.el
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5423 ;; dired-compress-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5424 ;; dired-uncache -- this will be needed when we do insert-directory caching
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5425 ;; file-name-as-directory -- use primitive?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5426 ;; file-name-directory -- use primitive?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5427 ;; file-name-nondirectory -- use primitive?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5428 ;; file-name-sans-versions -- use primitive?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5429 ;; file-newer-than-file-p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5430 ;; find-backup-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5431 ;; get-file-buffer -- use primitive
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5432 ;; load
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5433 ;; unhandled-file-name-directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5434 ;; vc-registered
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5435
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5436 ;;; tramp.el ends here