1
0
Fork 0

Adding upstream version 1.7.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 05:56:02 +01:00
parent 3cd16fdfbc
commit 350226fc6e
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
29 changed files with 107 additions and 73 deletions

View file

@ -1,3 +1,9 @@
2018-02-13 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.7 released.
* zgrep.cc (main): Pass '--color' option to grep.
* check.sh: Added new tests for zgrep.
2017-04-05 Antonio Diaz Diaz <antonio@gnu.org> 2017-04-05 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.6 released. * Version 1.6 released.
@ -12,7 +18,7 @@
* zdiff.cc (set_fifonames): Use '_' if both names are different. * zdiff.cc (set_fifonames): Use '_' if both names are different.
* configure: Avoid warning on some shells when testing for g++. * configure: Avoid warning on some shells when testing for g++.
* Makefile.in: Detect the existence of install-info. * Makefile.in: Detect the existence of install-info.
* testsuite/check.sh: A POSIX shell is required to run the tests. * check.sh: A POSIX shell is required to run the tests.
2015-05-29 Antonio Diaz Diaz <antonio@gnu.org> 2015-05-29 Antonio Diaz Diaz <antonio@gnu.org>
@ -25,7 +31,7 @@
2014-08-30 Antonio Diaz Diaz <antonio@gnu.org> 2014-08-30 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.3 released. * Version 1.3 released.
* testsuite/check.sh: Fixed two values of expected exit status. * check.sh: Fixed two values of expected exit status.
* zutils.texi: Documented that '--format' does not verify format. * zutils.texi: Documented that '--format' does not verify format.
* Added two missing #includes. * Added two missing #includes.
* License changed to GPL version 2 or later. * License changed to GPL version 2 or later.
@ -88,7 +94,7 @@
documentation because egrep and fgrep are deprecated. documentation because egrep and fgrep are deprecated.
* ztest.cc: New file implementing ztest functionality in C++. * ztest.cc: New file implementing ztest functionality in C++.
* Makefile.in: Added quotes to directory names. * Makefile.in: Added quotes to directory names.
* testsuite/check.sh: Use 'test.txt' instead of 'COPYING' for testing. * check.sh: Use 'test.txt' instead of 'COPYING' for testing.
* Removed environment safeguards from configure as requested by * Removed environment safeguards from configure as requested by
Richard Stallman. Now environment variables affect configure. Richard Stallman. Now environment variables affect configure.
@ -134,7 +140,7 @@
* Version 0.1 released. * Version 0.1 released.
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This file is a collection of facts, and thus it is not copyrightable, This file is a collection of facts, and thus it is not copyrightable,
but just in case, you have unlimited permission to copy, distribute and but just in case, you have unlimited permission to copy, distribute and

View file

@ -70,7 +70,7 @@ After running 'configure', you can run 'make' and 'make install' as
explained above. explained above.
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This file is free documentation: you have unlimited permission to copy, This file is free documentation: you have unlimited permission to copy,
distribute and modify it. distribute and modify it.

8
NEWS
View file

@ -1,6 +1,4 @@
Changes in version 1.6: Changes in version 1.7:
zcmp now accepts the 'B' suffix in the values of '--ignore-initial' as zgrep now passes the '--color' option to grep. (But it only works if the
in '--ignore-initial=1kB:1234B'. grep program used supports it).
The input filename is now shown in more error messages.

14
README
View file

