head	1.4;
access;
symbols
	RELENG_6_4_0_RELEASE:1.3.34.1
	RELENG_6_4:1.3.34.1.0.4
	RELENG_6_4_BP:1.3.34.1
	RELENG_6_3_0_RELEASE:1.3.34.1
	RELENG_6_3:1.3.34.1.0.2
	RELENG_6_3_BP:1.3.34.1
	RELENG_6_2_0_RELEASE:1.3
	RELENG_6_2:1.3.0.42
	RELENG_6_2_BP:1.3
	RELENG_5_5_0_RELEASE:1.3
	RELENG_5_5:1.3.0.40
	RELENG_5_5_BP:1.3
	RELENG_6_1_0_RELEASE:1.3
	RELENG_6_1:1.3.0.38
	RELENG_6_1_BP:1.3
	RELENG_6_0_0_RELEASE:1.3
	RELENG_6_0:1.3.0.36
	RELENG_6_0_BP:1.3
	RELENG_6:1.3.0.34
	RELENG_6_BP:1.3
	RELENG_5_4_0_RELEASE:1.3
	RELENG_5_4:1.3.0.32
	RELENG_5_4_BP:1.3
	RELENG_4_11_0_RELEASE:1.3
	RELENG_4_11:1.3.0.30
	RELENG_4_11_BP:1.3
	RELENG_5_3_0_RELEASE:1.3
	RELENG_5_3:1.3.0.28
	RELENG_5_3_BP:1.3
	RELENG_5:1.3.0.26
	RELENG_5_BP:1.3
	RELENG_4_10_0_RELEASE:1.3
	RELENG_4_10:1.3.0.24
	RELENG_4_10_BP:1.3
	RELENG_5_2_1_RELEASE:1.3
	RELENG_5_2_0_RELEASE:1.3
	RELENG_5_2:1.3.0.22
	RELENG_5_2_BP:1.3
	RELENG_4_9_0_RELEASE:1.3
	RELENG_4_9:1.3.0.20
	RELENG_4_9_BP:1.3
	RELENG_5_1_0_RELEASE:1.3
	RELENG_5_1:1.3.0.18
	RELENG_5_1_BP:1.3
	RELENG_4_8_0_RELEASE:1.3
	RELENG_4_8:1.3.0.16
	RELENG_4_8_BP:1.3
	RELENG_5_0_0_RELEASE:1.3
	RELENG_5_0:1.3.0.14
	RELENG_5_0_BP:1.3
	RELENG_4_7_0_RELEASE:1.3
	RELENG_4_7:1.3.0.12
	RELENG_4_7_BP:1.3
	RELENG_4_6_2_RELEASE:1.3
	RELENG_4_6_1_RELEASE:1.3
	RELENG_4_6_0_RELEASE:1.3
	RELENG_4_6:1.3.0.10
	RELENG_4_6_BP:1.3
	RELENG_4_5_0_RELEASE:1.3
	RELENG_4_5:1.3.0.8
	RELENG_4_5_BP:1.3
	RELENG_4_4_0_RELEASE:1.3
	RELENG_4_4:1.3.0.6
	RELENG_4_4_BP:1.3
	RELENG_4_3_0_RELEASE:1.3
	RELENG_4_3:1.3.0.4
	RELENG_4_3_BP:1.3
	RELENG_4_2_0_RELEASE:1.3
	RELENG_4_1_1_RELEASE:1.3
	PRE_SMPNG:1.3
	RELENG_4_1_0_RELEASE:1.3
	RELENG_3_5_0_RELEASE:1.1.12.2
	RELENG_4_0_0_RELEASE:1.3
	RELENG_4:1.3.0.2
	RELENG_4_BP:1.3
	RELENG_3_4_0_RELEASE:1.1.12.2
	RELENG_3_3_0_RELEASE:1.1.12.2
	RELENG_3_2_PAO:1.1.0.14
	RELENG_3_2_PAO_BP:1.1
	RELENG_3_2_0_RELEASE:1.1
	RELENG_3_1_0_RELEASE:1.1
	RELENG_3:1.1.0.12
	RELENG_3_BP:1.1
	RELENG_2_2_8_RELEASE:1.1
	RELENG_3_0_0_RELEASE:1.1
	RELENG_2_2_7_RELEASE:1.1
	RELENG_2_2_6_RELEASE:1.1
	RELENG_2_2_5_RELEASE:1.1
	RELENG_2_2_2_RELEASE:1.1
	RELENG_2_2_1_RELEASE:1.1
	RELENG_2_2_0_RELEASE:1.1
	RELENG_2_1_7_RELEASE:1.1
	RELENG_2_1_6_1_RELEASE:1.1
	RELENG_2_1_6_RELEASE:1.1
	RELENG_2_2:1.1.0.10
	RELENG_2_2_BP:1.1
	RELENG_2_1_5_RELEASE:1.1
	RELENG_2_1_0_RELEASE:1.1
	RELENG_2_1_0:1.1.0.8
	RELENG_2_1_0_BP:1.1
	RELENG_2_0_5_RELEASE:1.1
	RELENG_2_0_5:1.1.0.6
	RELENG_2_0_5_BP:1.1
	RELENG_2_0_5_ALPHA:1.1
	RELEASE_2_0:1.1
	BETA_2_0:1.1
	ALPHA_2_0:1.1.0.4
	MOVED_NEWCVS:1.1
	FINAL_1_1_5:1.1
	ALPHA_1_1_5:1.1
	FINAL_1_1:1.1
	GAMMA_1_1:1.1
	BETA_1_1:1.1.0.2
	BP_BETA_1_1:1.1
	FINAL_1_0:1.1
	EPSILON_1_0:1.1
	GAMMA_1_0:1.1
	BETA_1_0:1.1
	ALPHA_1_0:1.1;
