Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/grep add WITHOUT_BZ2 for tools build.
details: https://anonhg.NetBSD.org/src/rev/98afd9416a20
branches: trunk
changeset: 365309:98afd9416a20
user: christos <christos%NetBSD.org@localhost>
date: Sun Aug 12 07:53:19 2018 +0000
description:
add WITHOUT_BZ2 for tools build.
diffstat:
usr.bin/grep/Makefile | 11 ++++++++---
usr.bin/grep/file.c | 14 ++++++++++----
usr.bin/grep/grep.c | 8 ++++++--
usr.bin/grep/grep.h | 4 +++-
4 files changed, 27 insertions(+), 10 deletions(-)
diffs (145 lines):
diff -r eeabb46dd11b -r 98afd9416a20 usr.bin/grep/Makefile
--- a/usr.bin/grep/Makefile Sun Aug 12 06:11:47 2018 +0000
+++ b/usr.bin/grep/Makefile Sun Aug 12 07:53:19 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2018/08/11 19:43:54 christos Exp $
+# $NetBSD: Makefile,v 1.7 2018/08/12 07:53:19 christos Exp $
# $FreeBSD: head/usr.bin/grep/Makefile 210389 2010-07-22 19:11:57Z gabor $
# $OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $
@@ -17,8 +17,13 @@
grep.1 zegrep.1 \
grep.1 zfgrep.1
-LDADD= -lz -lbz2
-DPADD= ${LIBZ} ${LIBBZ2}
+LDADD+= -lz
+DPADD+= ${LIBZ}
+
+.if empty(HOST_CPPFLAGS:M(*-DWITHOUT_BZ2*)
+LDADD+= -lz
+DPADD+= ${LIBZ}
+.endif
.if empty(HOST_CPPFLAGS:M*-DWITHOUT_NLS*)
.PATH: ${.CURDIR}/nls
diff -r eeabb46dd11b -r 98afd9416a20 usr.bin/grep/file.c
--- a/usr.bin/grep/file.c Sun Aug 12 06:11:47 2018 +0000
+++ b/usr.bin/grep/file.c Sun Aug 12 07:53:19 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: file.c,v 1.8 2018/08/11 16:03:37 christos Exp $ */
+/* $NetBSD: file.c,v 1.9 2018/08/12 07:53:19 christos Exp $ */
/* $FreeBSD: head/usr.bin/grep/file.c 211496 2010-08-19 09:28:59Z des $ */
/* $OpenBSD: file.c,v 1.11 2010/07/02 20:48:48 nicm Exp $ */
@@ -35,7 +35,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: file.c,v 1.8 2018/08/11 16:03:37 christos Exp $");
+__RCSID("$NetBSD: file.c,v 1.9 2018/08/12 07:53:19 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -57,7 +57,9 @@
#define LNBUFBUMP 80
static gzFile gzbufdesc;
+#ifndef WITHOUT_BZ2
static BZFILE* bzbufdesc;
+#endif
static unsigned char buffer[MAXBUFSIZ];
static unsigned char *bufpos;
@@ -75,9 +77,10 @@
bufpos = buffer;
bufrem = 0;
- if (filebehave == FILE_GZIP)
+ if (filebehave == FILE_GZIP) {
nr = gzread(gzbufdesc, buffer, MAXBUFSIZ);
- else if (filebehave == FILE_BZIP && bzbufdesc != NULL) {
+#ifndef WITHOUT_BZ2
+ } else if (filebehave == FILE_BZIP && bzbufdesc != NULL) {
nr = BZ2_bzRead(&bzerr, bzbufdesc, buffer, MAXBUFSIZ);
switch (bzerr) {
case BZ_OK:
@@ -103,6 +106,7 @@
/* Make sure we exit with an error */
nr = -1;
}
+#endif
} else
nr = read(f->fd, buffer, MAXBUFSIZ);
@@ -196,9 +200,11 @@
(gzbufdesc = gzdopen(f->fd, "r")) == NULL)
goto error;
+#ifndef WITHOUT_BZ2
if (filebehave == FILE_BZIP &&
(bzbufdesc = BZ2_bzdopen(f->fd, "r")) == NULL)
goto error;
+#endif
/* Fill read buffer, also catches errors early */
if (grep_refill(f) != 0)
diff -r eeabb46dd11b -r 98afd9416a20 usr.bin/grep/grep.c
--- a/usr.bin/grep/grep.c Sun Aug 12 06:11:47 2018 +0000
+++ b/usr.bin/grep/grep.c Sun Aug 12 07:53:19 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: grep.c,v 1.13 2018/08/11 19:44:19 christos Exp $ */
+/* $NetBSD: grep.c,v 1.14 2018/08/12 07:53:19 christos Exp $ */
/* $FreeBSD: head/usr.bin/grep/grep.c 211519 2010-08-19 22:55:17Z delphij $ */
/* $OpenBSD: grep.c,v 1.42 2010/07/02 22:18:03 tedu Exp $ */
@@ -34,7 +34,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: grep.c,v 1.13 2018/08/11 19:44:19 christos Exp $");
+__RCSID("$NetBSD: grep.c,v 1.14 2018/08/12 07:53:19 christos Exp $");
#include <sys/stat.h>
#include <sys/types.h>
@@ -197,7 +197,9 @@
{"no-filename", no_argument, NULL, 'h'},
{"with-filename", no_argument, NULL, 'H'},
{"ignore-case", no_argument, NULL, 'i'},
+#ifndef WITHOUT_BZ2
{"bz2decompress", no_argument, NULL, 'J'},
+#endif
{"files-with-matches", no_argument, NULL, 'l'},
{"files-without-match", no_argument, NULL, 'L'},
{"max-count", required_argument, NULL, 'm'},
@@ -491,9 +493,11 @@
iflag = true;
cflags |= REG_ICASE;
break;
+#ifndef WITHOUT_BZ2
case 'J':
filebehave = FILE_BZIP;
break;
+#endif
case 'L':
lflag = false;
Lflag = true;
diff -r eeabb46dd11b -r 98afd9416a20 usr.bin/grep/grep.h
--- a/usr.bin/grep/grep.h Sun Aug 12 06:11:47 2018 +0000
+++ b/usr.bin/grep/grep.h Sun Aug 12 07:53:19 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: grep.h,v 1.8 2012/05/06 22:27:00 joerg Exp $ */
+/* $NetBSD: grep.h,v 1.9 2018/08/12 07:53:19 christos Exp $ */
/* $OpenBSD: grep.h,v 1.15 2010/04/05 03:03:55 tedu Exp $ */
/* $FreeBSD: head/usr.bin/grep/grep.h 211496 2010-08-19 09:28:59Z des $ */
@@ -29,7 +29,9 @@
* SUCH DAMAGE.
*/
+#ifndef WITHOUT_BZ2
#include <bzlib.h>
+#endif
#include <limits.h>
#include <regex.h>
#include <stdbool.h>
Home |
Main Index |
Thread Index |
Old Index