Ticket #1545: Don't escape tilde on cmdline, this is not necessary.
[midnight-commander.git] / vfs / extfs / uace.in
blob062d82f9359e5ad04ebc70b1e2c282966a19517b
1 #! /bin/sh
4 # ACE Virtual filesystem executive v0.1
5 # Works with unace v2.5
7 # Copyright (C) 2008 Jacques Pelletier
8 # May be distributed under the terms of the GNU Public License
9 # <jpelletier@ieee.org>
12 # Define your awk
13 AWK=gawk
14 # Define which archiver you are using with appropriate options
15 ACE_LIST="unace l"
16 ACE_GET="unace x"
17 # ACE_PUT="unace ?" not available
19 # The 'list' command executive
21 # Unace: DD.MM.YY HH.MM packed size ratio file
22 # ls:
23 mc_ace_fs_list()
25 $ACE_LIST "$1" | gawk -v uid=${UID-0} '
26 BEGIN { Month="JanFebMarAprMayJunJulAugSepOctNovDec" }
27 /%/ {
28 split($1,date,".")
30 if (date[3] > 50)
31 date[3]=date[3] + 1900
32 else
33 date[3]=date[3] + 2000
35 printf "-rw-r--r-- 1 %-8d %-8d %8d %s %2d %4d %s %s\n", uid, 0, $3, substr(Month,3*(date[2]-1)+1,3),date[1],date[3], $2, $6
36 }' 2>/dev/null
37 exit 0
40 # Command: copyout archivename storedfilename extractto
41 mc_ace_fs_copyout()
43 $ACE_GET "$1" "$2" > /dev/null 2>&1
44 mv "$2" "$3"
47 # The main routine
48 umask 077
50 cmd="$1"
51 shift
53 case "$cmd" in
54 list) mc_ace_fs_list "$@" ;;
55 copyout) mc_ace_fs_copyout "$@" ;;
56 *) exit 1 ;;
57 esac
58 exit 0