@ -1,13 +1,13 @@
Description Description
Zutils is a collection of utilities able to deal with any combination of Zutils is a collection of utilities able to process any combination of
compressed and uncompressed files transparently. If any given file, compressed and uncompressed files transparently. If any given file,
including standard input, is compressed, its decompressed content is including standard input, is compressed, its decompressed content is
used. Compressed files are decompressed on the fly; no temporary files used. Compressed files are decompressed on the fly; no temporary files
are created. are created.
These utilities are not wrapper scripts but safer and more efficient C++ These utilities are not wrapper scripts but safer and more efficient C++
programs. In particular the "--recursive" option is very efficient in programs. In particular the '--recursive' option is very efficient in
those utilities supporting it. those utilities supporting it.
The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate. The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.
@ -23,21 +23,21 @@ NOTE: Bzip2 and lzip provide well-defined values of exit status, which
makes them safe to use with zutils. Gzip and xz may return ambiguous makes them safe to use with zutils. Gzip and xz may return ambiguous
warning values, making them less reliable back ends for zutils. warning values, making them less reliable back ends for zutils.
FORMAT NOTE 1: The "--format" option allows the processing of a subset FORMAT NOTE 1: The '--format' option allows the processing of a subset
of formats in recursive mode and when trying compressed file names: of formats in recursive mode and when trying compressed file names:
"zgrep foo -r --format=bz2,lz somedir somefile.tar". 'zgrep foo -r --format=bz2,lz somedir somefile.tar'.
FORMAT NOTE 2: If the "--force-format" option is given, the files are FORMAT NOTE 2: If the '--force-format' option is given, the files are
passed to the corresponding decompressor without verifying their format, passed to the corresponding decompressor without verifying their format,
allowing for example the processing of compress'd (.Z) files with gzip: allowing for example the processing of compress'd (.Z) files with gzip:
"zcmp --force-format=gz file.Z file.lz". 'zcmp --force-format=gz file.Z file.lz'.
LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never
have been compressed. Decompressed is used to refer to data which have have been compressed. Decompressed is used to refer to data which have
undergone the process of decompression. undergone the process of decompression.
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This file is free documentation: you have unlimited permission to copy, This file is free documentation: you have unlimited permission to copy,
distribute and modify it. distribute and modify it.

View file

