extfs helpers: Replace all 'gawk' occurences with @AWK@ meta variable.
[midnight-commander.git] / src / vfs / extfs / helpers / uace.in
blobb383d4152ad2cf25b912d34d35344841eeb3af25
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 which archiver you are using with appropriate options
13 ACE_LIST="unace l"
14 ACE_GET="unace x"
15 # ACE_PUT="unace ?" not available
17 # The 'list' command executive
19 # Unace: DD.MM.YY HH.MM packed size ratio file
20 # ls:
21 mc_ace_fs_list()
23 if [ "x$UID" = "x" ]; then
24 UID=`id -ru 2>/dev/null`
25 if [ "x$UID" = "x" ]; then
26 UID=0
29 $ACE_LIST "$1" | @AWK@ -v uid=$UID '
30 BEGIN { Month="JanFebMarAprMayJunJulAugSepOctNovDec" }
31 /%/ {
32 split($1,date,".")
34 if (date[3] > 50)
35 date[3]=date[3] + 1900
36 else
37 date[3]=date[3] + 2000
39 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
40 }' 2>/dev/null
41 exit 0
44 # Command: copyout archivename storedfilename extractto
45 mc_ace_fs_copyout()
47 $ACE_GET "$1" "$2" > /dev/null 2>&1
48 mv "$2" "$3"
51 # The main routine
52 umask 077
54 cmd="$1"
55 shift
57 case "$cmd" in
58 list) mc_ace_fs_list "$@" ;;
59 copyout) mc_ace_fs_copyout "$@" ;;
60 *) exit 1 ;;
61 esac
62 exit 0