Репозитории ALT
S: | 1.13-alt2 |
5.1: | 1.3.5-alt6 |
4.1: | 1.3.5-alt4.M40.1 |
4.0: | 1.3.5-alt4.M40.1 |
3.0: | 1.3.5-alt2 |
+updates: | 1.3.5-alt2.M30.1 |
Другие репозитории
Upstream: | 1.3.12 |
Группа :: Архивирование/Сжатие
Пакет: gzip
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: gzip-1.4-alt3.patch
Скачать
Скачать
bootstrap.conf | 2 -
gzexe.in | 8 ++-
tests/zgrep-f | 2 +
zdiff.1 | 46 +++++++++++++-------
zdiff.in | 109 +++++++++++++++++++++++++++++++----------------
zgrep.1 | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
zgrep.in | 19 +++++++--
zmore.in | 13 ++++-
znew.in | 31 +++++++-------
9 files changed, 270 insertions(+), 89 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 2353208..2974969 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -72,10 +72,8 @@ autoconf 2.61
automake 1.11
autopoint -
gettext -
-git 1.4.4
makeinfo -
perl 5.5
-rsync -
tar -
"
diff --git a/gzexe.in b/gzexe.in
index cd6d845..d2b6513 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -81,7 +81,8 @@ tmp=
trap 'res=$?
test -n "$tmp" && rm -f "$tmp"
(exit $res); exit $res
-' 0 1 2 3 5 10 13 15
+' 0
+trap '(exit 143); exit 143' 1 2 3 5 10 13 15
mktemp_status=
@@ -146,7 +147,7 @@ for i do
if test $decomp -eq 0; then
(cat <<'EOF' &&
#!/bin/sh
-skip=44
+skip=45
tab=' '
nl='
@@ -160,7 +161,8 @@ gztmpdir=
trap 'res=$?
test -n "$gztmpdir" && rm -fr "$gztmpdir"
(exit $res); exit $res
-' 0 1 2 3 5 10 13 15
+' 0
+trap '(exit 143); exit 143' 1 2 3 5 10 13 15
if type mktemp >/dev/null 2>&1; then
gztmpdir=`mktemp -dt`
diff --git a/tests/zgrep-f b/tests/zgrep-f
index 34d290c..01804bb 100644
--- a/tests/zgrep-f
+++ b/tests/zgrep-f
@@ -22,6 +22,8 @@
require_POSIX_grep_
+test -d /proc/$$/fd || skip_ '/proc/$$/fd is not available'
+
echo needle > n || framework_failure_
echo needle > haystack || framework_failure_
gzip haystack || framework_failure_
diff --git a/zdiff.1 b/zdiff.1
index 588974c..77d0a79 100644
--- a/zdiff.1
+++ b/zdiff.1
@@ -10,37 +10,51 @@ zcmp, zdiff \- compare compressed files
[ diff_options ] file1
[ file2 ]
.SH DESCRIPTION
-.I Zcmp
+.B zcmp
and
-.I zdiff
+.B zdiff
are used to invoke the
-.I cmp
+.B cmp
or the
-.I diff
+.B diff
program on files compressed via
-.IR gzip "."
+.BR gzip .
All options specified are passed directly to
-.I cmp
+.B cmp
or
-.IR diff "."
-If only 1 file is specified, then the files compared are
+.BR diff .
+If only one file is specified, then the files compared are
.I file1
and an uncompressed
-.IR file1 ".gz."
+.I file1
+without
+.IR .gz ", " .bz2 ", " .lzma
+or
+.I .xz
+suffix.
If two files are specified, then they are uncompressed if necessary and fed to
-.I cmp
+.B cmp
or
-.IR diff "."
+.BR diff .
The exit status from
-.I cmp
+.B cmp
or
-.I diff
+.B diff
is preserved.
.SH "SEE ALSO"
-cmp(1), diff(1), zmore(1), zgrep(1), znew(1), zforce(1), gzip(1), gzexe(1)
+.BR cmp (1),
+.BR diff (1),
+.BR zmore (1),
+.BR zgrep (1),
+.BR znew (1),
+.BR zforce (1),
+.BR gzexe (1),
+.BR gzip (1),
+.BR bzip2 (1),
+.BR xz (1).
.SH BUGS
Messages from the
-.I cmp
+.B cmp
or
-.I diff
+.B diff
programs refer to temporary filenames instead of those specified.
diff --git a/zdiff.in b/zdiff.in
index 72ae643..4971b1e 100644
--- a/zdiff.in
+++ b/zdiff.in
@@ -24,13 +24,19 @@ case $1 in
esac
PATH=$bindir:$PATH
-case $1 in
- --__cmp) shift
- prog=cmp; cmp='${CMP-cmp}' ;;
+case "${0##*/}" in
+ bz*) def_compr=bzip2 ;;
+ lz*) def_compr=lzma ;;
+ xz*) def_compr=xz ;;
+ *) def_compr=gzip ;;
+esac
+
+case "${0##*/}" in
+ *cmp) prog=cmp; cmp='${CMP-cmp}' ;;
*) prog=diff; cmp='${DIFF-diff}';;
esac
-version="z$prog (gzip) @VERSION@
+version="${0##*/} (gzip) @VERSION@
Copyright (C) 2009, 2011 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
@@ -41,7 +47,7 @@ Written by Jean-loup Gailly."
usage="Usage: $0 [OPTION]... FILE1 [FILE2]
Compare FILE1 to FILE2, using their uncompressed contents if they are
compressed. If FILE2 is omitted, compare FILE1 to the uncompressed
-contents of FILE1.gz. Do comparisons like '$prog' does.
+file FILE1 without compression suffix. Do comparisons like '$prog' does.
OPTIONs are the same as for '$prog'.
@@ -75,27 +81,55 @@ done
gzip_status=0
exec 3>&1
-if test $# -eq 1; then
- case $1 in
- *[-.]gz* | *[-.][zZ] | *.t[ga]z)
- FILE=`expr "X$1" : 'X\(.*\)[-.][zZtga]*$'`
- gzip_status=$(
- exec 4>&1
- (gzip -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
- );;
+guess_compr()
+{
+ case $2 in
+ *[-.]bz2)
+ eval $1=bzip2
+ FILE="${2%[-.]bz2}";;
+ *[-.]xz)
+ eval $1=xz
+ FILE="${2%[-.]xz}";;
+ *[-.]lzma)
+ eval $1=lzma
+ FILE="${2%[-.]lzma}";;
+ *[-.]gz*)
+ eval $1=gzip
+ FILE="${2%[-.]gz*}";;
+ *[-.][zZ])
+ eval $1=gzip
+ FILE="${2%[-.][zZ]}";;
+ *[-.]t[ga]z)
+ eval $1=gzip
+ FILE="${2%[-.]t[ga]z}";;
+ -)
+ eval $1=$def_compr
+ FILE="$2";;
*)
- echo >&2 "$0: $1: unknown compressed file extension"
- exit 2;;
+ eval $1=
+ FILE="$2";;
esac
+}
+
+if test $# -eq 1; then
+ guess_compr compr "$1"
+ if test "$1" = "$FILE"; then
+ echo >&2 "$0: $1: unknown compressed file extension"
+ exit 2
+ fi
+ gzip_status=$(
+ exec 4>&1
+ ($compr -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
+ )
elif test $# -eq 2; then
- case "$1" in
- *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
- case "$2" in
- *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
+ guess_compr compr1 "$1"
+ guess_compr compr2 "$2"
+ if test -n "$compr1"; then
+ if test -n "$compr2"; then
if test "$1$2" = --; then
gzip_status=$(
exec 4>&1
- (gzip -cdfq - 4>&-; echo $? >&4) 3>&- |
+ ($compr1 -cdfq - 4>&-; echo $? >&4) 3>&- |
eval "$cmp" - - >&3
)
elif
@@ -106,8 +140,8 @@ elif test $# -eq 2; then
then
gzip_status=$(
exec 4>&1
- (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
- ( (gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
+ ($compr1 -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
+ ( ($compr2 -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
eval "$cmp" /dev/fd/5 - >&3) 5<&0
)
cmp_status=$?
@@ -117,7 +151,7 @@ elif test $# -eq 2; then
esac
(exit $cmp_status)
else
- F=`expr "/$2" : '.*/\(.*\)[-.][zZtga]*$'` || F=$prog
+ F=$prog
tmp=
trap '
test -n "$tmp" && rm -f "$tmp"
@@ -129,34 +163,35 @@ elif test $# -eq 2; then
set -C
tmp=${TMPDIR-/tmp}/$F.$$
fi
- gzip -cdfq -- "$2" > "$tmp" || exit 2
+ $compr2 -cdfq -- "$2" > "$tmp" || exit 2
gzip_status=$(
exec 4>&1
- (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
+ ($compr1 -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
eval "$cmp" - '"$tmp"' >&3
)
cmp_status=$?
rm -f "$tmp" || gzip_status=$?
trap - HUP INT PIPE TERM 0
(exit $cmp_status)
- fi;;
- *)
+ fi
+ else
gzip_status=$(
exec 4>&1
- (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
+ ($compr1 -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
eval "$cmp" - '"$2"' >&3
- );;
- esac;;
- *) case "$2" in
- *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
+ )
+ fi
+ else
+ if test -n "$compr2"; then
gzip_status=$(
exec 4>&1
- (gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- |
+ ($compr2 -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- |
eval "$cmp" '"$1"' - >&3
- );;
- *) eval "$cmp" '"$1"' '"$2"';;
- esac;;
- esac
+ )
+ else
+ eval "$cmp" '"$1"' '"$2"'
+ fi
+ fi
else
echo >&2 "$0: invalid number of operands; try \`$0 --help' for help"
exit 2
diff --git a/zgrep.1 b/zgrep.1
index ef37bd8..c0ba0f0 100644
--- a/zgrep.1
+++ b/zgrep.1
@@ -6,24 +6,135 @@ zgrep \- search possibly compressed files for a regular expression
[ grep_options ]
.BI [\ -e\ ] " pattern"
.IR filename ".\|.\|."
+.br
+.B zegrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B zfgrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B bzgrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B bzegrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B bzfgrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B lzgrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B lzegrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B lzfgrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B xzgrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B xzegrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B xzfgrep
+[ grep_options ]
+.BI [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
.SH DESCRIPTION
-.I Zgrep
+.B zgrep
invokes
-.I grep
-on compressed or gzipped files.
+.B grep
+on compressed files.
All options specified are passed directly to
-.IR grep .
+.BR grep .
If no file is specified, then the standard input is decompressed
if necessary and fed to grep.
Otherwise the given files are uncompressed if necessary and fed to
-.IR grep .
+.BR grep .
.PP
-If the GREP environment variable is set,
-.I zgrep
+If
+.B zgrep
+is invoked as
+.B zegrep
+or
+.B zfgrep
+then
+.B egrep
+or
+.B fgrep
+is used instead of
+.BR grep .
+.br
+If the
+.I GREP
+environment variable is set,
+.B zgrep
uses it as the
-.I grep
+.B grep
program to be invoked.
+.br
+If
+.B zgrep
+is invoked as
+.BR bzgrep ", " bzegrep
+or
+.BR bzfgrep ", "
+then
+.B bzip2
+is used instead of
+.BR gzip .
+.br
+Likewise, if
+.B zgrep
+is invoked as
+.BR lzgrep ", " lzegrep
+or
+.BR lzfgrep ", "
+then
+.B lxma
+is used instead of
+.BR gzip .
+.br
+Likewise, if
+.B zgrep
+is invoked as
+.BR xzgrep ", " xzegrep
+or
+.BR xzfgrep ", "
+then
+.B xz
+is used instead of
+.BR gzip .
.SH AUTHOR
Charles Levert (charles@comm.polymtl.ca)
.SH "SEE ALSO"
-grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)
+.BR grep (1),
+.BR zdiff (1),
+.BR zmore (1),
+.BR znew (1),
+.BR zforce (1),
+.BR gzexe (1),
+.BR gzip (1),
+.BR bzip2 (1),
+.BR xz (1).
diff --git a/zgrep.in b/zgrep.in
index 7346a2c..b0cb718 100644
--- a/zgrep.in
+++ b/zgrep.in
@@ -28,15 +28,26 @@ case $1 in
esac
PATH=$bindir:$PATH
-grep='${GREP-grep}'
+case "${0##*/}" in
+ bz*) compr=bzip2 ;;
+ lz*) compr=lzma ;;
+ xz*) compr=xz ;;
+ *) compr=gzip ;;
+esac
+
+case "${0##*/}" in
+ *egrep) grep='${GREP-grep} -E' ;;
+ *fgrep) grep='${GREP-grep} -F' ;;
+ *) grep='${GREP-grep}' ;;
+esac
-version='zgrep (gzip) @VERSION@
+version="${0##*/} (gzip) @VERSION@
Copyright (C) 2010-2011 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
-Written by Jean-loup Gailly.'
+Written by Jean-loup Gailly."
usage="Usage: $0 [OPTION]... [-e] PATTERN [FILE]...
Look for instances of PATTERN in the input FILEs, using their
@@ -177,7 +188,7 @@ do
# Fail if gzip or grep (or sed) fails.
gzip_status=$(
exec 5>&1
- (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
+ ($compr -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
if test $files_with_matches -eq 1; then
eval "$grep" >/dev/null && { printf '%s\n' "$i" || exit 2; }
elif test $files_without_matches -eq 1; then
diff --git a/zmore.in b/zmore.in
index 92144fe..a2b878b 100644
--- a/zmore.in
+++ b/zmore.in
@@ -23,7 +23,7 @@ case $1 in
esac
PATH=$bindir:$PATH; export PATH
-version="zmore (gzip) @VERSION@
+version="${0##*/} (gzip) @VERSION@
Copyright (C) 2010-2011 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
@@ -36,6 +36,13 @@ Like 'more', but operate on the uncompressed contents of any compressed FILEs.
Report bugs to <bug-gzip@gnu.org>."
+case "${0##*/}" in
+ bz*) compr=bzip2 ;;
+ lz*) compr=lzma ;;
+ xz*) compr=xz ;;
+ *) compr=gzip ;;
+esac
+
if test "`echo -n a`" = "-n a"; then
# looks like a SysV system:
n1=''; n2='\c'
@@ -59,7 +66,7 @@ if test $# = 0; then
if test -t 0; then
echo >&2 "$0: invalid number of operands; try \`$0 --help' for help"
else
- gzip -cdfq | eval ${PAGER-more}
+ $compr -cdfq | eval ${PAGER-more}
fi
else
FIRST=1
@@ -83,7 +90,7 @@ else
fi
if test "$ANS" != 's'; then
echo "------> $FILE <------"
- gzip -cdfq -- "$FILE" | eval ${PAGER-more}
+ $compr -cdfq -- "$FILE" | eval ${PAGER-more}
fi
if test -t 1; then
FIRST=0
diff --git a/znew.in b/znew.in
index a912e85..a9c2f2c 100644
--- a/znew.in
+++ b/znew.in
@@ -59,28 +59,29 @@ block=1024
# block is the disk block size (best guess, need not be exact)
warn="(does not preserve modes and timestamp)"
-tmp=${TMPDIR-/tmp}/zfoo.$$
-set -C
-echo hi > $tmp || exit
-if test -z "`(${CPMOD-cpmod} $tmp $tmp) 2>&1`"; then
- cpmod=${CPMOD-cpmod}
+cpmod=
+cpmodarg=
+if type ${CPMOD:-cpmod} 2>/dev/null; then
+ cpmod=${CPMOD:-cpmod}
warn=""
fi
-if test -z "$cpmod" && ${TOUCH-touch} -r $tmp $tmp 2>/dev/null; then
- cpmod="${TOUCH-touch}"
+if test -z "$cpmod"; then
+ cpmod=touch
cpmodarg="-r"
warn="(does not preserve file modes)"
fi
-# check if GZIP env. variable uses -S or --suffix
-gzip -q $tmp
-ext=`echo $tmp* | sed "s|$tmp||"`
-rm -f $tmp*
-if test -z "$ext"; then
- echo znew: error determining gzip extension
- exit 1
-fi
+case "$GZIP" in
+ *-S*) ext=`echo "$GZIP" | sed 's/^.*-S[[:space:]]*\([^[:space:]]*\).*$/\1/'`
+ ;;
+ *--suffix=*) ext=`echo "$GZIP" | sed 's/^.*--suffix=\([^[:space:]]*\).*$/\1/'`
+ ;;
+ *--suffix*) ext=`echo "$GZIP" | sed 's/^.*--suffix[[:space:]][[:space:]]*\([^[:space:]]*\).*$/\1/'`
+ ;;
+ *) ext='.gz'
+ ;;
+esac
if test "$ext" = ".Z"; then
echo znew: cannot use .Z as gzip extension.
exit 1