@ -1,5 +1,5 @@
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version) /* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
Copyright (C) 2006-2017 Antonio Diaz Diaz. Copyright (C) 2006-2018 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided

View file

@ -1,5 +1,5 @@
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version) /* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
Copyright (C) 2006-2017 Antonio Diaz Diaz. Copyright (C) 2006-2018 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided

6
configure vendored
View file

@ -1,12 +1,12 @@
#! /bin/sh #! /bin/sh
# configure script for Zutils - Utilities dealing with compressed files # configure script for Zutils - Utilities dealing with compressed files
# Copyright (C) 2009-2017 Antonio Diaz Diaz. # Copyright (C) 2009-2018 Antonio Diaz Diaz.
# #
# This configure script is free software: you have unlimited permission # This configure script is free software: you have unlimited permission
# to copy, distribute and modify it. # to copy, distribute and modify it.
pkgname=zutils pkgname=zutils
pkgversion=1.6 pkgversion=1.7
srctrigger=doc/${pkgname}.texi srctrigger=doc/${pkgname}.texi
# clear some things potentially inherited from environment. # clear some things potentially inherited from environment.
@ -180,7 +180,7 @@ echo "GREP = ${GREP}"
rm -f Makefile rm -f Makefile
cat > Makefile << EOF cat > Makefile << EOF
# Makefile for Zutils - Utilities dealing with compressed files # Makefile for Zutils - Utilities dealing with compressed files
# Copyright (C) 2009-2017 Antonio Diaz Diaz. # Copyright (C) 2009-2018 Antonio Diaz Diaz.
# This file was generated automatically by configure. Don't edit. # This file was generated automatically by configure. Don't edit.
# #
# This Makefile is free software: you have unlimited permission # This Makefile is free software: you have unlimited permission

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
.TH ZCAT "1" "April 2017" "zcat (zutils) 1.6" "User Commands" .TH ZCAT "1" "February 2018" "zcat (zutils) 1.7" "User Commands"
.SH NAME .SH NAME
zcat \- decompress and concatenate files to standard output zcat \- decompress and concatenate files to standard output
.SH SYNOPSIS .SH SYNOPSIS
@ -88,7 +88,7 @@ Report bugs to zutils\-bug@nongnu.org
.br .br
Zutils home page: http://www.nongnu.org/zutils/zutils.html Zutils home page: http://www.nongnu.org/zutils/zutils.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2017 Antonio Diaz Diaz. Copyright \(co 2018 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
.TH ZCMP "1" "April 2017" "zcmp (zutils) 1.6" "User Commands" .TH ZCMP "1" "February 2018" "zcmp (zutils) 1.7" "User Commands"
.SH NAME .SH NAME
zcmp \- decompress and compare two files byte by byte zcmp \- decompress and compare two files byte by byte
.SH SYNOPSIS .SH SYNOPSIS
@ -85,7 +85,7 @@ Report bugs to zutils\-bug@nongnu.org
.br .br
Zutils home page: http://www.nongnu.org/zutils/zutils.html Zutils home page: http://www.nongnu.org/zutils/zutils.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2017 Antonio Diaz Diaz. Copyright \(co 2018 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
.TH ZDIFF "1" "April 2017" "zdiff (zutils) 1.6" "User Commands" .TH ZDIFF "1" "February 2018" "zdiff (zutils) 1.7" "User Commands"
.SH NAME .SH NAME
zdiff \- decompress and compare two files line by line zdiff \- decompress and compare two files line by line
.SH SYNOPSIS .SH SYNOPSIS
@ -109,7 +109,7 @@ Report bugs to zutils\-bug@nongnu.org
.br .br
Zutils home page: http://www.nongnu.org/zutils/zutils.html Zutils home page: http://www.nongnu.org/zutils/zutils.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2017 Antonio Diaz Diaz. Copyright \(co 2018 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
.TH ZGREP "1" "April 2017" "zgrep (zutils) 1.6" "User Commands" .TH ZGREP "1" "February 2018" "zgrep (zutils) 1.7" "User Commands"
.SH NAME .SH NAME
zgrep \- search compressed files for a regular expression zgrep \- search compressed files for a regular expression
.SH SYNOPSIS .SH SYNOPSIS
@ -47,6 +47,9 @@ only print a count of matching lines per file
\fB\-C\fR, \fB\-\-context=\fR<n> \fB\-C\fR, \fB\-\-context=\fR<n>
print <n> lines of output context print <n> lines of output context
.TP .TP
\fB\-\-color[=\fR<when>]
show matched strings in color
.TP
\fB\-e\fR, \fB\-\-regexp=\fR<pattern> \fB\-e\fR, \fB\-\-regexp=\fR<pattern>
use <pattern> as the pattern to match use <pattern> as the pattern to match
.TP .TP
@ -135,7 +138,7 @@ Report bugs to zutils\-bug@nongnu.org
.br .br
Zutils home page: http://www.nongnu.org/zutils/zutils.html Zutils home page: http://www.nongnu.org/zutils/zutils.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2017 Antonio Diaz Diaz. Copyright \(co 2018 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
.TH ZTEST "1" "April 2017" "ztest (zutils) 1.6" "User Commands" .TH ZTEST "1" "February 2018" "ztest (zutils) 1.7" "User Commands"
.SH NAME .SH NAME
ztest \- verify the integrity of compressed files ztest \- verify the integrity of compressed files
.SH SYNOPSIS .SH SYNOPSIS
@ -66,7 +66,7 @@ Report bugs to zutils\-bug@nongnu.org
.br .br
Zutils home page: http://www.nongnu.org/zutils/zutils.html Zutils home page: http://www.nongnu.org/zutils/zutils.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2017 Antonio Diaz Diaz. Copyright \(co 2018 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
.TH ZUPDATE "1" "April 2017" "zupdate (zutils) 1.6" "User Commands" .TH ZUPDATE "1" "February 2018" "zupdate (zutils) 1.7" "User Commands"
.SH NAME .SH NAME
zupdate \- recompress bzip2, gzip, xz files to lzip format zupdate \- recompress bzip2, gzip, xz files to lzip format
.SH SYNOPSIS .SH SYNOPSIS
@ -76,7 +76,7 @@ Report bugs to zutils\-bug@nongnu.org
.br .br
Zutils home page: http://www.nongnu.org/zutils/zutils.html Zutils home page: http://www.nongnu.org/zutils/zutils.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2017 Antonio Diaz Diaz. Copyright \(co 2018 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

View file

@ -12,7 +12,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir)
Zutils Manual Zutils Manual
************* *************
This manual is for Zutils (version 1.6, 5 April 2017). This manual is for Zutils (version 1.7, 13 February 2018).
* Menu: * Menu:
@ -29,7 +29,7 @@ This manual is for Zutils (version 1.6, 5 April 2017).
* Concept index:: Index of concepts * Concept index:: Index of concepts
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This manual is free documentation: you have unlimited permission to This manual is free documentation: you have unlimited permission to
copy, distribute and modify it. copy, distribute and modify it.
@ -40,7 +40,7 @@ File: zutils.info, Node: Introduction, Next: Common options, Prev: Top, Up:
1 Introduction 1 Introduction
************** **************
Zutils is a collection of utilities able to deal with any combination of Zutils is a collection of utilities able to process any combination of
compressed and uncompressed files transparently. If any given file, compressed and uncompressed files transparently. If any given file,
including standard input, is compressed, its decompressed content is including standard input, is compressed, its decompressed content is
used. Compressed files are decompressed on the fly; no temporary files used. Compressed files are decompressed on the fly; no temporary files
@ -372,7 +372,8 @@ following:
An exit status of 0 means no differences were found, 1 means some An exit status of 0 means no differences were found, 1 means some
differences were found, and 2 means trouble. differences were found, and 2 means trouble.
zdiff supports the following options: zdiff supports the following options (some options only work if the
diff program used supports them):
'-a' '-a'
'--text' '--text'
@ -472,7 +473,8 @@ or all in the same compression format.
An exit status of 0 means at least one match was found, 1 means no An exit status of 0 means at least one match was found, 1 means no
matches were found, and 2 means trouble. matches were found, and 2 means trouble.
zgrep supports the following options: zgrep supports the following options (some options only work if the
grep program used supports them):
'-a' '-a'
'--text' '--text'
@ -498,6 +500,9 @@ matches were found, and 2 means trouble.
'--context=N' '--context=N'
Print N lines of output context. Print N lines of output context.
'--color[=WHEN]'
Show matched strings in color. WHEN is 'never', 'always' or 'auto'.
'-e PATTERN' '-e PATTERN'
'--regexp=PATTERN' '--regexp=PATTERN'
Use PATTERN as the pattern to match. Use PATTERN as the pattern to match.
@ -765,18 +770,18 @@ Concept index
 
Tag Table: Tag Table:
Node: Top222 Node: Top222
Node: Introduction1147 Node: Introduction1151
Node: Common options3773 Node: Common options3775
Ref: compressor-requirements5531 Ref: compressor-requirements5533
Node: The zutilsrc file5903 Node: The zutilsrc file5905
Node: Zcat6828 Node: Zcat6830
Node: Zcmp8882 Node: Zcmp8884
Node: Zdiff11341 Node: Zdiff11343
Node: Zgrep13981 Node: Zgrep14047
Node: Ztest17320 Node: Ztest17541
Node: Zupdate19154 Node: Zupdate19375
Node: Problems22026 Node: Problems22247
Node: Concept index22560 Node: Concept index22781
 
End Tag Table End Tag Table

View file

@ -6,8 +6,8 @@
@finalout @finalout
@c %**end of header @c %**end of header
@set UPDATED 5 April 2017 @set UPDATED 13 February 2018
@set VERSION 1.6 @set VERSION 1.7
@dircategory Data Compression @dircategory Data Compression
@direntry @direntry
@ -49,7 +49,7 @@ This manual is for Zutils (version @value{VERSION}, @value{UPDATED}).
@end menu @end menu
@sp 1 @sp 1
Copyright @copyright{} 2009-2017 Antonio Diaz Diaz. Copyright @copyright{} 2009-2018 Antonio Diaz Diaz.
This manual is free documentation: you have unlimited permission This manual is free documentation: you have unlimited permission
to copy, distribute and modify it. to copy, distribute and modify it.
@ -59,7 +59,7 @@ to copy, distribute and modify it.
@chapter Introduction @chapter Introduction
@cindex introduction @cindex introduction
Zutils is a collection of utilities able to deal with any combination of Zutils is a collection of utilities able to process any combination of
compressed and uncompressed files transparently. If any given file, compressed and uncompressed files transparently. If any given file,
including standard input, is compressed, its decompressed content is including standard input, is compressed, its decompressed content is
used. Compressed files are decompressed on the fly; no temporary files used. Compressed files are decompressed on the fly; no temporary files
@ -421,7 +421,8 @@ standard input.
An exit status of 0 means no differences were found, 1 means some An exit status of 0 means no differences were found, 1 means some
differences were found, and 2 means trouble. differences were found, and 2 means trouble.
zdiff supports the following options: zdiff supports the following options (some options only work if the diff
program used supports them):
@table @code @table @code
@item -a @item -a
@ -525,7 +526,8 @@ zgrep [@var{options}] @var{pattern} [@var{files}]
An exit status of 0 means at least one match was found, 1 means no An exit status of 0 means at least one match was found, 1 means no
matches were found, and 2 means trouble. matches were found, and 2 means trouble.
zgrep supports the following options: zgrep supports the following options (some options only work if the grep
program used supports them):
@table @code @table @code
@item -a @item -a
@ -552,6 +554,10 @@ Only print a count of matching lines per file.
@itemx --context=@var{n} @itemx --context=@var{n}
Print @var{n} lines of output context. Print @var{n} lines of output context.
@item --color[=@var{when}]
Show matched strings in color. @var{when} is @samp{never}, @samp{always}
or @samp{auto}.
@item -e @var{pattern} @item -e @var{pattern}
@itemx --regexp=@var{pattern} @itemx --regexp=@var{pattern}
Use @var{pattern} as the pattern to match. Use @var{pattern} as the pattern to match.

4
rc.cc
View file

@ -1,5 +1,5 @@
/* Zutils - Utilities dealing with compressed files /* Zutils - Utilities dealing with compressed files
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@ int verbosity = 0;
namespace { namespace {
const char * const config_file_name = "zutilsrc"; const char * const config_file_name = "zutilsrc";
const char * const program_year = "2017"; const char * const program_year = "2018";
std::string compressor_names[num_formats] = std::string compressor_names[num_formats] =
{ "bzip2", "gzip", "lzip", "xz" }; // default compressor names { "bzip2", "gzip", "lzip", "xz" }; // default compressor names

2
rc.h
View file

@ -1,5 +1,5 @@
/* Zutils - Utilities dealing with compressed files /* Zutils - Utilities dealing with compressed files
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Zutils - Utilities dealing with compressed files /* Zutils - Utilities dealing with compressed files
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# check script for Zutils - Utilities dealing with compressed files # check script for Zutils - Utilities dealing with compressed files
# Copyright (C) 2009-2017 Antonio Diaz Diaz. # Copyright (C) 2009-2018 Antonio Diaz Diaz.
# #
# This script is free software: you have unlimited permission # This script is free software: you have unlimited permission
# to copy, distribute and modify it. # to copy, distribute and modify it.
@ -41,6 +41,8 @@ cd "${objdir}"/tmp || framework_failure
for i in ${compressors}; do for i in ${compressors}; do
cat "${testdir}"/test.txt > in || framework_failure cat "${testdir}"/test.txt > in || framework_failure
$i in || compressor_needed $i in || compressor_needed
printf "Hello World!\n" > hello || framework_failure
$i hello || compressor_needed
done done
cat "${testdir}"/test.txt > in || framework_failure cat "${testdir}"/test.txt > in || framework_failure
@ -234,6 +236,10 @@ printf "\ntesting zgrep-%s..." "$2"
for i in ${extensions}; do for i in ${extensions}; do
"${ZGREP}" -N "GNU" in.$i > /dev/null || test_failed $LINENO $i "${ZGREP}" -N "GNU" in.$i > /dev/null || test_failed $LINENO $i
"${ZGREP}" -N "GNU" in.$i hello.$i > /dev/null || test_failed $LINENO $i
"${ZGREP}" -N "GNU" hello.$i in.$i > /dev/null || test_failed $LINENO $i
"${ZGREP}" -N -q "GNU" in.$i hello.$i || test_failed $LINENO $i
"${ZGREP}" -N -q "GNU" hello.$i in.$i || test_failed $LINENO $i
"${ZGREP}" -N "GNU" < in.$i > /dev/null || test_failed $LINENO $i "${ZGREP}" -N "GNU" < in.$i > /dev/null || test_failed $LINENO $i
"${ZGREP}" -N -l "GNU" in.$i > /dev/null || test_failed $LINENO $i "${ZGREP}" -N -l "GNU" in.$i > /dev/null || test_failed $LINENO $i
"${ZGREP}" -N -L "GNU" in.$i || test_failed $LINENO $i "${ZGREP}" -N -L "GNU" in.$i || test_failed $LINENO $i

View file

@ -1,5 +1,5 @@
/* Zcat - decompress and concatenate files to standard output /* Zcat - decompress and concatenate files to standard output
Copyright (C) 2010-2017 Antonio Diaz Diaz. Copyright (C) 2010-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Common code for zcat and zgrep /* Common code for zcat and zgrep
Copyright (C) 2010-2017 Antonio Diaz Diaz. Copyright (C) 2010-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Zcmp - decompress and compare two files byte by byte /* Zcmp - decompress and compare two files byte by byte
Copyright (C) 2010-2017 Antonio Diaz Diaz. Copyright (C) 2010-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Common code for zcmp and zdiff /* Common code for zcmp and zdiff
Copyright (C) 2010-2017 Antonio Diaz Diaz. Copyright (C) 2010-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Zdiff - decompress and compare two files line by line /* Zdiff - decompress and compare two files line by line
Copyright (C) 2010-2017 Antonio Diaz Diaz. Copyright (C) 2010-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Zgrep - search compressed files for a regular expression /* Zgrep - search compressed files for a regular expression
Copyright (C) 2010-2017 Antonio Diaz Diaz. Copyright (C) 2010-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -69,6 +69,7 @@ void show_help()
" -B, --before-context=<n> print <n> lines of leading context\n" " -B, --before-context=<n> print <n> lines of leading context\n"
" -c, --count only print a count of matching lines per file\n" " -c, --count only print a count of matching lines per file\n"
" -C, --context=<n> print <n> lines of output context\n" " -C, --context=<n> print <n> lines of output context\n"
" --color[=<when>] show matched strings in color\n"
" -e, --regexp=<pattern> use <pattern> as the pattern to match\n" " -e, --regexp=<pattern> use <pattern> as the pattern to match\n"
" -E, --extended-regexp <pattern> is an extended regular expression\n" " -E, --extended-regexp <pattern> is an extended regular expression\n"
" -f, --file=<file> obtain patterns from <file>\n" " -f, --file=<file> obtain patterns from <file>\n"
@ -209,7 +210,8 @@ int zgrep_file( int infd, const int format_index,
int main( const int argc, const char * const argv[] ) int main( const int argc, const char * const argv[] )
{ {
enum { help_opt = 256, verbose_opt, bz2_opt, gz_opt, lz_opt, xz_opt }; enum { help_opt = 256, verbose_opt, color_opt,
bz2_opt, gz_opt, lz_opt, xz_opt };
int format_index = -1; int format_index = -1;
int infd = -1; int infd = -1;
int list_mode = 0; // 1 = list matches, -1 = list non matches int list_mode = 0; // 1 = list matches, -1 = list non matches
@ -219,6 +221,7 @@ int main( const int argc, const char * const argv[] )
std::string input_filename; std::string input_filename;
std::list< std::string > filenames; std::list< std::string > filenames;
std::vector< const char * > grep_args; // args to grep, maybe empty std::vector< const char * > grep_args; // args to grep, maybe empty
std::string color_option; // needed because of optional arg
invocation_name = argv[0]; invocation_name = argv[0];
program_name = "zgrep"; program_name = "zgrep";
@ -255,6 +258,7 @@ int main( const int argc, const char * const argv[] )
{ 'x', "line-regexp", Arg_parser::no }, // grep { 'x', "line-regexp", Arg_parser::no }, // grep
{ help_opt, "help", Arg_parser::no }, { help_opt, "help", Arg_parser::no },
{ verbose_opt, "verbose", Arg_parser::no }, { verbose_opt, "verbose", Arg_parser::no },
{ color_opt, "color", Arg_parser::maybe },
{ bz2_opt, "bz2", Arg_parser::yes }, { bz2_opt, "bz2", Arg_parser::yes },
{ gz_opt, "gz", Arg_parser::yes }, { gz_opt, "gz", Arg_parser::yes },
{ lz_opt, "lz", Arg_parser::yes }, { lz_opt, "lz", Arg_parser::yes },
@ -314,6 +318,9 @@ int main( const int argc, const char * const argv[] )
case help_opt : show_help(); return 0; case help_opt : show_help(); return 0;
case verbose_opt: if( verbosity < 4 ) ++verbosity; case verbose_opt: if( verbosity < 4 ) ++verbosity;
no_messages = false; break; no_messages = false; break;
case color_opt: color_option = "--color";
if( !arg.empty() ) { color_option += '='; color_option += arg; }
break;
case bz2_opt: parse_compressor( arg, fmt_bz2 ); break; case bz2_opt: parse_compressor( arg, fmt_bz2 ); break;
case gz_opt: parse_compressor( arg, fmt_gz ); break; case gz_opt: parse_compressor( arg, fmt_gz ); break;
case lz_opt: parse_compressor( arg, fmt_lz ); break; case lz_opt: parse_compressor( arg, fmt_lz ); break;
@ -322,6 +329,9 @@ int main( const int argc, const char * const argv[] )
} }
} // end process options } // end process options
if( !color_option.empty() ) // push the last value set
grep_args.push_back( color_option.c_str() );
#if defined(__MSVCRT__) || defined(__OS2__) #if defined(__MSVCRT__) || defined(__OS2__)
setmode( STDIN_FILENO, O_BINARY ); setmode( STDIN_FILENO, O_BINARY );
setmode( STDOUT_FILENO, O_BINARY ); setmode( STDOUT_FILENO, O_BINARY );

View file

@ -1,5 +1,5 @@
/* Ztest - verify the integrity of compressed files /* Ztest - verify the integrity of compressed files
Copyright (C) 2010-2017 Antonio Diaz Diaz. Copyright (C) 2010-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Zupdate - recompress bzip2, gzip, xz files to lzip format /* Zupdate - recompress bzip2, gzip, xz files to lzip format
Copyright (C) 2013-2017 Antonio Diaz Diaz. Copyright (C) 2013-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Zutils - Utilities dealing with compressed files /* Zutils - Utilities dealing with compressed files
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Zutils - Utilities dealing with compressed files /* Zutils - Utilities dealing with compressed files
Copyright (C) 2009-2017 Antonio Diaz Diaz. Copyright (C) 2009-2018 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by