diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 393667d87..aab983efb 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,10 @@ +2003-04-29 Pavel Roskin + + * extfs/iso9660.in: New filesystem for ISO-9660 images. + From Michael Shigorin + * extfs/extfs.ini: Add iso9660. + * extfs/Makefile.am: Add extfs/iso9660.in. + 2003-04-03 Andrew V. Samoilov * smbfs.c (open_readwrite): New function to replace open_read() diff --git a/vfs/extfs/Makefile.am b/vfs/extfs/Makefile.am index c3c13d9a0..2b1a1c93b 100644 --- a/vfs/extfs/Makefile.am +++ b/vfs/extfs/Makefile.am @@ -15,6 +15,7 @@ EXTFS_IN = \ deba.in \ debd.in \ dpkg.in \ + iso9660.in \ hp48.in \ lslR.in \ mailfs.in \ @@ -37,6 +38,7 @@ EXTFS_OUT = \ deba \ debd \ dpkg \ + iso9660 \ hp48 \ lslR \ mailfs \ diff --git a/vfs/extfs/extfs.ini b/vfs/extfs/extfs.ini index 46747d9e4..44fa85a9e 100644 --- a/vfs/extfs/extfs.ini +++ b/vfs/extfs/extfs.ini @@ -49,3 +49,6 @@ audio # Package of Bad Penguin (an Italian GNU/Linux distribution) bpp + +# ISO image +iso9660 diff --git a/vfs/extfs/iso9660.in b/vfs/extfs/iso9660.in new file mode 100644 index 000000000..af5edc98e --- /dev/null +++ b/vfs/extfs/iso9660.in @@ -0,0 +1,72 @@ +#! /bin/sh + +# ISO9660 VFS for MC by Michael Shigorin April 2003 +# based on lslR by Tomas Novak April 2000 +# -- look there for additional parsing comments if needed + +# tested to comply with isoinfo 2.0's output + +test_iso () { + for i in '-J -R' '-J' '-R'; do + ISOINFO="isoinfo $i" + $ISOINFO "$1" >/dev/null 2>&1 && break + done +} + +mcisofs_list () { +case "$1" in + *.bz2) MYCAT="bzip2 -dc";; + *.gz) MYCAT="gzip -dc";; + *.z) MYCAT="gzip -dc";; + *.Z) MYCAT="gzip -dc";; + *) MYCAT="cat";; +esac + +$ISOINFO -l -i "$1" | @AWK@ ' +BEGIN { + dir=""; + # Pattern to match 8 first fields. + rx = "[^ ]+[ ]+"; + rx = "^" rx rx rx rx rx rx rx rx; + irx = "^. *[0-9]+. "; +} +/^$/ { next } +/^d---------/ { next } +/^Directory listing of [^ ].*$/ { + dir=substr($0, 23); + next; +} +{ $11 != "" } { + name=$0 + sub(rx, "", name) + attr=substr($0, 1, length($0)-length(name)) + # strip inodes and extra dir entries; fix perms + sub(irx, "", name) + sub("^---------- 0 0 0", "-r--r--r-- 1 root root", attr) + sub(" $", "", name) + # skip . and .. + if (name ~ /^\.\.?/) next; + printf "%s%s%s\n", attr, dir, name +}' +} + +mcisofs_copyout () { + $ISOINFO -i "$1" -x "/$2" > "$3" +} + +export LC_ALL="C" + +cmd="$1" +shift + +case "$cmd" in + list) + test_iso "$@"; + mcisofs_list "$@"; + exit 0;; + copyout) + test_iso "$@"; + mcisofs_copyout "$@"; + exit 0;; +esac +exit 1