Ticket #2376: mc-extfs-uarc_v2.patch

File mc-extfs-uarc_v2.patch, 1.8 KB (added by eugenesan, 14 years ago)
  • /usr/lib/mc/extfs.d/uarc

    old new  
    22 
    33# 
    44# ARC Virtual filesystem executive 
    5 # Copyright (C) 2008 Jacques Pelletier 
     5# Copyright (C) 2008 Jacques Pelletier <jpelletier@ieee.org> 
     6# Copyright (C) 2010 Eugene San (eugenesan) <eugenesan@gmail.com> 
    67# May be distributed under the terms of the GNU Public License 
    7 # <jpelletier@ieee.org> 
    88# 
    99 
    1010# Define your awk 
     
    1616ARC_DEL="arc d" 
    1717 
    1818# The 'list' command executive 
    19  
     19# unarc: DD.MM.YY HH.MM packed size ratio filename 
     20# list:  -rw-r--r-- 1 uid gid size MMM/DD/CCYY HH:MM filename 
    2021mc_arc_fs_list() 
    2122{ 
    22     $ARC_LIST "$1" | gawk -v uid=${UID-0} ' 
     23        $ARC_LIST "$1" | gawk -v uid=`id -u` -v gid=`id -g` ' 
    2324BEGIN { } 
    2425/^Name/ { next } 
    2526/===/ { next } 
     
    4041 
    4142                a[2]=substr(a[2],1,2) 
    4243        } 
    43  
    44         printf "-rw-r--r--   1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $2, $7, $6, $8, a[1], a[2], $1 
     44        printf "-rw-r--r-- 1 %s %s %d %s/%2d/%4d %02d:%02d %s\n", uid, gid, $2, $7, $6, $8, a[1], a[2], $1 
    4545}' 2>/dev/null 
    46     exit 0 
     46        exit 0 
    4747} 
    4848 
    4949# Command: copyout archivename storedfilename extractto 
    5050mc_arc_fs_copyout() 
    5151{ 
    52    $ARC_GET "$1" "$2" 2> /dev/null 
    53         mv "$2" "$3" 
     52        cd "$(dirname "${3}")" && \ 
     53        rm -f ${2} ${3} && \ 
     54        $ARC_GET "$1" "$2" > /dev/null 2>&1 && \ 
     55        mv "$2" "$3" && \ 
     56        exit 0 
    5457} 
    5558 
    5659# Command: copyin archivename storedfilename sourcefile 
     
    7376shift 
    7477 
    7578case "$cmd" in 
    76    list)        mc_arc_fs_list    "$@" ;; 
    77    copyout) mc_arc_fs_copyout "$@" ;; 
    78    copyin)      mc_arc_fs_copyin  "$@" ;; 
    79    rm)          mc_arc_fs_rm      "$@" ;; 
    80    *)       exit 1 ;; 
     79        list)           mc_arc_fs_list    "$@" ;; 
     80        copyout)        mc_arc_fs_copyout "$@" ;; 
     81        copyin)         mc_arc_fs_copyin  "$@" ;; 
     82        rm)             mc_arc_fs_rm      "$@" ;; 
     83        *)              exit 1 ;; 
    8184esac 
    8285exit 0