locks; strict;
comment	@# @;


1.4
date	2007.01.31.03.44.42;	author delphij;	state dead;
branches;
next	1.3;

1.3
date	99.08.27.23.35.55;	author peter;	state Exp;
branches
	1.3.2.1
	1.3.34.1;
next	1.2;

1.2
date	99.05.28.13.23.21;	author kris;	state Exp;
branches;
next	1.1;

1.1
date	93.06.19.00.22.42;	author nate;	state Exp;
branches
	1.1.12.1;
next	;

1.3.2.1
date	2012.11.17.07.23.06;	author svnexp;	state Exp;
branches;
next	;

1.3.34.1
date	2007.02.20.08.33.30;	author delphij;	state dead;
branches;
next	;

1.1.12.1
date	99.06.07.14.07.32;	author kris;	state Exp;
branches;
next	1.1.12.2;

1.1.12.2
date	99.08.29.14.33.34;	author peter;	state Exp;
branches;
next	;


desc
@@


1.4
log
@Remove GNU gzip left-offs, they are no longer necessary.
@
text
@#!/bin/sh

# zgrep -- a wrapper around a grep program that decompresses files as needed
# Adapted from a version sent by Charles Levert <charles@@comm.polymtl.ca>
#
# $FreeBSD: src/gnu/usr.bin/gzip/zgrep,v 1.3 1999/08/27 23:35:55 peter Exp $

prog=`echo $0 | sed 's|.*/||'`
case "$prog" in
	*egrep)	grep=${EGREP-egrep}	;;
	*fgrep)	grep=${FGREP-fgrep}	;;
	*)	grep=${GREP-grep}	;;
esac
A=
fileno=0
pat=""
while test $# -ne 0; do
  case "$1" in
  -e | -f) opt="$opt $1"; shift; pat="$1"
           if test "$grep" = grep; then  # grep is buggy with -e on SVR4
             grep=egrep
           fi;;
  -*)	   opt="$opt $1";;
   *)      if test -z "$pat"; then
	     pat="$1"
	   else
             fileno=`expr $fileno + 1`
             eval A$fileno=\$1
             A="$A \"\$A$fileno\""
             fi
	     ;;
  esac
  shift
done

if test -z "$pat"; then
  echo "grep through gzip files"
  echo "usage: $prog [grep_options] pattern [files]"
  exit 1
fi

list=0
silent=0
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
case "$op" in
  *l*) list=1
esac
case "$op" in
  *h*) silent=1
esac

if test $fileno -eq 0; then
  gzip -cdfq | $grep $opt "$pat"
  exit $?
fi
eval set "$A" # files in $1, $2 ...

res=0
for i do
  if test $list -eq 1; then
    gzip -cdfq "$i" | $grep $opt "$pat" > /dev/null && echo $i
    r=$?
  elif test $# -eq 1 -o $silent -eq 1; then
    gzip -cdfq "$i" | $grep $opt "$pat"
    r=$?
  else
    gzip -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${i}:|"
    r=$?
  fi
  test "$r" -ne 0 && res="$r"
done
exit $res
@


1.3
log
@$Id$ -> $FreeBSD$
@
text
@d6 1
a6 1
# $FreeBSD$
@


1.3.2.1
log
@Switch importer
@
text
@d6 1
a6 1
# $FreeBSD: stable/4/gnu/usr.bin/gzip/zgrep 50472 1999-08-27 23:37:10Z peter $
@


1.3.34.1
log
@MFC: Replace gzip(1) with the BSD licensed version found in -HEAD.

Discussed with:	re, so, portmgr (kris)

All bugs are mine.
@
text
@d6 1
a6 1
# $FreeBSD: src/gnu/usr.bin/gzip/zgrep,v 1.3 1999/08/27 23:35:55 peter Exp $
@


1.2
log
@Fixes from OpenBSD:

Add $Id$
Removes temp file exploits in gzexe (predictable filenames)
Fixes some typos
Fixes a buffer overrun in gzip -S
Don't prepend /usr/local/bin to path in scripts
Correct location of /usr/share/misc/termcap

Obtained from:	OpenBSD
@
text
@d6 1
a6 1
# $Id$
@


1.1
log
@Updated gzip from 1.1 to 1.2.2
@
text
@d5 2
a6 2

PATH="/usr/local/bin:$PATH"; export PATH
@


1.1.12.1
log
@MFC: Fixes from OpenBSD:

Add $Id$
Removes temp file exploits in gzexe (predictable filenames)
Fixes some typos
Fixes a buffer overrun in gzip -S
Don't prepend /usr/local/bin to path in scripts
Correct location of /usr/share/misc/termcap
@
text
@d5 2
a6 2
#
# $Id: zgrep,v 1.2 1999/05/28 13:23:21 kris Exp $
@


1.1.12.2
log
@$Id$ -> $FreeBSD$
@
text
@d6 1
a6 1
# $FreeBSD$
@


