Eclipse-compatible :extssh: method...

"Deven T. Corzine" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
The Eclipse IDE (www.eclipse.org) supports a CVS method of "extssh".  The 
attached patch extends the standard CVS client to support this method as 
well.  For this method, "ssh" is the default rsh client instead of "ssh", 
and CVS_SSH overrides it, instead of CVS_RSH.

With this patch, the "cvs" command can operate on workspaces checked out 
via Eclipse using the "extssh" method.

Can this patch be incorporated into the mainline CVS code?

Deven

_______________________________________________
Bug-cvs mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/bug-cvs
cvs-1.11.2-extssh.patch (text/plain, 6 KB)
--- cvs-1.11.2/src/client.c.orig	2003-05-05 13:23:37.000000000 -0400
+++ cvs-1.11.2/src/client.c	2003-05-05 13:39:46.000000000 -0400
@@ -3627,7 +3627,7 @@
 }
 	
 #ifndef NO_EXT_METHOD
-static void start_rsh_server PROTO((cvsroot_t *, struct buffer **, struct buffer **));
+static void start_rsh_server PROTO((cvsroot_t *, struct buffer **, struct buffer **, char *));
 #endif
 
 int
@@ -4395,7 +4395,16 @@
 	    error (0, 0, ":ext: method not supported by this port of CVS");
 	    error (1, 0, "try :server: instead");
 #else
-	    start_rsh_server (current_parsed_root, &to_server, &from_server);
+	    start_rsh_server (current_parsed_root, &to_server, &from_server, "rsh");
+#endif
+	    break;
+
+	case extssh_method:
+#if defined (NO_EXT_METHOD)
+	    error (0, 0, ":extssh: method not supported by this port of CVS");
+	    error (1, 0, "try :server: instead");
+#else
+	    start_rsh_server (current_parsed_root, &to_server, &from_server, "ssh");
 #endif
 	    break;
 
@@ -4772,10 +4781,11 @@
    up and running, and that's most important. */
 
 static void
-start_rsh_server (root, to_server, from_server)
+start_rsh_server (root, to_server, from_server, cvs_rsh)
     cvsroot_t *root;
     struct buffer **to_server;
     struct buffer **from_server;
