summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--INSTALL2
-rw-r--r--NEWS8
-rw-r--r--README14
-rw-r--r--arg_parser.cc2
-rw-r--r--arg_parser.h2
-rwxr-xr-xconfigure6
-rw-r--r--doc/zcat.14
-rw-r--r--doc/zcmp.14
-rw-r--r--doc/zdiff.14
-rw-r--r--doc/zgrep.17
-rw-r--r--doc/ztest.14
-rw-r--r--doc/zupdate.14
-rw-r--r--doc/zutils.info39
-rw-r--r--doc/zutils.texi18
-rw-r--r--rc.cc4
-rw-r--r--rc.h2
-rw-r--r--recursive.cc2
-rwxr-xr-xtestsuite/check.sh8
-rw-r--r--zcat.cc2
-rw-r--r--zcatgrep.cc2
-rw-r--r--zcmp.cc2
-rw-r--r--zcmpdiff.cc2
-rw-r--r--zdiff.cc2
-rw-r--r--zgrep.cc14
-rw-r--r--ztest.cc2
-rw-r--r--zupdate.cc2
-rw-r--r--zutils.cc2
-rw-r--r--zutils.h2
29 files changed, 107 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e37d85..ef275c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* Version 1.6 released.
@@ -12,7 +18,7 @@
* zdiff.cc (set_fifonames): Use '_' if both names are different.
* configure: Avoid warning on some shells when testing for g++.
* 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>
@@ -25,7 +31,7 @@
2014-08-30 Antonio Diaz Diaz <antonio@gnu.org>
* 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.
* Added two missing #includes.
* License changed to GPL version 2 or later.
@@ -88,7 +94,7 @@
documentation because egrep and fgrep are deprecated.
* ztest.cc: New file implementing ztest functionality in C++.
* 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
Richard Stallman. Now environment variables affect configure.
@@ -134,7 +140,7 @@
* 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,
but just in case, you have unlimited permission to copy, distribute and
diff --git a/INSTALL b/INSTALL
index 11a4d6c..695931a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -70,7 +70,7 @@ After running 'configure', you can run 'make' and 'make install' as
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,
distribute and modify it.
diff --git a/NEWS b/NEWS
index 086ba3c..329f7af 100644
--- a/NEWS
+++ b/NEWS
@@ -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
-in '--ignore-initial=1kB:1234B'.
-
-The input filename is now shown in more error messages.
+zgrep now passes the '--color' option to grep. (But it only works if the
+grep program used supports it).
diff --git a/README b/README
index fd6296b..36ddc31 100644
--- a/README
+++ b/README
@@ -1,13 +1,13 @@
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,
including standard input, is compressed, its decompressed content is
used. Compressed files are decompressed on the fly; no temporary files
are created.
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.
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
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:
-"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,
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
have been compressed. Decompressed is used to refer to data which have
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,
distribute and modify it.
diff --git a/arg_parser.cc b/arg_parser.cc
index cc7d1e2..008ebc8 100644
--- a/arg_parser.cc
+++ b/arg_parser.cc
@@ -1,5 +1,5 @@
/* 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
binary forms, with or without modification, are permitted provided
diff --git a/arg_parser.h b/arg_parser.h
index 95b0320..f015881 100644
--- a/arg_parser.h
+++ b/arg_parser.h
@@ -1,5 +1,5 @@
/* 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
binary forms, with or without modification, are permitted provided
diff --git a/configure b/configure
index 10ab602..579b578 100755
--- a/configure
+++ b/configure
@@ -1,12 +1,12 @@
#! /bin/sh
# 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
# to copy, distribute and modify it.
pkgname=zutils
-pkgversion=1.6
+pkgversion=1.7
srctrigger=doc/${pkgname}.texi
# clear some things potentially inherited from environment.
@@ -180,7 +180,7 @@ echo "GREP = ${GREP}"
rm -f Makefile
cat > Makefile << EOF
# 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 Makefile is free software: you have unlimited permission
diff --git a/doc/zcat.1 b/doc/zcat.1
index 9a76208..4cfbdf3 100644
--- a/doc/zcat.1
+++ b/doc/zcat.1
@@ -1,5 +1,5 @@
.\" 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
zcat \- decompress and concatenate files to standard output
.SH SYNOPSIS
@@ -88,7 +88,7 @@ Report bugs to zutils\-bug@nongnu.org
.br
Zutils home page: http://www.nongnu.org/zutils/zutils.html
.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>
.br
This is free software: you are free to change and redistribute it.
diff --git a/doc/zcmp.1 b/doc/zcmp.1
index c9583f8..03a3f19 100644
--- a/doc/zcmp.1
+++ b/doc/zcmp.1
@@ -1,5 +1,5 @@
.\" 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
zcmp \- decompress and compare two files byte by byte
.SH SYNOPSIS
@@ -85,7 +85,7 @@ Report bugs to zutils\-bug@nongnu.org
.br
Zutils home page: http://www.nongnu.org/zutils/zutils.html
.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>
.br
This is free software: you are free to change and redistribute it.
diff --git a/doc/zdiff.1 b/doc/zdiff.1
index f803ee8..aee3b3a 100644
--- a/doc/zdiff.1
+++ b/doc/zdiff.1
@@ -1,5 +1,5 @@
.\" 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
zdiff \- decompress and compare two files line by line
.SH SYNOPSIS
@@ -109,7 +109,7 @@ Report bugs to zutils\-bug@nongnu.org
.br
Zutils home page: http://www.nongnu.org/zutils/zutils.html
.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>
.br
This is free software: you are free to change and redistribute it.
diff --git a/doc/zgrep.1 b/doc/zgrep.1
index 571d410..5533b43 100644
--- a/doc/zgrep.1
+++ b/doc/zgrep.1
@@ -1,5 +1,5 @@
.\" 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
zgrep \- search compressed files for a regular expression
.SH SYNOPSIS
@@ -47,6 +47,9 @@ only print a count of matching lines per file
\fB\-C\fR, \fB\-\-context=\fR<n>
print <n> lines of output context
.TP
+\fB\-\-color[=\fR<when>]
+show matched strings in color
+.TP
\fB\-e\fR, \fB\-\-regexp=\fR<pattern>
use <pattern> as the pattern to match
.TP
@@ -135,7 +138,7 @@ Report bugs to zutils\-bug@nongnu.org
.br
Zutils home page: http://www.nongnu.org/zutils/zutils.html
.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>
.br
This is free software: you are free to change and redistribute it.
diff --git a/doc/ztest.1 b/doc/ztest.1
index 252489b..7cad696 100644
--- a/doc/ztest.1
+++ b/doc/ztest.1
@@ -1,5 +1,5 @@
.\" 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
ztest \- verify the integrity of compressed files
.SH SYNOPSIS
@@ -66,7 +66,7 @@ Report bugs to zutils\-bug@nongnu.org
.br
Zutils home page: http://www.nongnu.org/zutils/zutils.html
.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>
.br
This is free software: you are free to change and redistribute it.
diff --git a/doc/zupdate.1 b/doc/zupdate.1
index 6894418..f0025d7 100644
--- a/doc/zupdate.1
+++ b/doc/zupdate.1
@@ -1,5 +1,5 @@
.\" 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
zupdate \- recompress bzip2, gzip, xz files to lzip format
.SH SYNOPSIS
@@ -76,7 +76,7 @@ Report bugs to zutils\-bug@nongnu.org
.br
Zutils home page: http://www.nongnu.org/zutils/zutils.html
.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>
.br
This is free software: you are free to change and redistribute it.
diff --git a/doc/zutils.info b/doc/zutils.info
index 98ddf49..11ea41a 100644
--- a/doc/zutils.info
+++ b/doc/zutils.info
@@ -12,7 +12,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir)
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:
@@ -29,7 +29,7 @@ This manual is for Zutils (version 1.6, 5 April 2017).
* 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
copy, distribute and modify it.
@@ -40,7 +40,7 @@ File: zutils.info, Node: Introduction, Next: Common options, Prev: Top, Up:
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,
including standard input, is compressed, its decompressed content is
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
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'
'--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
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'
'--text'
@@ -498,6 +500,9 @@ matches were found, and 2 means trouble.
'--context=N'
Print N lines of output context.
+'--color[=WHEN]'
+ Show matched strings in color. WHEN is 'never', 'always' or 'auto'.
+
'-e PATTERN'
'--regexp=PATTERN'
Use PATTERN as the pattern to match.
@@ -765,18 +770,18 @@ Concept index

Tag Table:
Node: Top222
-Node: Introduction1147
-Node: Common options3773
-Ref: compressor-requirements5531
-Node: The zutilsrc file5903
-Node: Zcat6828
-Node: Zcmp8882
-Node: Zdiff11341
-Node: Zgrep13981
-Node: Ztest17320
-Node: Zupdate19154
-Node: Problems22026
-Node: Concept index22560
+Node: Introduction1151
+Node: Common options3775
+Ref: compressor-requirements5533
+Node: The zutilsrc file5905
+Node: Zcat6830
+Node: Zcmp8884
+Node: Zdiff11343
+Node: Zgrep14047
+Node: Ztest17541
+Node: Zupdate19375
+Node: Problems22247
+Node: Concept index22781

End Tag Table
diff --git a/doc/zutils.texi b/doc/zutils.texi
index ea9fb2d..343c297 100644
--- a/doc/zutils.texi
+++ b/doc/zutils.texi
@@ -6,8 +6,8 @@
@finalout
@c %**end of header
-@set UPDATED 5 April 2017
-@set VERSION 1.6
+@set UPDATED 13 February 2018
+@set VERSION 1.7
@dircategory Data Compression
@direntry
@@ -49,7 +49,7 @@ This manual is for Zutils (version @value{VERSION}, @value{UPDATED}).
@end menu
@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
to copy, distribute and modify it.
@@ -59,7 +59,7 @@ to copy, distribute and modify it.
@chapter 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,
including standard input, is compressed, its decompressed content is
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
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
@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
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
@item -a
@@ -552,6 +554,10 @@ Only print a count of matching lines per file.
@itemx --context=@var{n}
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}
@itemx --regexp=@var{pattern}
Use @var{pattern} as the pattern to match.
diff --git a/rc.cc b/rc.cc
index 9af190d..5014806 100644
--- a/rc.cc
+++ b/rc.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ int verbosity = 0;
namespace {
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] =
{ "bzip2", "gzip", "lzip", "xz" }; // default compressor names
diff --git a/rc.h b/rc.h
index c75a36f..0992d0c 100644
--- a/rc.h
+++ b/rc.h
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/recursive.cc b/recursive.cc
index 5301772..93943f2 100644
--- a/recursive.cc
+++ b/recursive.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 3986d71..a1ea5da 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# 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
# to copy, distribute and modify it.
@@ -41,6 +41,8 @@ cd "${objdir}"/tmp || framework_failure
for i in ${compressors}; do
cat "${testdir}"/test.txt > in || framework_failure
$i in || compressor_needed
+ printf "Hello World!\n" > hello || framework_failure
+ $i hello || compressor_needed
done
cat "${testdir}"/test.txt > in || framework_failure
@@ -234,6 +236,10 @@ printf "\ntesting zgrep-%s..." "$2"
for i in ${extensions}; do
"${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 -l "GNU" in.$i > /dev/null || test_failed $LINENO $i
"${ZGREP}" -N -L "GNU" in.$i || test_failed $LINENO $i
diff --git a/zcat.cc b/zcat.cc
index aba5e54..8ef1929 100644
--- a/zcat.cc
+++ b/zcat.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/zcatgrep.cc b/zcatgrep.cc
index 5b08b78..ad75f14 100644
--- a/zcatgrep.cc
+++ b/zcatgrep.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/zcmp.cc b/zcmp.cc
index 78debcc..534e0c6 100644
--- a/zcmp.cc
+++ b/zcmp.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/zcmpdiff.cc b/zcmpdiff.cc
index 013a2d9..07d35fe 100644
--- a/zcmpdiff.cc
+++ b/zcmpdiff.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/zdiff.cc b/zdiff.cc
index 735eb0b..a6a48f4 100644
--- a/zdiff.cc
+++ b/zdiff.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/zgrep.cc b/zgrep.cc
index 5bcb968..204d5d5 100644
--- a/zgrep.cc
+++ b/zgrep.cc
@@ -1,5 +1,5 @@
/* 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
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"
" -c, --count only print a count of matching lines per file\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, --extended-regexp <pattern> is an extended regular expression\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[] )
{
- 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 infd = -1;
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::list< std::string > filenames;
std::vector< const char * > grep_args; // args to grep, maybe empty
+ std::string color_option; // needed because of optional arg
invocation_name = argv[0];
program_name = "zgrep";
@@ -255,6 +258,7 @@ int main( const int argc, const char * const argv[] )
{ 'x', "line-regexp", Arg_parser::no }, // grep
{ help_opt, "help", Arg_parser::no },
{ verbose_opt, "verbose", Arg_parser::no },
+ { color_opt, "color", Arg_parser::maybe },
{ bz2_opt, "bz2", Arg_parser::yes },
{ gz_opt, "gz", 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 verbose_opt: if( verbosity < 4 ) ++verbosity;
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 gz_opt: parse_compressor( arg, fmt_gz ); 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
+ if( !color_option.empty() ) // push the last value set
+ grep_args.push_back( color_option.c_str() );
+
#if defined(__MSVCRT__) || defined(__OS2__)
setmode( STDIN_FILENO, O_BINARY );
setmode( STDOUT_FILENO, O_BINARY );
diff --git a/ztest.cc b/ztest.cc
index 6f0d209..1145c90 100644
--- a/ztest.cc
+++ b/ztest.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/zupdate.cc b/zupdate.cc
index 14e15f8..dcba0ec 100644
--- a/zupdate.cc
+++ b/zupdate.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/zutils.cc b/zutils.cc
index 536a5bd..2b11532 100644
--- a/zutils.cc
+++ b/zutils.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
diff --git a/zutils.h b/zutils.h
index f5d57b5..37404ba 100644
--- a/zutils.h
+++ b/zutils.h
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by