Hello Pavel,

Thanks for the reaction!

...
Looks good, but can you post it as diff -u? No need for tar balls,
diff can create new files, too.
Below are 'diff -u' files for lib/mc.ext.in, vfs/extfs/extfs.ini, and the actual vfs scripts. The differences are compared with mc-4.6.0-pre2.tar.gz.
I can't put the changes in the CVS repository: the only way I can get on the Internet is by a Windows machine (I'm not even sure whether I'm allowed to make any changes).

I have a proposal for future extfs feature:
Would it be a good idea to include a "test" function in every extfs script?
This way one could open any archive with whatever extension with the same
keystroke (something like Total Commander's Control-PageDown). This would
be useful for e.g. archives that are made executable or disk images with
the extension .img that can have FAT, ext2, or whatever.
Well, you can cd file.exe#uzip...
True, and it works fine but it's not very userfriendly.

Anyhow, here are the diff's:
--- old/vfs/extfs/extfs.ini Mon Dec 9 15:15:48 2002
+++ new/vfs/extfs/extfs.ini Mon Jan 20 16:14:39 2003
@@ -7,8 +7,9 @@
ulha
urar
uha
-# For arj usage you need a special patch to unarj (see unarj.diff)
uarj
+ucab
+uarc

# ar is used for static libraries
uar
@@ -49,3 +50,7 @@

# Package of Bad Penguin (an Italian GNU/Linux distribution)
bpp
+
+# Diskimage files
+uimg
+uadf

--- old/lib/mc.ext.in Wed Dec 25 01:26:23 2002
+++ new/lib/mc.ext.in Mon Jan 20 16:17:48 2003
@@ -432,6 +432,16 @@
Open=%cd %p#urar
View=%view{ascii} rar v -c- %f

+# cab
+type/^Microsoft\ CAB\ file
+ Open=%cd %p#ucab
+ View=%view{ascii} cabextract -l %f
+
+# arc
+regex/\.(arc|ARC|pak|PAK)
+ Open=%cd %p#uarc
+ View=%view{ascii} nomarch -lv %f
+
# cpio
shell/.cpio.Z
Open=%cd %p#ucpio
@@ -444,6 +454,13 @@
shell/.cpio
Open=%cd %p#ucpio
View=%view{ascii} cpio -itv <'%f' 2>/dev/null
+
+regex/\.(img|IMG|ima|IMA|st|ST)
+ Open=%cd %p#uimg
+
+regex/\.(adf|ADF)
+ Open=%cd %p#uadf
+ View=%view{ascii} unadf -lr %f

# ls-lR
regex/(^|\.)ls-?lR$

--- old/vfs/extfs/uadf Mon Jan 20 17:00:34 2003
+++ new/vfs/extfs/uadf Thu Jan 09 09:01:26 2003
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+# Description:
+# Midnight Commander extfs script to read Amiga ADF disk images.
+
+# 2003-01-06 Version 0.1 G. Jansman
+
+# Limitations:
+# Files can only be added as root (under Linux only so disabled now).
+# File attributes are not preserved.
+
+# Used programs:
+# unADF v1.0 (part of adflib.zip, Laurent Clevy and Dan Sutherland)
+
+# Alternative programs (not supported by this script):
+# AdfOpus (win32, Dan Sutherland and Gary Harris)
+# readdisk (part of UAE)
+
+# Purposes:
+# Emulators (UAE, WinUAE, etc.)
+
+# Settings:
+LISTADF="unadf -lr"
+EXTRACTADF="unadf -p"
+TESTADF="unadf -l"
+TEMPDIR=/tmp/mctmpdir-mcadf.$USER.${RANDOM}
+
+mcadffs_list ()
+{
+ $LISTADF "$1" 2>/dev/null | gawk -v uid=${UID-0} '
+ BEGIN { emptycnt=0; date="JanFebMarAprMayJunJulAugSepOctNovDec" }
+ /^$/ { emptycnt++; next }
+ // { if (emptycnt != 1) next }
+ {
+ slashpos=index($0, "/")
+ str=substr($0, slashpos+18)
+ if (substr(str, length(str)) == "/")
+ {
+ attr="drwxr-xr-x"
+ str=substr(str, 1, length(str)-1)
+ sz=0
+ }
+ else
+ {
+ attr="-rw-r--r--"
+ sz=substr($0, 1, slashpos-5)
+ }
+ tm=substr($0, slashpos+8, 5)
+ dt=substr($0, slashpos-4, 10)
+ split(dt, a, "/")
+ printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", attr, uid, 0, sz, substr(date, (a[2]-1)*3+1, 3), a[3], a[1], tm, str
+ }'
+}
+
+mcadffs_copyout ()
+{
+ $EXTRACTADF "$1" "$2" 2>/dev/null > "$3"
+}
+
+mcadffs_test ()
+{
+ if $TESTADF "$1" >/dev/null 2>&1; then
+ echo "OK"
+ else
+ echo "UNKNOWN"
+ fi
+}
+
+# This can usually only be performed as root (Linux only).
+mcadffs_copyin ()
+{
+ mkdir $3.mnt
+ mount -n -w "$1" $3.mnt -t affs -o loop
+ cp -a -f $3 "$3.mnt/$2"
+ umount -n $3.mnt
+ rmdir $3.mnt
+}
+
+# This can usually only be performed as root (Linux only).
+mcadffs_rm ()
+{
+ mkdir $TEMPDIR
+ mount -n -w "$1" $TEMPDIR -t affs -o loop
+ rm -f "$TEMPDIR/$2"
+ umount -n $TEMPDIR
+ rmdir $TEMPDIR
+}
+
+umask 077
+
+cmd=$1
+shift
+case "$cmd" in
+ list) mcadffs_list "$@" ;;
+ copyout) mcadffs_copyout "$@" ;;
+# copyin) mcadffs_copyin "$@" ;; # Can only be performed as root
+# rm) mcadffs_rm "$@" ;; # Can only be performed as root
+# test) mcadffs_test "$@" ;; # Not supported by MC extfs
+ *) exit 1 ;;
+esac
+exit 0

