From owner-svn-src-stable-9@FreeBSD.ORG Sat Dec 31 14:30:39 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65BD2106566B; Sat, 31 Dec 2011 14:30:39 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 748738FC1C; Sat, 31 Dec 2011 14:30:37 +0000 (UTC) Received: by lahl5 with SMTP id l5so7880382lah.13 for ; Sat, 31 Dec 2011 06:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=ezng8Mw8gawui6Qzo7/Xo2W2CV395B8rIKVhY1zJ+pU=; b=VBEk5qk7tWlIHWNWSn3ezdaXu6LL/IwWoXyya2V6j6fHxbggU4p5NTpsLkGLr0kmEV 57rZjsxvkEAemZXP5S+2NHcAamEapZ41Hkz6lzAtdG/cK9vgjtSwDrdwNci1q8TtjJub Lq/GYu5HEKD0GqIpeWA6ANmrSC0yoz2e3pZPg= Received: by 10.152.128.103 with SMTP id nn7mr34755516lab.48.1325340017382; Sat, 31 Dec 2011 06:00:17 -0800 (PST) Received: from localhost ([78.157.92.5]) by mx.google.com with ESMTPS id mg13sm16205448lab.5.2011.12.31.06.00.16 (version=SSLv3 cipher=OTHER); Sat, 31 Dec 2011 06:00:16 -0800 (PST) Date: Sat, 31 Dec 2011 16:00:27 +0200 From: Gleb Kurtsou To: Gabor Kovesdan Message-ID: <20111231140027.GA3487@reks> References: <201112311312.pBVDCBja064475@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201112311312.pBVDCBja064475@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229081 - stable/9/usr.bin/grep X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2011 14:30:39 -0000 On (31/12/2011 13:12), Gabor Kovesdan wrote: > Author: gabor > Date: Sat Dec 31 13:12:10 2011 > New Revision: 229081 > URL: http://svn.freebsd.org/changeset/base/229081 > > Log: > MFC r228099: > - Create links to the xz and lzma versions even if BSD grep is not the > default. Nor GNU nor liblzma in base provides such functionality so > it may be useful. > > MFC r228319: > - Match GNU behavior of exit code > - Rename variable that has a different meaning now > > Modified: > stable/9/usr.bin/grep/Makefile > stable/9/usr.bin/grep/grep.c > stable/9/usr.bin/grep/grep.h > stable/9/usr.bin/grep/util.c > Directory Properties: > stable/9/usr.bin/grep/ (props changed) > > Modified: stable/9/usr.bin/grep/Makefile > ============================================================================== > --- stable/9/usr.bin/grep/Makefile Sat Dec 31 13:07:09 2011 (r229080) > +++ stable/9/usr.bin/grep/Makefile Sat Dec 31 13:12:10 2011 (r229081) > @@ -25,13 +25,7 @@ LINKS= ${BINDIR}/grep ${BINDIR}/egrep \ > ${BINDIR}/grep ${BINDIR}/fgrep \ > ${BINDIR}/grep ${BINDIR}/zgrep \ > ${BINDIR}/grep ${BINDIR}/zegrep \ > - ${BINDIR}/grep ${BINDIR}/zfgrep \ > - ${BINDIR}/grep ${BINDIR}/xzgrep \ > - ${BINDIR}/grep ${BINDIR}/xzegrep \ > - ${BINDIR}/grep ${BINDIR}/xzfgrep \ > - ${BINDIR}/grep ${BINDIR}/lzgrep \ > - ${BINDIR}/grep ${BINDIR}/lzegrep \ > - ${BINDIR}/grep ${BINDIR}/lzfgrep > + ${BINDIR}/grep ${BINDIR}/zfgrep Is there a reason we need all this mess is the first place? 12 grep links under /usr/bin. Why not to make zgrep handle all compression types. Tranparent compression handling in tar was a great success. Thanks, Gleb. > > MLINKS= grep.1 egrep.1 \ > grep.1 fgrep.1 \ > @@ -46,6 +40,13 @@ MLINKS= grep.1 egrep.1 \ > grep.1 lzfgrep.1 > .endif > > +LINKS+= ${BINDIR}/${PROG} ${BINDIR}/xzgrep \ > + ${BINDIR}/${PROG} ${BINDIR}/xzegrep \ > + ${BINDIR}/${PROG} ${BINDIR}/xzfgrep \ > + ${BINDIR}/${PROG} ${BINDIR}/lzgrep \ > + ${BINDIR}/${PROG} ${BINDIR}/lzegrep \ > + ${BINDIR}/${PROG} ${BINDIR}/lzfgrep > + > LDADD= -lz -llzma > DPADD= ${LIBZ} ${LIBLZMA} > > > Modified: stable/9/usr.bin/grep/grep.c > ============================================================================== > --- stable/9/usr.bin/grep/grep.c Sat Dec 31 13:07:09 2011 (r229080) > +++ stable/9/usr.bin/grep/grep.c Sat Dec 31 13:12:10 2011 (r229081) > @@ -148,7 +148,7 @@ static inline const char *init_color(con > bool first = true; /* flag whether we are processing the first match */ > bool prev; /* flag whether or not the previous line matched */ > int tail; /* lines left to print */ > -bool notfound; /* file not found */ > +bool file_err; /* file reading error */ > > /* > * Prints usage information and returns 2. > @@ -728,5 +728,5 @@ main(int argc, char *argv[]) > > /* Find out the correct return value according to the > results and the command line option. */ > - exit(c ? (notfound ? (qflag ? 0 : 2) : 0) : (notfound ? 2 : 1)); > + exit(c ? (file_err ? (qflag ? 0 : 2) : 0) : (file_err ? 2 : 1)); > } > > Modified: stable/9/usr.bin/grep/grep.h > ============================================================================== > --- stable/9/usr.bin/grep/grep.h Sat Dec 31 13:07:09 2011 (r229080) > +++ stable/9/usr.bin/grep/grep.h Sat Dec 31 13:12:10 2011 (r229081) > @@ -119,7 +119,7 @@ extern char *label; > extern const char *color; > extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave; > > -extern bool first, matchall, notfound, prev; > +extern bool file_err, first, matchall, prev; > extern int tail; > extern unsigned int dpatterns, fpatterns, patterns; > extern struct pat *pattern; > > Modified: stable/9/usr.bin/grep/util.c > ============================================================================== > --- stable/9/usr.bin/grep/util.c Sat Dec 31 13:07:09 2011 (r229080) > +++ stable/9/usr.bin/grep/util.c Sat Dec 31 13:12:10 2011 (r229081) > @@ -130,7 +130,7 @@ grep_tree(char **argv) > case FTS_DNR: > /* FALLTHROUGH */ > case FTS_ERR: > - notfound = true; > + file_err = true; > if(!sflag) > warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); > break; > @@ -195,10 +195,9 @@ procfile(const char *fn) > f = grep_open(fn); > } > if (f == NULL) { > + file_err = true; > if (!sflag) > warn("%s", fn); > - if (errno == ENOENT) > - notfound = true; > return (0); > } >