Merging upstream version 1.6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
b821a3696e
commit
e9522df0a4
30 changed files with 436 additions and 473 deletions
9
zgrep.cc
9
zgrep.cc
|
@ -1,5 +1,5 @@
|
|||
/* Zgrep - search compressed files for a regular expression
|
||||
Copyright (C) 2010-2016 Antonio Diaz Diaz.
|
||||
Copyright (C) 2010-2017 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
|
||||
|
@ -53,7 +53,7 @@ void show_help()
|
|||
"does not exist, and its name does not end with one of the known\n"
|
||||
"extensions, zgrep tries the compressed file names corresponding to the\n"
|
||||
"supported formats.\n"
|
||||
"\nIf no files are specified, or if a file is specified as '-', data is\n"
|
||||
"\nIf no files are specified, or if a file is specified as '-', data are\n"
|
||||
"read from standard input, decompressed if needed, and fed to grep. Data\n"
|
||||
"read from standard input must be of the same type; all uncompressed or\n"
|
||||
"all in the same compression format.\n"
|
||||
|
@ -106,7 +106,7 @@ int zgrep_stdin( int infd, const int format_index,
|
|||
const std::vector< const char * > & grep_args )
|
||||
{
|
||||
Children children;
|
||||
if( !set_data_feeder( &infd, children, format_index ) ) return 2;
|
||||
if( !set_data_feeder( "", &infd, children, format_index ) ) return 2;
|
||||
const pid_t grep_pid = fork();
|
||||
if( grep_pid == 0 ) // child (grep)
|
||||
{
|
||||
|
@ -141,7 +141,8 @@ int zgrep_file( int infd, const int format_index,
|
|||
const int list_mode, const bool show_name )
|
||||
{
|
||||
Children children;
|
||||
if( !set_data_feeder( &infd, children, format_index ) ) return 2;
|
||||
if( !set_data_feeder( input_filename, &infd, children, format_index ) )
|
||||
return 2;
|
||||
int fda[2]; // pipe from grep
|
||||
if( pipe( fda ) < 0 )
|
||||
{ show_error( "Can't create pipe", errno ); return 2; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue