[Midnightbsd-cvs] src [11535] trunk/usr.bin/grep: sync grep with freebsd.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jul 7 16:34:07 EDT 2018
Revision: 11535
http://svnweb.midnightbsd.org/src/?rev=11535
Author: laffer1
Date: 2018-07-07 16:34:05 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
sync grep with freebsd.
Modified Paths:
--------------
trunk/usr.bin/grep/Makefile
trunk/usr.bin/grep/file.c
trunk/usr.bin/grep/grep.1
trunk/usr.bin/grep/grep.c
trunk/usr.bin/grep/grep.h
trunk/usr.bin/grep/regex/fastmatch.c
trunk/usr.bin/grep/regex/fastmatch.h
trunk/usr.bin/grep/regex/glue.h
trunk/usr.bin/grep/regex/hashtable.c
trunk/usr.bin/grep/regex/hashtable.h
trunk/usr.bin/grep/regex/tre-compile.c
trunk/usr.bin/grep/regex/tre-fastmatch.c
trunk/usr.bin/grep/regex/tre-fastmatch.h
trunk/usr.bin/grep/regex/xmalloc.c
trunk/usr.bin/grep/regex/xmalloc.h
trunk/usr.bin/grep/util.c
Property Changed:
----------------
trunk/usr.bin/grep/grep.1
Modified: trunk/usr.bin/grep/Makefile
===================================================================
--- trunk/usr.bin/grep/Makefile 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/Makefile 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
# $NetBSD: Makefile,v 1.4 2011/02/16 01:31:33 joerg Exp $
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/grep/Makefile 292588 2015-12-22 08:03:23Z delphij $
# $OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $
.include <bsd.own.mk>
@@ -31,15 +32,16 @@
grep.1 fgrep.1 \
grep.1 zgrep.1 \
grep.1 zegrep.1 \
- grep.1 zfgrep.1 \
- grep.1 xzgrep.1 \
- grep.1 xzegrep.1 \
- grep.1 xzfgrep.1 \
- grep.1 lzgrep.1 \
- grep.1 lzegrep.1 \
- grep.1 lzfgrep.1
+ grep.1 zfgrep.1
.endif
+LDADD= -lz
+DPADD= ${LIBZ}
+
+.if !defined(WITHOUT_LZMA_SUPPORT)
+LDADD+= -llzma -lpthread
+DPADD+= ${LIBLZMA} ${LIBPTHREAD}
+
LINKS+= ${BINDIR}/${PROG} ${BINDIR}/xzgrep \
${BINDIR}/${PROG} ${BINDIR}/xzegrep \
${BINDIR}/${PROG} ${BINDIR}/xzfgrep \
@@ -47,10 +49,17 @@
${BINDIR}/${PROG} ${BINDIR}/lzegrep \
${BINDIR}/${PROG} ${BINDIR}/lzfgrep
-LDADD= -lz -llzma
-DPADD= ${LIBZ} ${LIBLZMA}
+MLINKS+= grep.1 xzgrep.1 \
+ grep.1 xzegrep.1 \
+ grep.1 xzfgrep.1 \
+ grep.1 lzgrep.1 \
+ grep.1 lzegrep.1 \
+ grep.1 lzfgrep.1
+.else
+CFLAGS+= -DWITHOUT_LZMA
+.endif
-.if !defined(WITHOUT_BZIP2)
+.if !defined(WITHOUT_BZIP2_SUPPORT)
LDADD+= -lbz2
DPADD+= ${LIBBZ2}
@@ -67,7 +76,7 @@
.endif
.if !defined(WITHOUT_GNU_COMPAT)
-CFLAGS+= -I/usr/include/gnu
+CFLAGS+= -I${DESTDIR}/usr/include/gnu
LDADD+= -lgnuregex
DPADD+= ${LIBGNUREGEX}
.endif
@@ -78,4 +87,8 @@
CFLAGS+= -DWITHOUT_NLS
.endif
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
Modified: trunk/usr.bin/grep/file.c
===================================================================
--- trunk/usr.bin/grep/file.c 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/file.c 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/* $NetBSD: file.c,v 1.5 2011/02/16 18:35:39 joerg Exp $ */
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/file.c 278175 2015-02-04 00:45:02Z delphij $ */
/* $OpenBSD: file.c,v 1.11 2010/07/02 20:48:48 nicm Exp $ */
/*-
@@ -31,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/grep/file.c 278175 2015-02-04 00:45:02Z delphij $");
#include <sys/param.h>
#include <sys/mman.h>
@@ -41,7 +42,6 @@
#include <err.h>
#include <errno.h>
#include <fcntl.h>
-#include <lzma.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -50,6 +50,10 @@
#include <wctype.h>
#include <zlib.h>
+#ifndef WITHOUT_LZMA
+#include <lzma.h>
+#endif
+
#ifndef WITHOUT_BZIP2
#include <bzlib.h>
#endif
@@ -60,7 +64,11 @@
#define LNBUFBUMP 80
static gzFile gzbufdesc;
+#ifndef WITHOUT_LZMA
static lzma_stream lstrm = LZMA_STREAM_INIT;
+static lzma_action laction;
+static uint8_t lin_buf[MAXBUFSIZ];
+#endif
#ifndef WITHOUT_BZIP2
static BZFILE* bzbufdesc;
#endif
@@ -116,36 +124,38 @@
nr = -1;
}
#endif
+#ifndef WITHOUT_LZMA
} else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) {
- lzma_action action = LZMA_RUN;
- uint8_t in_buf[MAXBUFSIZ];
lzma_ret ret;
+ lstrm.next_out = buffer;
- ret = (filebehave == FILE_XZ) ?
- lzma_stream_decoder(&lstrm, UINT64_MAX,
- LZMA_CONCATENATED) :
- lzma_alone_decoder(&lstrm, UINT64_MAX);
+ do {
+ if (lstrm.avail_in == 0) {
+ lstrm.next_in = lin_buf;
+ nr = read(f->fd, lin_buf, MAXBUFSIZ);
- if (ret != LZMA_OK)
- return (-1);
+ if (nr < 0)
+ return (-1);
+ else if (nr == 0)
+ laction = LZMA_FINISH;
- lstrm.next_out = buffer;
- lstrm.avail_out = MAXBUFSIZ;
- lstrm.next_in = in_buf;
- nr = read(f->fd, in_buf, MAXBUFSIZ);
+ lstrm.avail_in = nr;
+ }
- if (nr < 0)
- return (-1);
- else if (nr == 0)
- action = LZMA_FINISH;
+ ret = lzma_code(&lstrm, laction);
- lstrm.avail_in = nr;
- ret = lzma_code(&lstrm, action);
+ if (ret != LZMA_OK && ret != LZMA_STREAM_END)
+ return (-1);
- if (ret != LZMA_OK && ret != LZMA_STREAM_END)
- return (-1);
- bufrem = MAXBUFSIZ - lstrm.avail_out;
+ if (lstrm.avail_out == 0 || ret == LZMA_STREAM_END) {
+ bufrem = MAXBUFSIZ - lstrm.avail_out;
+ lstrm.next_out = buffer;
+ lstrm.avail_out = MAXBUFSIZ;
+ }
+ } while (bufrem == 0 && ret != LZMA_STREAM_END);
+
return (0);
+#endif /* WIHTOUT_LZMA */
} else
nr = read(f->fd, buffer, MAXBUFSIZ);
@@ -284,7 +294,24 @@
(bzbufdesc = BZ2_bzdopen(f->fd, "r")) == NULL)
goto error2;
#endif
+#ifndef WITHOUT_LZMA
+ else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) {
+ lzma_ret ret;
+ ret = (filebehave == FILE_XZ) ?
+ lzma_stream_decoder(&lstrm, UINT64_MAX,
+ LZMA_CONCATENATED) :
+ lzma_alone_decoder(&lstrm, UINT64_MAX);
+
+ if (ret != LZMA_OK)
+ goto error2;
+
+ lstrm.avail_in = 0;
+ lstrm.avail_out = MAXBUFSIZ;
+ laction = LZMA_RUN;
+ }
+#endif
+
/* Fill read buffer, also catches errors early */
if (bufrem == 0 && grep_refill(f) != 0)
goto error2;
Modified: trunk/usr.bin/grep/grep.1
===================================================================
--- trunk/usr.bin/grep/grep.1 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/grep.1 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,5 +1,6 @@
+.\" $MidnightBSD$
.\" $NetBSD: grep.1,v 1.2 2011/02/16 01:31:33 joerg Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/grep/grep.1 318650 2017-05-22 15:51:17Z gjb $
.\" $OpenBSD: grep.1,v 1.38 2010/04/05 06:30:59 jmc Exp $
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -352,6 +353,8 @@
(i.e. their error messages are suppressed).
.It Fl U , Fl Fl binary
Search binary files, but do not attempt to print them.
+.It Fl u
+This option has no effect and is provided only for compatibility with GNU grep.
.It Fl V , Fl Fl version
Display version information and exit.
.It Fl v , Fl Fl invert-match
Property changes on: trunk/usr.bin/grep/grep.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/grep/grep.c
===================================================================
--- trunk/usr.bin/grep/grep.c 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/grep.c 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,5 +1,6 @@
-/* $NetBSD: grep.c,v 1.4 2011/02/16 01:31:33 joerg Exp $ */
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $NetBSD: grep.c,v 1.6 2011/04/18 03:48:23 joerg Exp $ */
+/* $FreeBSD: stable/10/usr.bin/grep/grep.c 280408 2015-03-24 01:31:02Z pfg $ */
/* $OpenBSD: grep.c,v 1.42 2010/07/02 22:18:03 tedu Exp $ */
/*-
@@ -30,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/grep/grep.c 280408 2015-03-24 01:31:02Z pfg $");
#include <sys/stat.h>
#include <sys/types.h>
@@ -44,6 +45,7 @@
#include <libgen.h>
#include <locale.h>
#include <stdbool.h>
+#define _WITH_GETLINE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -82,14 +84,15 @@
bool matchall;
/* Searching patterns */
-unsigned int patterns, pattern_sz;
+unsigned int patterns;
+static unsigned int pattern_sz;
struct pat *pattern;
regex_t *r_pattern;
fastmatch_t *fg_pattern;
/* Filename exclusion/inclusion patterns */
-unsigned int fpatterns, fpattern_sz;
-unsigned int dpatterns, dpattern_sz;
+unsigned int fpatterns, dpatterns;
+static unsigned int fpattern_sz, dpattern_sz;
struct epat *dpattern, *fpattern;
/* For regex errors */
@@ -166,7 +169,7 @@
static const char *optstr = "0123456789A:B:C:D:EFGHIJMLOPSRUVZabcd:e:f:hilm:nopqrsuvwxXy";
-struct option long_options[] =
+static const struct option long_options[] =
{
{"binary-files", required_argument, NULL, BIN_OPT},
{"help", no_argument, NULL, HELP_OPT},
@@ -303,6 +306,7 @@
FILE *f;
char *line;
size_t len;
+ ssize_t rlen;
if ((f = fopen(fn, "r")) == NULL)
err(2, "%s", fn);
@@ -310,8 +314,11 @@
fclose(f);
return;
}
- while ((line = fgetln(f, &len)) != NULL)
- add_pattern(line, line[0] == '\n' ? 0 : len);
+ len = 0;
+ line = NULL;
+ while ((rlen = getline(&line, &len, f)) != -1)
+ add_pattern(line, line[0] == '\n' ? 0 : (size_t)rlen);
+ free(line);
if (ferror(f))
err(2, "%s", fn);
fclose(f);
Modified: trunk/usr.bin/grep/grep.h
===================================================================
--- trunk/usr.bin/grep/grep.h 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/grep.h 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,6 +1,7 @@
+/* $MidnightBSD$ */
/* $NetBSD: grep.h,v 1.5 2011/02/27 17:33:37 joerg Exp $ */
/* $OpenBSD: grep.h,v 1.15 2010/04/05 03:03:55 tedu Exp $ */
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/grep.h 265160 2014-04-30 20:39:08Z pfg $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -39,48 +40,48 @@
#include "fastmatch.h"
#ifdef WITHOUT_NLS
-#define getstr(n) errstr[n]
+#define getstr(n) errstr[n]
#else
#include <nl_types.h>
extern nl_catd catalog;
-#define getstr(n) catgets(catalog, 1, n, errstr[n])
+#define getstr(n) catgets(catalog, 1, n, errstr[n])
#endif
extern const char *errstr[];
-#define VERSION "2.5.1-FreeBSD"
+#define VERSION "2.5.1-FreeBSD"
-#define GREP_FIXED 0
-#define GREP_BASIC 1
-#define GREP_EXTENDED 2
+#define GREP_FIXED 0
+#define GREP_BASIC 1
+#define GREP_EXTENDED 2
-#define BINFILE_BIN 0
-#define BINFILE_SKIP 1
-#define BINFILE_TEXT 2
+#define BINFILE_BIN 0
+#define BINFILE_SKIP 1
+#define BINFILE_TEXT 2
-#define FILE_STDIO 0
-#define FILE_MMAP 1
-#define FILE_GZIP 2
-#define FILE_BZIP 3
-#define FILE_XZ 4
-#define FILE_LZMA 5
+#define FILE_STDIO 0
+#define FILE_MMAP 1
+#define FILE_GZIP 2
+#define FILE_BZIP 3
+#define FILE_XZ 4
+#define FILE_LZMA 5
-#define DIR_READ 0
-#define DIR_SKIP 1
-#define DIR_RECURSE 2
+#define DIR_READ 0
+#define DIR_SKIP 1
+#define DIR_RECURSE 2
-#define DEV_READ 0
-#define DEV_SKIP 1
+#define DEV_READ 0
+#define DEV_SKIP 1
-#define LINK_READ 0
-#define LINK_EXPLICIT 1
-#define LINK_SKIP 2
+#define LINK_READ 0
+#define LINK_EXPLICIT 1
+#define LINK_SKIP 2
-#define EXCL_PAT 0
-#define INCL_PAT 1
+#define EXCL_PAT 0
+#define INCL_PAT 1
-#define MAX_LINE_MATCHES 32
+#define MAX_LINE_MATCHES 32
struct file {
int fd;
@@ -129,7 +130,7 @@
extern fastmatch_t *fg_pattern;
/* For regex errors */
-#define RE_ERROR_BUF 512
+#define RE_ERROR_BUF 512
extern char re_error[RE_ERROR_BUF + 1]; /* Seems big enough */
/* util.c */
Modified: trunk/usr.bin/grep/regex/fastmatch.c
===================================================================
--- trunk/usr.bin/grep/regex/fastmatch.c 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/fastmatch.c 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/fastmatch.c 226035 2011-10-05 09:56:43Z gabor $ */
/*-
* Copyright (C) 2011 Gabor Kovesdan <gabor at FreeBSD.org>
Modified: trunk/usr.bin/grep/regex/fastmatch.h
===================================================================
--- trunk/usr.bin/grep/regex/fastmatch.h 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/fastmatch.h 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/fastmatch.h 226035 2011-10-05 09:56:43Z gabor $ */
#ifndef FASTMATCH_H
#define FASTMATCH_H 1
Modified: trunk/usr.bin/grep/regex/glue.h
===================================================================
--- trunk/usr.bin/grep/regex/glue.h 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/glue.h 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/glue.h 303882 2016-08-09 18:49:19Z dim $ */
#ifndef GLUE_H
#define GLUE_H
@@ -50,7 +51,7 @@
if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0) \
return REG_NOMATCH; \
ret = fn; \
- for (unsigned i = 0; (!(eflags & REG_NOSUB) && (i < nmatch)); i++)\
+ for (unsigned i = 0; (!preg->nosub && (i < nmatch)); i++) \
{ \
pmatch[i].rm_so += offset; \
pmatch[i].rm_eo += offset; \
Modified: trunk/usr.bin/grep/regex/hashtable.c
===================================================================
--- trunk/usr.bin/grep/regex/hashtable.c 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/hashtable.c 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/hashtable.c 226035 2011-10-05 09:56:43Z gabor $ */
/*-
* Copyright (C) 2011 Gabor Kovesdan <gabor at FreeBSD.org>
Modified: trunk/usr.bin/grep/regex/hashtable.h
===================================================================
--- trunk/usr.bin/grep/regex/hashtable.h 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/hashtable.h 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/hashtable.h 226035 2011-10-05 09:56:43Z gabor $ */
#ifndef HASHTABLE_H
#define HASHTABLE_H 1
Modified: trunk/usr.bin/grep/regex/tre-compile.c
===================================================================
--- trunk/usr.bin/grep/regex/tre-compile.c 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/tre-compile.c 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/tre-compile.c 226035 2011-10-05 09:56:43Z gabor $ */
#include "glue.h"
Modified: trunk/usr.bin/grep/regex/tre-fastmatch.c
===================================================================
--- trunk/usr.bin/grep/regex/tre-fastmatch.c 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/tre-fastmatch.c 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/tre-fastmatch.c 303882 2016-08-09 18:49:19Z dim $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -395,7 +396,7 @@
if (p == NULL) \
return REG_ESPACE; \
for (unsigned int i = 0; i < plen; i++) \
- p[i] = tolower(pat[i]); \
+ p[i] = tolower((unsigned char)pat[i]); \
_CALC_BMGS(arr, p, plen); \
xfree(p); \
} \
@@ -444,7 +445,7 @@
}
/*
- * Copies the pattern pat having lenght n to p and stores
+ * Copies the pattern pat having length n to p and stores
* the size in l.
*/
#define SAVE_PATTERN(src, srclen, dst, dstlen) \
@@ -621,7 +622,7 @@
case TRE_CHAR('+'):
case TRE_CHAR('?'):
if ((cflags & REG_EXTENDED) && (i == 0))
- continue;
+ goto badpat;
else if ((cflags & REG_EXTENDED) ^ !escaped)
STORE_CHAR;
else
@@ -727,7 +728,7 @@
for (unsigned int i = 0; i < fg->len; i++)
if (fg->pattern[i] == '\\')
escaped = !escaped;
- else if (fg->pattern[i] == '.' && escaped)
+ else if (fg->pattern[i] == '.' && fg->escmap && escaped)
{
fg->escmap[i] = true;
escaped = false;
@@ -1030,7 +1031,7 @@
continue;
/* Compare */
- if (fg->icase ? (tolower(pat_byte[i]) == tolower(str_byte[i]))
+ if (fg->icase ? (tolower((unsigned char)pat_byte[i]) == tolower((unsigned char)str_byte[i]))
: (pat_byte[i] == str_byte[i]))
continue;
}
Modified: trunk/usr.bin/grep/regex/tre-fastmatch.h
===================================================================
--- trunk/usr.bin/grep/regex/tre-fastmatch.h 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/tre-fastmatch.h 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/tre-fastmatch.h 226035 2011-10-05 09:56:43Z gabor $ */
#ifndef TRE_FASTMATCH_H
#define TRE_FASTMATCH_H 1
Modified: trunk/usr.bin/grep/regex/xmalloc.c
===================================================================
--- trunk/usr.bin/grep/regex/xmalloc.c 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/xmalloc.c 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/xmalloc.c 241737 2012-10-19 14:49:42Z ed $ */
/*
xmalloc.c - Simple malloc debugging library implementation
@@ -39,9 +40,9 @@
} hashTable;
static int xmalloc_peak;
-int xmalloc_current;
+static int xmalloc_current;
static int xmalloc_peak_blocks;
-int xmalloc_current_blocks;
+static int xmalloc_current_blocks;
static int xmalloc_fail_after;
#define TABLE_BITS 8
Modified: trunk/usr.bin/grep/regex/xmalloc.h
===================================================================
--- trunk/usr.bin/grep/regex/xmalloc.h 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/regex/xmalloc.h 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/regex/xmalloc.h 226035 2011-10-05 09:56:43Z gabor $ */
/*
xmalloc.h - Simple malloc debugging library API
Modified: trunk/usr.bin/grep/util.c
===================================================================
--- trunk/usr.bin/grep/util.c 2018-07-07 20:33:14 UTC (rev 11534)
+++ trunk/usr.bin/grep/util.c 2018-07-07 20:34:05 UTC (rev 11535)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/* $NetBSD: util.c,v 1.9 2011/02/27 17:33:37 joerg Exp $ */
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.bin/grep/util.c 303882 2016-08-09 18:49:19Z dim $ */
/* $OpenBSD: util.c,v 1.39 2010/07/02 22:18:03 tedu Exp $ */
/*-
@@ -30,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/grep/util.c 303882 2016-08-09 18:49:19Z dim $");
#include <sys/stat.h>
#include <sys/types.h>
@@ -302,7 +303,7 @@
r = REG_NOMATCH;
/* Check for whole word match */
if (r == 0 && (wflag || fg_pattern[i].word)) {
- wint_t wbegin, wend;
+ wchar_t wbegin, wend;
wbegin = wend = L' ';
if (pmatch.rm_so != 0 &&
@@ -336,7 +337,7 @@
}
/* One pass if we are not recording matches */
- if ((color == NULL && !oflag) || qflag || lflag)
+ if (!wflag && ((color == NULL && !oflag) || qflag || lflag || Lflag))
break;
if (st == (size_t)pmatch.rm_so)
More information about the Midnightbsd-cvs
mailing list