extfs: .cab and .ace

G Jansman gjansman1 at hotmail.com
Tue Aug 10 07:29:12 UTC 2004


A long time ago I've created an ucab script to support .cab (and uimg for 
support of FAT disk images). They can still be found in the mail archive.

Since an improved cabextract version appeared I've improved the ucab script. 
Extracting files has become much faster. Both ucab versions don't support 
changing the archive (adding files etc.) or InstallShield .cab files.

Anyhow, here's the new ucab script. How to install the script can be found 
in my first mail and in $(mcdir)/extfs/README.

Anyhow, here's the ucab script:
#! /bin/sh
#
# Written by Guus Jansman
#
# This is a parser for Cabinet archives in Midnight Commander. You need
# the GPL cabextract program (version >= 1.0) written by Stuart Caie.

# Limitations:
# - Archives can only be viewed
# - Problems with empty directories as created by MsCab (non-standard cab 
files)

UNCAB=cabextract


mccabfs_list ()
{
$UNCAB -lq "$1" 2>/dev/null | gawk -v uuid=${UID-0} '
BEGIN { flag=0; date="JanFebMarAprMayJunJulAugSepOctNovDec" }
/^-------/ { flag++; if (flag > 1) exit 0; next }
/^$/ { next }
{
  if (flag == 0) next
  perm="-rw-r--r--"
  uid=uuid
  gid=0
  line=substr($0, index($0, "|")+2)
  day=substr(line, 1, 2)
  month=substr(date, (substr(line, 4, 2)-1)*3+1, 3)
  year=substr(line, 7, 4)
  hour=substr(line, 12, 2)
  minute=substr(line, 15, 2)
  size=$1
  if (substr(size, length(size)) == "|")
    size=substr(size, 1, length(size)-1)
  name=substr(line, 23)
  gsub(/\\/, "/", name)
  if (substr(name, length(name)) == "/")
  {
    name=substr(name, 1, length(name)-1)
    perm="drwxr-xr-x"
  }
  printf "%s    1 %-8d %-8d %8d %3s %02d %04d %02d:%02d %s\n", perm, uid, 
gid, size, month, day, year, hour, minute, name
}'
}


mccabfs_copyout ()
{
  $UNCAB -F "$2" -p "$1" > "$3" 2>/dev/null
}


umask 077
cmd="$1"
shift
case "$cmd" in
    list)    mccabfs_list    "$@" ;;
    copyout) mccabfs_copyout "$@" ;;
    *)       exit 1 ;;
esac
exit 0


>From: wwp <subscript at free.fr>
>To: mc-devel at gnome.org
>Subject: extfs: .cab and .ace
>Date: Sun, 1 Aug 2004 16:15:19 +0200
>
>Hi folks,
>
>
>does anyone know about patches for .cab and .ace support to MC's extfs 
>(maybe
>thru' cabextract and unace)?
>
>
>Regards,
>
>--
>wwp
>_______________________________________________
>Mc-devel mailing list
>http://mail.gnome.org/mailman/listinfo/mc-devel

_________________________________________________________________
Ook een gouden buddy worden in Messenger? Go for gold!  
http://mobile.msn.com/?lc=nl-nl




More information about the mc-devel mailing list