A new user interface for you! Read more...

File _service:download_src_package:mc-port-number-bnc483249.patch of Package mc

From 9769c0eeffbc48a029e7b572f17510ba30d730ac Mon Sep 17 00:00:00 2001
From: Mikhail S. Pobolovets <styx.mp@gmail.com>
Date: Mon, 26 Jan 2009 16:56:55 +0200
Subject: [PATCH] Port number in shell link can be specified now

vfs/ChangeLog:

    * fish.c: Iterpret SUP.flags as port number if SUP.flags is not in
    * 0, FISH_FLAG_COMPRESSED and FISH_FLAG_RSH. Weakness: port number

Originally by Andrew V. Samoilov <sav>

Signed-off-by: Mikhail S. Pobolovets <styx.mp@gmail.com>
---
 vfs/fish.c |   41 ++++++++++++++++++++++++++++-------------
 1 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/vfs/fish.c b/vfs/fish.c
index 63e4d60..a407e71 100644
--- a/vfs/fish.c
+++ b/vfs/fish.c
@@ -213,13 +213,22 @@ static int
 fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
 {
     {
-	const char *argv[10];
+	char gbuf[10];
+	const char *argv[10];	/* All of 10 is used now */
 	const char *xsh = (SUP.flags == FISH_FLAG_RSH ? "rsh" : "ssh");
 	int i = 0;
 
 	argv[i++] = xsh;
 	if (SUP.flags == FISH_FLAG_COMPRESSED)
 	    argv[i++] = "-C";
+
+	if (SUP.flags > FISH_FLAG_RSH)
+	{
+	    argv[i++] = "-p";
+	    g_snprintf (gbuf, sizeof (gbuf), "%d", SUP.flags);
+	    argv[i++] = gbuf;
+	}
+
 	argv[i++] = "-l";
 	argv[i++] = SUP.user;
 	argv[i++] = SUP.host;
@@ -317,7 +326,7 @@ fish_open_archive (struct vfs_class *me, struct vfs_s_super *super,
     SUP.user = user;
     SUP.flags = flags;
     if (!strncmp (op, "rsh:", 4))
-	SUP.flags |= FISH_FLAG_RSH;
+	SUP.flags = FISH_FLAG_RSH;
     SUP.cwdir = NULL;
     if (password)
 	SUP.password = password;
@@ -936,22 +945,28 @@ static void
 fish_fill_names (struct vfs_class *me, fill_names_f func)
 {
     struct vfs_s_super *super = MEDATA->supers;
-    const char *flags;
     char *name;
-    
-    while (super){
-	switch (SUP.flags & (FISH_FLAG_RSH | FISH_FLAG_COMPRESSED)) {
-	case FISH_FLAG_RSH:
+
+    char gbuf[10];
+
+    while (super)
+    {
+	const char *flags = "";
+	switch (SUP.flags)
+	{
+	    case FISH_FLAG_RSH:
 		flags = ":r";
 		break;
-	case FISH_FLAG_COMPRESSED:
+	    case FISH_FLAG_COMPRESSED:
 		flags = ":C";
 		break;
-	case FISH_FLAG_RSH | FISH_FLAG_COMPRESSED:
-		flags = "";
-		break;
-	default:
-		flags = "";
+	    default:
+		if (SUP.flags > FISH_FLAG_RSH)
+		{
+		    break;
+		    g_snprintf (gbuf, sizeof (gbuf), ":%d", SUP.flags);
+		    flags = gbuf;
+		}
 		break;
 	}
 
-- 
1.5.6.3