Browse Source

* extfs/uarj.in: New script working with open-source ARJ.
Contributed by Viatcheslav Odintsov.
* extfs/uarj: Remove.
* extfs/hp48: Rename to ...
* extfs/hp48.in: ... this. It needs awk substitution.
* extfs/Makefile.am: Adjust for the above.

Pavel Roskin 22 years ago
parent
commit
9a8ba89854
5 changed files with 91 additions and 64 deletions
  1. 7 0
      vfs/ChangeLog
  2. 5 1
      vfs/extfs/Makefile.am
  3. 2 2
      vfs/extfs/hp48.in
  4. 0 61
      vfs/extfs/uarj
  5. 77 0
      vfs/extfs/uarj.in

+ 7 - 0
vfs/ChangeLog

@@ -1,5 +1,12 @@
 2002-12-13  Pavel Roskin  <proski@gnu.org>
 
+	* extfs/uarj.in: New script working with open-source ARJ.
+	Contributed by Viatcheslav Odintsov.
+	* extfs/uarj: Remove.
+	* extfs/hp48: Rename to ...
+	* extfs/hp48.in: ... this.  It needs awk substitution.
+	* extfs/Makefile.am: Adjust for the above.
+
 	* extfs/ulha.in: Strengthen quoting.
 
 	* extfs/uha.in: Strengthen quoting.  Remove unnecessary space

+ 5 - 1
vfs/extfs/Makefile.am

@@ -4,7 +4,7 @@ extfsdir = $(pkgdatadir)/extfs
 EXTFS_MISC  = README extfs.ini sfs.ini
 
 # Scripts hat don't need adaptation to the local system
-EXTFS_CONST = bpp hp48 rpm trpm uarj
+EXTFS_CONST = bpp rpm trpm
 
 # Scripts that need adaptation to the local system - source files
 EXTFS_IN    = 			\
@@ -15,11 +15,13 @@ EXTFS_IN    = 			\
 	deba.in			\
 	debd.in			\
 	dpkg.in			\
+	hp48.in			\
 	lslR.in			\
 	mailfs.in		\
 	patchfs.in		\
 	rpms.in			\
 	uar.in			\
+	uarj.in			\
 	uha.in			\
 	ulha.in			\
 	urar.in			\
@@ -35,11 +37,13 @@ EXTFS_OUT = 			\
 	deba			\
 	debd			\
 	dpkg			\
+	hp48			\
 	lslR			\
 	mailfs			\
 	patchfs			\
 	rpms			\
 	uar			\
+	uarj			\
 	uha			\
 	ulha			\
 	urar			\

+ 2 - 2
vfs/extfs/hp48 → vfs/extfs/hp48.in

@@ -21,7 +21,7 @@
 #
 # Make sure you have kermit installed and that it's using the right serial
 # device by changing /dev/ttyXX on the next line
-AWK=awk
+AWK=@AWK@
 KERMIT="kermit -l /dev/ttyS1 -b 9600"
 
 hp48_cmd()
@@ -54,7 +54,7 @@ HP48_DIRS=
 read INPUT
 while [ "$INPUT" != "EOF" ]
 do
