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
|
b
|
static int |
213 | 213 | fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super) |
214 | 214 | { |
215 | 215 | { |
216 | | const char *argv[10]; |
| 216 | char gbuf[10]; |
| 217 | const char *argv[10]; /* All of 10 is used now */ |
217 | 218 | const char *xsh = (SUP.flags == FISH_FLAG_RSH ? "rsh" : "ssh"); |
218 | 219 | int i = 0; |
219 | 220 | |
220 | 221 | argv[i++] = xsh; |
221 | 222 | if (SUP.flags == FISH_FLAG_COMPRESSED) |
222 | 223 | argv[i++] = "-C"; |
| 224 | |
| 225 | if (SUP.flags > FISH_FLAG_RSH) |
| 226 | { |
| 227 | argv[i++] = "-p"; |
| 228 | g_snprintf (gbuf, sizeof (gbuf), "%d", SUP.flags); |
| 229 | argv[i++] = gbuf; |
| 230 | } |
| 231 | |
223 | 232 | argv[i++] = "-l"; |
224 | 233 | argv[i++] = SUP.user; |
225 | 234 | argv[i++] = SUP.host; |
… |
… |
fish_open_archive (struct vfs_class *me, struct vfs_s_super *super, |
317 | 326 | SUP.user = user; |
318 | 327 | SUP.flags = flags; |
319 | 328 | if (!strncmp (op, "rsh:", 4)) |
320 | | SUP.flags |= FISH_FLAG_RSH; |
| 329 | SUP.flags = FISH_FLAG_RSH; |
321 | 330 | SUP.cwdir = NULL; |
322 | 331 | if (password) |
323 | 332 | SUP.password = password; |
… |
… |
static void |
936 | 945 | fish_fill_names (struct vfs_class *me, fill_names_f func) |
937 | 946 | { |
938 | 947 | struct vfs_s_super *super = MEDATA->supers; |
939 | | const char *flags; |
940 | 948 | char *name; |
941 | | |
942 | | while (super){ |
943 | | switch (SUP.flags & (FISH_FLAG_RSH | FISH_FLAG_COMPRESSED)) { |
944 | | case FISH_FLAG_RSH: |
| 949 | |
| 950 | char gbuf[10]; |
| 951 | |
| 952 | while (super) |
| 953 | { |
| 954 | const char *flags = ""; |
| 955 | switch (SUP.flags) |
| 956 | { |
| 957 | case FISH_FLAG_RSH: |
945 | 958 | flags = ":r"; |
946 | 959 | break; |
947 | | case FISH_FLAG_COMPRESSED: |
| 960 | case FISH_FLAG_COMPRESSED: |
948 | 961 | flags = ":C"; |
949 | 962 | break; |
950 | | case FISH_FLAG_RSH | FISH_FLAG_COMPRESSED: |
951 | | flags = ""; |
952 | | break; |
953 | | default: |
954 | | flags = ""; |
| 963 | default: |
| 964 | if (SUP.flags > FISH_FLAG_RSH) |
| 965 | { |
| 966 | break; |
| 967 | g_snprintf (gbuf, sizeof (gbuf), ":%d", SUP.flags); |
| 968 | flags = gbuf; |
| 969 | } |
955 | 970 | break; |
956 | 971 | } |
957 | 972 | |