Ticket #118: 0001-Port-number-in-shell-link-can-be-specified-now.patch

File 0001-Port-number-in-shell-link-can-be-specified-now.patch, 2.3 KB (added by styx, 11 years ago)

reworked for git am

  • vfs/fish.c

    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 
    213213fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super) 
    214214{ 
    215215    { 
    216         const char *argv[10]; 
     216        char gbuf[10]; 
     217        const char *argv[10];   /* All of 10 is used now */ 
    217218        const char *xsh = (SUP.flags == FISH_FLAG_RSH ? "rsh" : "ssh"); 
    218219        int i = 0; 
    219220 
    220221        argv[i++] = xsh; 
    221222        if (SUP.flags == FISH_FLAG_COMPRESSED) 
    222223            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 
    223232        argv[i++] = "-l"; 
    224233        argv[i++] = SUP.user; 
    225234        argv[i++] = SUP.host; 
    fish_open_archive (struct vfs_class *me, struct vfs_s_super *super, 
    317326    SUP.user = user; 
    318327    SUP.flags = flags; 
    319328    if (!strncmp (op, "rsh:", 4)) 
    320         SUP.flags |= FISH_FLAG_RSH; 
     329        SUP.flags = FISH_FLAG_RSH; 
    321330    SUP.cwdir = NULL; 
    322331    if (password) 
    323332        SUP.password = password; 
    static void 
    936945fish_fill_names (struct vfs_class *me, fill_names_f func) 
    937946{ 
    938947    struct vfs_s_super *super = MEDATA->supers; 
    939     const char *flags; 
    940948    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: 
    945958                flags = ":r"; 
    946959                break; 
    947         case FISH_FLAG_COMPRESSED: 
     960            case FISH_FLAG_COMPRESSED: 
    948961                flags = ":C"; 
    949962                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                } 
    955970                break; 
    956971        } 
    957972