Ticket #3: mc-4.6.0.diff

File mc-4.6.0.diff, 1.3 KB (added by slavazanko, 15 years ago)
  • src/file.c

    old new  
    18951895   } 
    18961896    } 
     1897 
     1898        /* 
     1899         * Dmitry Koteroff <d[at]koteroff.ru> 
     1900         * Patch to save selected items in environment variable.  
     1901         * This variable would be passed to extfs scripts and may be used  
     1902         * to optimize depacking performance. 
     1903         */ 
     1904        {{{{ 
     1905        char* env = g_strconcat("", NULL); 
     1906        for (i = 0; i < panel->count; i++) { 
     1907            char *prevEnv, *p; 
     1908            if (!panel->dir.list[i].f.marked) continue; 
     1909            p = concat_dir_and_file (panel->cwd, panel->dir.list[i].fname); 
     1910            prevEnv = env; 
     1911            env = g_strconcat(prevEnv, p, "\n", NULL);  
     1912            g_free(p);  
     1913            g_free(prevEnv);  
     1914        } 
     1915        setenv("MC_SELECTION", env, 1); 
     1916        g_free(env);     
     1917        char *cur = concat_dir_and_file (panel->cwd, source); 
     1918        setenv("MC_CURRENT", cur, 1);    
     1919        g_free(cur); 
     1920        }}}} 
     1921 
     1922     
    18971923#ifdef WITH_BACKGROUND 
    18981924    /* Did the user select to do a background operation? */ 
     
    19131939       mc_setctl (dest, MCCTL_FORGET_ABOUT, NULL); 
    19141940/*          file_op_context_destroy (ctx); */ 
     1941            setenv("MC_SELECTION", "", 1); setenv("MC_CURRENT", "", 1);  
    19151942       return 0; 
    19161943   } 
     
    21232150    }                           /* Many files */ 
    21242151  clean_up: 
     2152    setenv("MC_SELECTION", "", 1); setenv("MC_CURRENT", "", 1);      
    21252153    /* Clean up */