Date: Sat, 31 Dec 2011 16:00:27 +0200 From: Gleb Kurtsou <gleb.kurtsou@gmail.com> To: Gabor Kovesdan <gabor@FreeBSD.org> 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 Message-ID: <20111231140027.GA3487@reks> In-Reply-To: <201112311312.pBVDCBja064475@svn.freebsd.org> References: <201112311312.pBVDCBja064475@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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); > } >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111231140027.GA3487>