#!/bin/sh
#
# It is the uhafs Valery Kornienkov vlk@st.simbirsk.su 2:5051/30@fidonet
# ver 0.1 Thu Apr  6 12:05:08 2000
#
# Tested with HA 0.999.  Source of ha can be found at
# ftp://ftp.ibiblio.org/pub/Linux/utils/compress/

#set -x

export PATH=/opt/e17/bin:$PATH

EDJ=edje_cc
UEDJ=edje_decc
EDJ_LIST=edje_ls
TMPDIR=`mktemp -d ${MC_TMPDIR:-/tmp}/mctmpdir-uedj.XXXXXX`
ARCHIVE=$TMPDIR/archive.edj

mc_edj_fs_list ()
{
    [ ! -z $1 ] || exit 1
    ORIG="$1"
    ln -sf $ORIG $ARCHIVE
    cd $TMPDIR || exit 1
    $UEDJ $ARCHIVE > /dev/null
    cd archive
#    ls -l --time-style=long-iso|grep '^[-dl]'|sed -e '1d'| awk -mf 9 '
    ls -ln|sed -e '1d'| awk -mf 9 '
    {
        printf "%10s %4d %2d %3d %15d %3s %2d %5s %s \n", $1, $2, $3, $4, $5, $6, $7, $8, $9
    }
    '
}

mc_edj_fs_copyout ()
{
	# DBG: In progress... 1: /menus.edj - 2: build.sh  - 3: /tmp/mc-root/extfsByZZVcbuild.sh - 4: \n
    echo "DBG: In progress... 1: $1 - 2: $2 - 3: $3 --- TMP: $TMPDIR - ARCH: $ARCHIVE - PWD: `pwd`\n" >> /tmp/EEE.txt

}

mc_edj_fs_copyin ()
{
    echo "In progress too...\n"
}


cmd="$1"
shift

case "$cmd" in
   list)    mc_edj_fs_list    "$@" ;;
   copyout) mc_edj_fs_copyout "$@" ;;
   copyin)  mc_edj_fs_copyin  "$@" ;;
   run)     mc_edj_fs_run     "$@" ;;
   *)       exit 1 ;;
esac
rm -rf $TMPDIR 
exit 0