1
1

* extfs/uarj: New list-only implementation that doesn't need

patched unarj.
* extfs/unarj.diff: Remove.
* extfs/Makefile.am: Remove extfs/unarj.diff.
Этот коммит содержится в:
Pavel Roskin 2002-12-13 07:20:54 +00:00
родитель 0b9116d955
Коммит c055823512
4 изменённых файлов: 59 добавлений и 151 удалений

Просмотреть файл

@ -1,3 +1,10 @@
2002-12-13 Pavel Roskin <proski@gnu.org>
* extfs/uarj: New list-only implementation that doesn't need
patched unarj.
* extfs/unarj.diff: Remove.
* extfs/Makefile.am: Remove extfs/unarj.diff.
2002-12-13 Adam Byrtek <alpha@debian.org>
* extfs/patchfs.in: "copyin" method added (with compressed files

Просмотреть файл

@ -1,7 +1,7 @@
extfsdir = $(pkgdatadir)/extfs
# Files to install and distribute other than extfs scripts
EXTFS_MISC = README extfs.ini unarj.diff sfs.ini
EXTFS_MISC = README extfs.ini sfs.ini
# Scripts hat don't need adaptation to the local system
EXTFS_CONST = bpp hp48 rpm trpm uarj

Просмотреть файл

@ -1,34 +1,61 @@
#! /bin/sh
#
# Copyright 1998 Pavel Machek,
# partly based on zip by Jakub Jelinek 1995
# Written by Pavel Roskin
# Copyright (C) 2002 Free Software Foundation.
#
# Distribute in terms of GPL.
#
#
ARJ=mcunarj
# This filesystem doesn't support file extraction due to limitations of
# unarj, which cannot extract a single file.
UNARJ=unarj
mcarjfs_list ()
{
$ARJ v $1 | awk -v uid=${UID-0} '
BEGIN { hyphens=0 }
/^----------/ { if (hyphens > 0) exit 0; hyphens=1; next }
{
if (hyphens < 1) next;
path=$1;
getline;
printf "-rw-r--r-- 1 %-8d %-8d %8d %s-%s %s %s\n", uid, 0, $1, substr($4,4), substr($4,1,2), substr($5,1,5), path
}' 2>/dev/null
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
}
mcarjfs_copyout ()
{
$ARJ p $1 $2 2> $3 > /dev/null
}
LC_ALL=C
export LC_ALL
umask 077
case "$1" in
list) mcarjfs_list $2; exit 0;;
copyout) mcarjfs_copyout $2 $3 $4; exit 0;;
LANG=C
export LANG
cmd="$1"
shift
case "$cmd" in
list) mcarjfs_list "$@" ;;
*) exit 1 ;;
esac
exit 1
exit 0

Просмотреть файл

@ -1,126 +0,0 @@
diff -bur arj/unarj.c mc/unarj.c
--- arj/unarj.c Mon Sep 29 14:00:24 1997
+++ mc/unarj.c Fri Sep 22 21:44:29 2000
@@ -42,6 +42,7 @@
* 02/17/93 R. Jung Added archive modified date support.
* 01/22/94 R. Jung Changed copyright message.
* 07/29/96 R. Jung Added "/" to list of path separators.
+ * 02/16/98 pavel@ucw.cz Added v mode, added p mode. THIS IS MODIFIED VERSION.
*
*/
@@ -89,6 +90,7 @@
uchar header[HEADERSIZE_MAX];
char arc_name[FNAME_MAX];
int command;
+char *file_to_extract;
int bitcount;
int file_type;
int no_output;
@@ -103,6 +105,11 @@
" UNARJ l archive (list archive)\n",
" UNARJ t archive (test archive)\n",
" UNARJ x archive (extract with pathnames)\n",
+" UNARJ v archive (list archive with pathnames)\n",
+" UNARJ p archive file (print single file from archive to stderr)\n",
+"\n",
+"Warning, this version has been modified by pavel@ucw.cz\n",
+"to be used as virtual fs within mc (Midnight Commander).\n",
"\n",
"This is an ARJ demonstration program and ** IS NOT OPTIMIZED ** for speed.\n",
"You may freely use, copy and distribute this program, provided that no fee\n",
@@ -723,15 +730,24 @@
if (command == 'E')
strcpy(name, &filename[entry_pos]);
else
+ if (command == 'X')
{
strcpy(name, DEFAULT_DIR);
strcat(name, filename);
}
+ else
+ if (strcmp( &filename[0], file_to_extract ))
+ {
+ skip();
+ return 0;
+ }
+ else
+ strcpy( name, "stderr" );
if (host_os != OS)
default_case_path(name);
- if (file_exists(name))
+ if ((command != 'P') && file_exists(name))
{
printf(M_FEXISTS, name);
printf(M_SKIPPED, name);
@@ -739,7 +755,10 @@
error_count++;
return 0;
}
+ if (command != 'P')
outfile = file_open(name, writemode[file_type & 1]);
+ else
+ outfile = stderr;
if (outfile == NULL)
{
printf(M_CANTOPEN, name);
@@ -865,9 +884,12 @@
strcpy(fmode_str, " ");
if (host_os == OS)
get_mode_str(fmode_str, (uint) file_mode);
- if (strlen(&filename[entry_pos]) > 12)
+ if ((strlen(&filename[entry_pos]) > 12) || (command == 'V'))
+ if (command != 'V')
printf("%-12s\n ", &filename[entry_pos]);
else
+ printf("%s\n ", filename);
+ else
printf("%-12s ", &filename[entry_pos]);
printf("%10ld %10ld %u.%03u %s %08lX %4s%c%c%c%u%c%c%c\n",
origsize, compsize, r / 1000, r % 1000, &date_str[2], file_crc,
@@ -910,11 +932,13 @@
{
switch (command)
{
+ case 'P':
case 'E':
case 'X':
if (extract())
file_count++;
break;
+ case 'V':
case 'L':
list_arc(file_count++);
skip();
@@ -934,6 +958,7 @@
file_count, torigsize, tcompsize, r / 1000, r % 1000, &date_str[2]);
}
else
+ if (command != 'V')
printf(M_NBRFILES, file_count);
fclose(arcfile);
@@ -977,14 +1002,20 @@
if (strlen(argv[1]) > 1)
error(M_BADCOMND, argv[1]);
command = toupper(*argv[1]);
- if (strchr("ELTX", command) == NULL)
+ if (strchr("ELTXV", command) == NULL)
error(M_BADCOMND, argv[1]);
arc_p = argv[2];
}
else
{
+ command = toupper(*argv[1]);
+ if ((command!='P') || (argc != 4))
+ {
help();
return EXIT_FAILURE;
+ }
+ file_to_extract = argv[3];
+ arc_p = argv[2];
}
strncopy(arc_name, arc_p, FNAME_MAX);