--- old/vfs/extfs/uarc Mon Jan 20 17:00:34 2003
+++ new/vfs/extfs/uarc Thu Jan 09 09:00:48 2003
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Description:
+# Midnight Commander extfs script to read ARC archive files.
+
+# 2003-01-03 Version 0.1 G. Jansman
+
+# Used programs:
+# nomarch (Unix, Russell Marks)
+
+# Settings:
+LISTARC="nomarch -lv"
+EXTRACTARC="nomarch -p"
+
+mcarcfs_list ()
+{
+ $LISTARC "$1" | gawk -v uid=${UID-0} '
+ BEGIN { date="JanFebMarAprMayJunJulAugSepOctNovDec" }
+ {
+ split(substr($0, 14), t)
+ str=substr($0, 1, 13)
+ while (length(str) != 0 && substr(str, length(str), 1) == " ")
+ {
+ str=substr(str, 1, length(str) - 1)
+ }
+ split(t[5], a, "-")
+ attr="-rw-r--r--"
+ printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", attr, uid, 0, t[4], substr(date, (a[2]-1)*3+1, 3), a[3], a[1], t[6], str
+ }'
+}
+
+mcarcfs_copyout ()
+{
+ $EXTRACTARC "$1" "$2" > "$3"
+}
+
+umask 077
+
+cmd="$1"
+shift
+case "$cmd" in
+ list) mcarcfs_list "$@" ;;
+ copyout) mcarcfs_copyout "$@" ;;
+ *) exit 1 ;;
+esac
+exit 0

--- old/vfs/extfs/ucab Mon Jan 20 17:00:34 2003
+++ new/vfs/extfs/ucab Thu Jan 09 09:01:46 2003
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+# Description:
+# Midnight Commander extfs script to read Microsoft Cabinet files.
+
+# 2003-01-03 Version 0.1 G. Jansman
+
+# Limitations:
+# No files can be added to CAB files.
+# File attributes are not preserved.
+
+# Used programs:
+# cabextract (Unix, Stuart Caie)
+
+# Alternative programs (not supported by this script):
+# cablinux (Linux, Rien, seems buggy and no compression)
+# 7-Zip (win32, list/unpack only)
+# MultiArc MsCab 0.61 (win32, plug-in for Total Commander)
+# extract (dos, on Windows CD, list/unpack only)
+# extrac32 (win32, on Windows CD, list/unpack only)
+
+# Settings:
+LISTCAB="cabextract -l"
+EXTRACTCAB="cabextract -q"
+TESTCAB="cabextract -l"
+
+mccabfs_list ()
+{
+ $LISTCAB "$1" | gawk -v uid=${UID-0} '
+ BEGIN { hyphens=0; date="JanFebMarAprMayJunJulAugSepOctNovDec" }
+ /^----/ { hyphens++; next }
+ /^$/ { next }
+ // { if (hyphens != 1) next }
+ {
+ str=substr($0, 35)
+ gsub(/\\/, "/", str)
+ if (substr(str, length(str)) == "/")
+ {
+# cabextract does not distinguish between empty directories and empty files yet
+# so this will never be executed. Hopefully next cabextract version...
+ attr="drwxr-xr-x"
+ str=substr(str, 1, length(str)-1)
+ }
+ else
+ {
+ attr="-rw-r--r--"
+ }
+ split($3, a, ".")
+ tm=substr($4,1,5)
+ printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", attr, uid, 0, $1, substr(date, (a[2]-1)*3+1, 3), a[1], a[3], tm, str
+ }'
+}
+
+# Extract all since cabextract cannot extract single files.
+mccabfs_copyout ()
+{
+ mkdir "$3.dir"
+ $EXTRACTCAB -d "$3.dir" "$1" >/dev/null
+ mv "$3.dir/$2" "$3"
+ rm -rf "$3.dir"
+}
+
+mccabfs_test ()
+{
+ if $TESTCAB "$1" >/dev/null 2>&1; then
+ echo "OK"
+ else
+ echo "UNKNOWN"
+ fi
+}
+
+umask 077
+
+cmd="$1"
+shift
+case "$cmd" in
+ list) mccabfs_list "$@" ;;
+ copyout) mccabfs_copyout "$@" ;;
+# test) mccabfs_test "$@" ;; # Not supported by MC extfs
+ *) exit 1 ;;
+esac
+exit 0