-    case `echo $INPUT | @AWK@ '{if (int($2)) if ($3=="Directory") print "dir";else print "file"}'` in
+    case `echo $INPUT | $AWK '{if (int($2)) if ($3=="Directory") print "dir";else print "file"}'` in
     dir) HP48_DIRS="$HP48_DIRS `hp48_retdir $INPUT`"
     printf "drwxr-xr-x   1 %-8d %-8d %8d %s %s\n" 0 0 `hp48_retsize $INPUT` "`date +\"%b %d %Y %k:%M"`" "$HP48_CDIR/`hp48_retdir $INPUT`";;
     file) printf "-rw-r--r--   1 %-8d %-8d %8d %s %s\n" 0 0 `hp48_retsize $INPUT` "`date +"%b %d %Y %k:%M"`" "$HP48_CDIR/`hp48_retdir $INPUT`";;

+ 0 - 61
vfs/extfs/uarj

@@ -1,61 +0,0 @@
-#! /bin/sh
-#
-# Written by Pavel Roskin
-# Copyright (C) 2002 Free Software Foundation.
-#
-# This filesystem doesn't support file extraction due to limitations of
-# unarj, which cannot extract a single file.
-
-
-UNARJ=unarj
-
-mcarjfs_list ()
-{
-    TMPDIR="/tmp/mctmpdir-uarj.$$"
-    mkdir $TMPDIR || exit 1
-    cd $TMPDIR
-
-    # "unarj t" gives filenames with path, "unarj l" gives other attributes
-    $UNARJ t "$1" | grep "^Testing" | cut -c 12-38 >testlist
-    $UNARJ l "$1" | sed -n -e '/------------/,/------------/p' | \
-	sed -e '1d;$d' | cut -c 1-58 >list
-
-    # Put long names into environment variables name_N
-    i=0
-    exec <testlist
-    while read name; do
-	eval name_$i=\$name
-	i=$(($i+1))
-    done
-
-    # Combine long names with the listing
-    i=0
-    exec <list
-    while read fname size ignore1 ignore2 fdate ftime; do
-	eval name=\$name_$i
-	: ${name=$fname}
-	# Date is originally YY-MM-DD, make it MM-DD-YY
-	mdy_date=`echo $fdate | sed 's/\(..\)-\(..\)-\(..\)/\2-\3-\1/'`
-	echo "-rw-r--r-- 1 root root $size $mdy_date $ftime $name"
-	i=$(($i+1))
-    done
-
-    cd /
-    rm -rf $TMPDIR
-}
-
-LC_ALL=C
-export LC_ALL
-
-LANG=C
-export LANG
-
-cmd="$1"
-shift
-
-case "$cmd" in
-  list) mcarjfs_list "$@" ;;
-  *) exit 1 ;;
-esac
-
-exit 0

+ 77 - 0
vfs/extfs/uarj.in

@@ -0,0 +1,77 @@
+#! /bin/sh
+#                                                                     
+# Written by Viatcheslav Odintsov (2:5020/181)
+# (C) 2002 ARJ Software Russia.
+#
+# This is an updated parser for ARJ archives in Midnight Commander. You need
+# full ARJ rather than UNARJ. Open-source ARJ v 3.10 for Unix platforms can
+# be obtained here:
+#
+# - http://www.sourceforge.net/projects/arj/
+# - http://arj.sourceforge.net/
+
+
+ARJ="arj -+ -ja1"
+
+
+mcarjfs_list ()
+{
+ $ARJ v "$1" | @AWK@ -v uuid=${UID-0} '
+  { 
+   if (($0 ~ /^[0-9]+\) .*/)||($0 ~ /^------------ ---------- ---------- -----/)){
+    if (filestr ~ /^[0-9]+\) .*/) {
+     printf "%s   1 %-8d %-8d %8d %02d-%02d-%02d %02d:%02d %s%s\n", perm, uid, gid, size, date[2], date[3], date[1], time[1], time[2], file, symfile
+     perm=""
+     file=""
+     symfile=""
+     filestr=""
+    }
+   }
+
+   if ($0 ~ /^[0-9]+\) .*/) {
+    filestr=$0
+#   file=substr($0, 6)
+    sub(/^[0-9]*\) /, "")
+    file=$0
+    uid=uuid
+    gid=0
+   }
+
+   if ($0 ~ /^.* [0-9]+[\t ]+[0-9]+ [0-9]\.[0-9][0-9][0-9] [0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9].*/) {
+    size=$3
+    split($6, date, "-")
+    split($7, time, ":")
+    if ($8 ~ /^[rwx-]/) {perm=$8;}
+    else                {perm="-rw-r--r--"}
+   }
+
+   if ($0 ~ /^[\t ]+SymLink -> .*/) {
+    symfile = " -> "$3
+    perm="l"substr(perm, 2)
+   }
+
+   if ($0 ~ /^[\t ]+Owner: UID [0-9]+\, GID [0-9]+/) {
+    uid=$3
+    gid=$5
+    owner=1
+   }
+  }'
+ #2>/dev/null
+}
+
+
+mcarjfs_copyout ()
+{
+    $ARJ p "$1" "$2" > "$3" 2>/dev/null
+}
+
+
+umask 077
+cmd="$1"
+shift
+case "$cmd" in
+    list)    mcarjfs_list    "$@" ;;
+    copyout) mcarjfs_copyout "$@" ;;
+    *)       exit 1 ;;
+esac
+exit 0