+    char *cvs_rsh;
 {
     int pipes[2];
     int child_pid;
@@ -4783,7 +4793,9 @@
     /* If you're working through firewalls, you can set the
        CVS_RSH environment variable to a script which uses rsh to
        invoke another rsh on a proxy machine.  */
-    char *cvs_rsh = getenv ("CVS_RSH");
+   
+    char *override = getenv (!strcmp(cvs_rsh, "ssh") ? "CVS_SSH" : "CVS_RSH");
+    if (override) cvs_rsh = override;
     char *cvs_server = getenv ("CVS_SERVER");
     int i = 0;
     /* This needs to fit "rsh", "-b", "-l", "USER", "host",
@@ -4857,15 +4869,17 @@
 # else /* ! START_RSH_WITH_POPEN_RW */
 
 static void
-start_rsh_server (root, to_server, from_server)
+start_rsh_server (root, to_server, from_server, cvs_rsh)
     cvsroot_t *root;
     struct buffer **to_server;
     struct buffer **from_server;
+    char *cvs_rsh;
 {
     /* If you're working through firewalls, you can set the
        CVS_RSH environment variable to a script which uses rsh to
        invoke another rsh on a proxy machine.  */
-    char *cvs_rsh = getenv ("CVS_RSH");
+    char *override = getenv (!strcmp(cvs_rsh, "ssh") ? "CVS_SSH" : "CVS_RSH");
+    if (override) cvs_rsh = override;
     char *cvs_server = getenv ("CVS_SERVER");
     char *command;
     int tofd, fromfd;
--- cvs-1.11.2/src/client.c.closure.orig	2001-08-09 16:27:26.000000000 -0400
+++ cvs-1.11.2/src/client.c.closure	2003-05-05 13:41:28.000000000 -0400
@@ -3627,7 +3627,7 @@
 }
 	
 #ifndef NO_EXT_METHOD
-static void start_rsh_server PROTO((cvsroot_t *, struct buffer **, struct buffer **));
+static void start_rsh_server PROTO((cvsroot_t *, struct buffer **, struct buffer **, char *));
 #endif
 
 int
@@ -4394,7 +4394,16 @@
 	    error (0, 0, ":ext: method not supported by this port of CVS");
 	    error (1, 0, "try :server: instead");
 #else
-	    start_rsh_server (current_parsed_root, &to_server, &from_server);
+	    start_rsh_server (current_parsed_root, &to_server, &from_server, "rsh");
+#endif
+	    break;
+
+	case extssh_method:
+#if defined (NO_EXT_METHOD)
+	    error (0, 0, ":extssh: method not supported by this port of CVS");
+	    error (1, 0, "try :server: instead");
+#else
+	    start_rsh_server (current_parsed_root, &to_server, &from_server, "ssh");
 #endif
 	    break;
 
@@ -4771,10 +4780,11 @@
    up and running, and that's most important. */
 
 static void
-start_rsh_server (root, to_server, from_server)
+start_rsh_server (root, to_server, from_server, cvs_rsh)
     cvsroot_t *root;
     struct buffer **to_server;
     struct buffer **from_server;
+    char *cvs_rsh;
 {
     int pipes[2];
     int child_pid;
@@ -4782,7 +4792,9 @@
     /* If you're working through firewalls, you can set the
        CVS_RSH environment variable to a script which uses rsh to
        invoke another rsh on a proxy machine.  */
-    char *cvs_rsh = getenv ("CVS_RSH");
+   
+    char *override = getenv (!strcmp(cvs_rsh, "ssh") ? "CVS_SSH" : "CVS_RSH");
+    if (override) cvs_rsh = override;
     char *cvs_server = getenv ("CVS_SERVER");
     int i = 0;
     /* This needs to fit "rsh", "-b", "-l", "USER", "host",
@@ -4856,15 +4868,17 @@
 # else /* ! START_RSH_WITH_POPEN_RW */
 
 static void
-start_rsh_server (root, to_server, from_server)
+start_rsh_server (root, to_server, from_server, cvs_rsh)
     cvsroot_t *root;
     struct buffer **to_server;
     struct buffer **from_server;
+    char *cvs_rsh;
 {
     /* If you're working through firewalls, you can set the
        CVS_RSH environment variable to a script which uses rsh to
        invoke another rsh on a proxy machine.  */
-    char *cvs_rsh = getenv ("CVS_RSH");
+    char *override = getenv (!strcmp(cvs_rsh, "ssh") ? "CVS_SSH" : "CVS_RSH");
+    if (override) cvs_rsh = override;
     char *cvs_server = getenv ("CVS_SERVER");
     char *command;
     int tofd, fromfd;
--- cvs-1.11.2/src/root.c.orig	2001-07-05 15:11:39.000000000 -0400
+++ cvs-1.11.2/src/root.c	2003-05-05 13:26:37.000000000 -0400
@@ -408,6 +408,8 @@
 	    newroot->method = server_method;
 	else if (strcmp (method, "ext") == 0)
 	    newroot->method = ext_method;
+	else if (strcmp (method, "extssh") == 0)
+	    newroot->method = extssh_method;
 	else if (strcmp (method, "fork") == 0)
 	    newroot->method = fork_method;
 	else
@@ -625,6 +627,7 @@
 #endif
     case server_method:
     case ext_method:
+    case extssh_method:
 	no_port = 1;
 	no_password = 1;
 	check_hostname = 1;
--- cvs-1.11.2/src/root.h.orig	2001-05-04 12:36:34.000000000 -0400
+++ cvs-1.11.2/src/root.h	2003-05-05 13:25:33.000000000 -0400
@@ -18,6 +18,7 @@
     kserver_method,
     gserver_method,
     ext_method,
+    extssh_method,
     fork_method
 } CVSmethod;
 extern char *method_names[];	/* change this in root.c if you change
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.