--- old/vfs/extfs/uimg Mon Jan 20 17:00:34 2003
+++ new/vfs/extfs/uimg Thu Jan 09 09:02:04 2003
@@ -0,0 +1,227 @@
+#!/bin/sh
+
+# Description:
+# Midnight Commander extfs script to handle DOS/Atari disk images.
+
+# 2003-01-03 version 0.1 G. Jansman
+
+# Limitations:
+# Only the 1st primary harddisk partition and floppy images can be read
+# File attributes are not preserved.
+# Filenames containing non-ascii characters may cause problems (check mtools info).
+# Long filenames are written if needed. Some emulators/OS's might have problems with it (old FreeDOS?).
+# Diskimages of dosemu are not handled
+
+# Used programs:
+# Mtools, Emmet P. Gray, Viktor Dukhovni, Alain Knaff, David Niemi
+
+# Alternative programs (not supported by this script):
+# + Mounting a loop device (one has to have proper rights though).
+# + XMess's imgtool (less powerfull).
+# + Gilles Vollant's extract (DOS program, less powerful)
+# + bximage (disk image creation, part of Bochs)
+
+# Purposes:
+# Emulators (Bochs x86 emulator with e.g. FreeDOS, Hatari ST emulator, etc.)
+# Maybe disk image copiers (partimage, etc.)
+
+# Settings:
+SIZE=1.44m # Only needed for creating a disk image
+TEMPRCFILE=/tmp/mctmpfile-uimg.$USER.${RANDOM}
+LISTIMG="mdir -/ -a -f"
+ATTRIBIMG="mattrib"
+ADDIMG="mcopy -pm -D o"
+DELETEIMG="mdel"
+EXTRACTIMG="mcopy"
+MKDIRIMG="mmd"
+RMDIRIMG="mrd"
+TESTIMG="minfo"
+CREATEIMG="mformat -C"
+CONFIGIMG="mtoolstest"
+
+case "$SIZE" in
+ 160*) CREATEIMG="$CREATEIMG -f 160" # 12/40/1/8
+ ;;
+ 180*) CREATEIMG="$CREATEIMG -f 180" # 12/40/1/9
+ ;;
+ 320*) CREATEIMG="$CREATEIMG -f 320" # 12/40/2/8
+ ;;
+ 360*) CREATEIMG="$CREATEIMG -f 360" # 12/40/2/9
+ ;;
+ 720*) CREATEIMG="$CREATEIMG -f 720" # 12/80/2/9
+ ;;
+ 800*) CREATEIMG="$CREATEIMG -t 80 -h 2 -n 10" # 12/80/2/10
+ ;;
+ 1.2*) CREATEIMG="$CREATEIMG -f 1200" # 12/80/2/15
+ ;;
+ 1.4*) CREATEIMG="$CREATEIMG -f 1440" # 12/80/2/18
+ ;;
+ 2.8*) CREATEIMG="$CREATEIMG -f 2880" # 12/80/2/36
+ ;;
+ *) CREATEIMG="$CREATEIMG -f 1440" # 12/80/2/18
+ ;;
+esac
+
+drives="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+createmtoolsrc ()
+{
+# Find a free drive letter
+ useddrives="`$CONFIGIMG | grep -e '^drive [A-Z]:.*' | sed -e 's/drive \(.\):.*/\1/'`"
+ for (( drivenum=2 ; drivenum != 25 ; drivenum++ )) ; do
+ DRIVE=${drives:drivenum:1}
+ if [[ $useddrives == ${useddrives/$DRIVE/1} ]]; then
+ break; # Found a free drive letter
+ fi
+ done
+ if [[ drivenum == 25 ]]; then
+ exit 1; # Could not find a free drive letter
+ fi
+ DRIVE="${DRIVE}:"
+
+# Create temporary settings file
+ rm -f $TEMPRCFILE ; touch $TEMPRCFILE
+ echo MTOOLS_LOWER_CASE=0 >> $TEMPRCFILE
+ echo MTOOLS_TWENTY_FOUR_HOUR_CLOCK=1 >> $TEMPRCFILE
+ echo "drive $DRIVE" >> $TEMPRCFILE
+ echo " file=\"$1\"" >> $TEMPRCFILE
+ echo " mformat_only" >> $TEMPRCFILE
+ if [[ -e "$1" && "`wc -c "$1" | sed -e 's/[ ]*\([^ ]*\).*$/\1/'`" -gt "4194304" ]]; then
+ echo " partition=1" >> $TEMPRCFILE
+ fi
+
+# Set environment variable
+ export MTOOLSRC=$TEMPRCFILE
+}
+
+deletemtoolsrc ()
+{
+ rm -f $TEMPRCFILE
+}
+
+mcimgfs_list ()
+{
+ createmtoolsrc "$1"
+ $LISTIMG $DRIVE/ | gawk -v uid=${UID-0} '
+ BEGIN { direntry=0; date="JanFebMarAprMayJunJulAugSepOctNovDec" }
+ /^Directory for / { direntry=1 }
+ /[ ]*[0-9][0-9]* file/ { direntry=0 ; next }
+ /^$/ { next }
+ /^\./ { next }
+ // { if (direntry == 0) next }
+ {
+ if (index($0, "Directory for ") == 1)
+ {
+ curdir=substr($0, 18)
+ }
+ else
+ {
+ tm=substr($0, 36, 5)
+ d=substr($0, 24, 10)
+ if (length($0) > 43)
+ {
+ str=substr($0, 43)
+ }
+ else
+ {
+ str=substr($0, 1, 8)
+ while (substr(str, length(str), 1) == " ")
+ {
+ str=substr(str, 1, length(str) - 1)
+ }
+ if (substr($0, 10, 3) != " ")
+ {
+ str=(str "." $2)
+ }
+ }
+ if (length(curdir) != 0)
+ {
+ str=(curdir "/" str)
+ }
+ if (substr($0, 14, 5) == "<DIR>")
+ {
+ attr="drwxr-xr-x"
+ sz=0
+ }
+ else
+ {
+ attr="-rw-r--r--"
+ sz=substr($0, 14, 9)
+ }
+ split(d, a, "-")
+ printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", attr, uid, 0, sz, substr(date, (a[1]-1)*3+1, 3), a[2], a[3], tm, str
+ }
+ }'
+ deletemtoolsrc
+}
+
+mcimgfs_copyin ()
+{
+ createmtoolsrc "$1"
+ $ADDIMG "$3" "$DRIVE/$2" >/dev/null
+ deletemtoolsrc
+}
+
+mcimgfs_copyout ()
+{
+ createmtoolsrc "$1"
+ $EXTRACTIMG "$DRIVE/$2" - > "$3"
+ deletemtoolsrc
+}
+
+mcimgfs_rm ()
+{
+ createmtoolsrc "$1"
+ $ATTRIBIMG -r "$DRIVE/$2" >/dev/null
+ $DELETEIMG "$DRIVE/$2" >/dev/null
+ deletemtoolsrc "$1"
+}
+
+mcimgfs_mkdir ()
+{
+ createmtoolsrc "$1"
+ $MKDIRIMG "$DRIVE/$2" >/dev/null
+ deletemtoolsrc
+}
+
+mcimgfs_rmdir ()
+{
+ createmtoolsrc "$1"
+ $RMDIRIMG "$DRIVE/$2" >/dev/null
+ deletemtoolsrc
+}
+
+mcimgfs_test ()
+{
+ createmtoolsrc "$1"
+ if $TESTIMG $DRIVE >/dev/null 2>&1; then
+ echo "OK"
+ else
+ echo "UNKNOWN"
+ fi
+ deletemtoolsrc
+}
+
+mcimgfs_create ()
+{
+ createmtoolsrc "$1"
+ $CREATEIMG $DRIVE >/dev/null
+ deletemtoolsrc
+}
+
+umask 077
+
+cmd="$1"
+shift
+case "$cmd" in
+ list) mcimgfs_list "$@" ;;
+ rm) mcimgfs_rm "$@" ;;
+ copyin) mcimgfs_copyin "$@" ;;
+ copyout) mcimgfs_copyout "$@" ;;
+ mkdir) mcimgfs_mkdir "$@" ;;
+ rmdir) mcimgfs_rmdir "$@" ;;
+# test) mcimgfs_test "$@" ;; # Not supported by MC extfs
+# create) mcimgfs_create "$@" ;; # Not supported by MC extfs
+ *) exit 1 ;;
+esac
+exit 0


_________________________________________________________________
Chatten met je online vrienden via MSN Messenger. http://messenger.msn.nl/

_______________________________________________
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel

Reply via email to