diff lisp/net/tramp.el @ 46010:d07b0e5f80b9

(tramp-open-connection-rsh): Support a kludgy feature for the "-p" option to ssh. If host name is given as "host#42", uses the "-p 42" option.
author Kai Großjohann <kgrossjo@eu.uu.net>
date Tue, 25 Jun 2002 20:11:34 +0000
parents 72200622ada8
children 05db6f1e91ca
line wrap: on
line diff
--- a/lisp/net/tramp.el	Tue Jun 25 18:15:03 2002 +0000
+++ b/lisp/net/tramp.el	Tue Jun 25 20:11:34 2002 +0000
@@ -3484,6 +3484,10 @@
 Sadly, the transfer method cannot be switched on the fly, instead you
 must specify the right method in the file name.
 
+Kludgy feature: if HOST has the form \"xx#yy\", then yy is assumed to
+be a port number for ssh, and \"-p yy\" will be added to the list of
+arguments, and xx will be used as the host name to connect to.
+
 * Actually, the rsh program to be used can be specified in the
   method parameters, see the variable `tramp-methods'."
   (save-match-data
@@ -3494,25 +3498,26 @@
 	(tramp-message 7 "Opening connection for %s@%s using %s..." 
 		       user host method)
       (tramp-message 7 "Opening connection at %s using %s..." host method))
-    (let ((process-environment (copy-sequence process-environment)))
+    (let ((process-environment (copy-sequence process-environment))
+	  (bufnam (tramp-buffer-name multi-method method user host))
+	  (buf (tramp-get-buffer multi-method method user host))
+	  (rsh-program (tramp-get-rsh-program multi-method method))
+	  (rsh-args (tramp-get-rsh-args multi-method method)))
+      ;; The following should be changed.  We need a more general
+      ;; mechanism to parse extra host args.
+      (when (string-match "\\([^#]*\\)#\\(.*\\)" host)
+	(setq rsh-args (cons "-p" (cons (match-string 2 host) rsh-args)))
+	(setq host (match-string 1 host)))
       (setenv "TERM" tramp-terminal-type)
       (let* ((default-directory (tramp-temporary-file-directory))
              (coding-system-for-read (unless (and (not (featurep 'xemacs))
                                                   (> emacs-major-version 20))
                                        tramp-dos-coding-system))
              (p (if user
-                    (apply #'start-process
-                           (tramp-buffer-name multi-method method user host)
-                           (tramp-get-buffer multi-method method user host)
-                           (tramp-get-rsh-program multi-method method) 
-                           host "-l" user
-                           (tramp-get-rsh-args multi-method method))
-                  (apply #'start-process
-                         (tramp-buffer-name multi-method method user host)
-                         (tramp-get-buffer multi-method method user host)
-                         (tramp-get-rsh-program multi-method method) 
-                         host
-                         (tramp-get-rsh-args multi-method method))))
+                    (apply #'start-process bufnam buf rsh-program  
+                           host "-l" user rsh-args)
+                  (apply #'start-process bufnam buf rsh-program 
+                         host rsh-args)))
              (found nil))
         (process-kill-without-query p)
         (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host)