Ticket #2376: mc-extfs-uarc.patch

File mc-extfs-uarc.patch, 1.9 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        opwd="$(pwd)" && \ 
     53        cd "$(dirname "${3}")" && \ 
     54        rm -f ${2} ${3} && \ 
     55        $ARC_GET "$1" "$2" > /dev/null 2>&1 && \ 
     56        mv "$2" "$3" && \ 
     57        cd ${opwd} && \ 
     58        exit 0 
    5459} 
    5560 
    5661# Command: copyin archivename storedfilename sourcefile 
     
    7378shift 
    7479 
    7580case "$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 ;; 
     81        list)           mc_arc_fs_list    "$@" ;; 
     82        copyout)        mc_arc_fs_copyout "$@" ;; 
     83        copyin)         mc_arc_fs_copyin  "$@" ;; 
     84        rm)             mc_arc_fs_rm      "$@" ;; 
     85        *)              exit 1 ;; 
    8186esac 
    8287exit 0