Module Name: src
Committed By: christos
Date: Sun Jan 10 22:16:40 UTC 2016
Modified Files:
src/external/gpl2/grep/dist/doc: grep.1 grep.texi
src/external/gpl2/grep/dist/lib: getopt.c hard-locale.c regex.c
savedir.c
src/external/gpl2/grep/dist/src: ansi2knr.c dfa.c grep.c search.c
Added Files:
src/external/gpl2/grep: Makefile Makefile.inc grep2netbsd
src/external/gpl2/grep/bin: Makefile
src/external/gpl2/grep/include: config.h
src/external/gpl2/grep/lib: Makefile
src/external/gpl2/grep/po: cs.gmo de.gmo el.gmo eo.gmo es.gmo et.gmo
fr.gmo gl.gmo hr.gmo id.gmo it.gmo ja.gmo ko.gmo nl.gmo no.gmo
pl.gmo pt_BR.gmo ru.gmo sl.gmo sv.gmo
Log Message:
- merge conflicts, enable wide char support.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/gpl2/grep/Makefile \
src/external/gpl2/grep/Makefile.inc src/external/gpl2/grep/grep2netbsd
cvs rdiff -u -r0 -r1.1 src/external/gpl2/grep/bin/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/grep/dist/doc/grep.1 \
src/external/gpl2/grep/dist/doc/grep.texi
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/grep/dist/lib/getopt.c \
src/external/gpl2/grep/dist/lib/hard-locale.c \
src/external/gpl2/grep/dist/lib/regex.c \
src/external/gpl2/grep/dist/lib/savedir.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/grep/dist/src/ansi2knr.c \
src/external/gpl2/grep/dist/src/dfa.c \
src/external/gpl2/grep/dist/src/grep.c \
src/external/gpl2/grep/dist/src/search.c
cvs rdiff -u -r0 -r1.1 src/external/gpl2/grep/include/config.h
cvs rdiff -u -r0 -r1.1 src/external/gpl2/grep/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/external/gpl2/grep/po/cs.gmo \
src/external/gpl2/grep/po/de.gmo src/external/gpl2/grep/po/el.gmo \
src/external/gpl2/grep/po/eo.gmo src/external/gpl2/grep/po/es.gmo \
src/external/gpl2/grep/po/et.gmo src/external/gpl2/grep/po/fr.gmo \
src/external/gpl2/grep/po/gl.gmo src/external/gpl2/grep/po/hr.gmo \
src/external/gpl2/grep/po/id.gmo src/external/gpl2/grep/po/it.gmo \
src/external/gpl2/grep/po/ja.gmo src/external/gpl2/grep/po/ko.gmo \
src/external/gpl2/grep/po/nl.gmo src/external/gpl2/grep/po/no.gmo \
src/external/gpl2/grep/po/pl.gmo src/external/gpl2/grep/po/pt_BR.gmo \
src/external/gpl2/grep/po/ru.gmo src/external/gpl2/grep/po/sl.gmo \
src/external/gpl2/grep/po/sv.gmo
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl2/grep/dist/doc/grep.1
diff -u src/external/gpl2/grep/dist/doc/grep.1:1.1.1.1 src/external/gpl2/grep/dist/doc/grep.1:1.2
--- src/external/gpl2/grep/dist/doc/grep.1:1.1.1.1 Sun Jan 10 16:36:16 2016
+++ src/external/gpl2/grep/dist/doc/grep.1 Sun Jan 10 17:16:40 2016
@@ -1,21 +1,8 @@
-.\" $NetBSD: grep.1,v 1.1.1.1 2016/01/10 21:36:16 christos Exp $
+.\" $NetBSD: grep.1,v 1.2 2016/01/10 22:16:40 christos Exp $
.\"
.\" grep man page
-.if !\n(.g \{\
-. if !\w|\*(lq| \{\
-. ds lq ``
-. if \w'\(lq' .ds lq "\(lq
-. \}
-. if !\w|\*(rq| \{\
-. ds rq ''
-. if \w'\(rq' .ds rq "\(rq
-. \}
-.\}
-.de Id
-.ds Dt \\$4
-..
-.Id Id: grep.1,v 1.23 2002/01/22 13:20:04 bero Exp
-.TH GREP 1 \*(Dt "GNU Project"
+.\"d Id: grep.1,v 1.23 2002/01/22 13:20:04 bero Exp
+.TH GREP 1 "June 16 2003" "GNU Project"
.SH NAME
grep, egrep, fgrep \- print lines matching a pattern
.SH SYNOPSIS
@@ -81,14 +68,6 @@ Places a line containing
.B \-\^\-
between contiguous groups of matches.
.TP
-.BI \-C " NUM" "\fR,\fP \-\^\-context=" NUM
-Print
-.I NUM
-lines of output context.
-Places a line containing
-.B \-\^\-
-between contiguous groups of matches.
-.TP
.BR \-b ", " \-\^\-byte-offset
Print the byte offset within the input file before
each line of output.
@@ -128,10 +107,13 @@ might output binary garbage,
which can have nasty side effects if the output is a terminal and if the
terminal driver interprets some of it as commands.
.TP
-.BI \-\^\-colour[=\fIWHEN\fR] ", " \-\^\-color[=\fIWHEN\fR]
-Surround the matching string with the marker find in
-.B GREP_COLOR
-environment variable. WHEN may be `never', `always', or `auto'
+.BI \-C " NUM" "\fR,\fP \-\^\-context=" NUM
+Print
+.I NUM
+lines of output context.
+Places a line containing
+.B \-\^\-
+between contiguous groups of matches.
.TP
.BR \-c ", " \-\^\-count
Suppress normal output; instead print a count of
@@ -140,6 +122,11 @@ With the
.BR \-v ", " \-\^\-invert-match
option (see below), count non-matching lines.
.TP
+.BI \-\^\-colour[=\fIWHEN\fR] ", " \-\^\-color[=\fIWHEN\fR]
+Surround the matching string with the marker find in
+.B GREP_COLOR
+environment variable. WHEN may be `never', `always', or `auto'
+.TP
.BI \-D " ACTION" "\fR,\fP \-\^\-devices=" ACTION
If an input file is a device, FIFO or socket, use
.I ACTION
@@ -187,16 +174,13 @@ Use
.I PATTERN
as the pattern; useful to protect patterns beginning with
.BR \- .
+May be specified more than once.
.TP
.BR \-F ", " \-\^\-fixed-strings
Interpret
.I PATTERN
as a list of fixed strings, separated by newlines,
any of which is to be matched.
-.BR \-P ", " \-\^\-perl-regexp
-Interpret
-.I PATTERN
-as a Perl regular expression.
.TP
.BI \-f " FILE" "\fR,\fP \-\^\-file=" FILE
Obtain patterns from
@@ -236,6 +220,15 @@ of each input file from which no output
normally have been printed. The scanning will stop
on the first match.
.TP
+.BI \-\^\-label= LABEL
+Displays input actually coming from standard input as input coming from file
+.I LABEL.
+This is especially useful for tools like zgrep, e.g.
+.B "gzip -cd foo.gz |grep --label=foo something"
+.TP
+.BR \-\^\-line-buffered
+Use line buffering, it can be a performance penalty.
+.TP
.BR \-l ", " \-\^\-files-with-matches
Suppress normal output; instead print
the name of each input file from which output
@@ -297,15 +290,12 @@ within its input file.
.BR \-o ", " \-\^\-only-matching
Show only the part of a matching line that matches
.I PATTERN.
-.TP
-.BI \-\^\-label= LABEL
-Displays input actually coming from standard input as input coming from file
-.I LABEL.
-This is especially useful for tools like zgrep, e.g.
-.B "gzip -cd foo.gz |grep --label=foo something"
-.TP
-.BR \-\^\-line-buffering
-Use line buffering, it can be a performance penality.
+.\" NetBSD doesn't support perl regexps
+.\" .TP
+.\" .BR \-P ", " \-\^\-perl-regexp
+.\" Interpret
+.\" .I PATTERN
+.\" as a Perl regular expression.
.TP
.BR \-q ", " \-\^\-quiet ", " \-\^\-silent
Quiet; do not write anything to standard output.
@@ -529,7 +519,7 @@ is a synonym for
and
.B \eW
is a synonym for
-.BR [^[:alnum]] .
+.BR [^[:alnum:]] .
.PP
The caret
.B ^
Index: src/external/gpl2/grep/dist/doc/grep.texi
diff -u src/external/gpl2/grep/dist/doc/grep.texi:1.1.1.1 src/external/gpl2/grep/dist/doc/grep.texi:1.2
--- src/external/gpl2/grep/dist/doc/grep.texi:1.1.1.1 Sun Jan 10 16:36:16 2016
+++ src/external/gpl2/grep/dist/doc/grep.texi Sun Jan 10 17:16:40 2016
@@ -1,5 +1,5 @@
\input texinfo @c -*-texinfo-*-
-@c $NetBSD: grep.texi,v 1.1.1.1 2016/01/10 21:36:16 christos Exp $
+@c $NetBSD: grep.texi,v 1.2 2016/01/10 22:16:40 christos Exp $
@c %**start of header
@setfilename grep.info
@settitle grep, print lines matching a pattern
@@ -27,7 +27,7 @@
@ifinfo
@direntry
-* grep: (grep). print lines matching a pattern.
+* grep: (grep). print lines matching a pattern.
@end direntry
This file documents @command{grep}, a pattern matching engine.
@@ -358,7 +358,7 @@ Suppress the prefixing of filenames on o
@item --line-buffered
@opindex --line-buffered
@cindex line buffering
-Set the line buffering policy, this can be a performance penality.
+Set the line buffering policy, this can be a performance penalty.
@item --label=@var{LABEL}
@opindex --label
Index: src/external/gpl2/grep/dist/lib/getopt.c
diff -u src/external/gpl2/grep/dist/lib/getopt.c:1.1.1.1 src/external/gpl2/grep/dist/lib/getopt.c:1.2
--- src/external/gpl2/grep/dist/lib/getopt.c:1.1.1.1 Sun Jan 10 16:36:18 2016
+++ src/external/gpl2/grep/dist/lib/getopt.c Sun Jan 10 17:16:40 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: getopt.c,v 1.1.1.1 2016/01/10 21:36:18 christos Exp $ */
+/* $NetBSD: getopt.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
/* Getopt for GNU.
NOTE: The canonical source of this file is maintained with the GNU
@@ -431,7 +431,7 @@ _getopt_initialize (argc, argv, optstrin
else
{
const char *orig_str = __getopt_nonoption_flags;
- int len = nonoption_flags_max_len = strlen (orig_str);
+ size_t len = nonoption_flags_max_len = strlen (orig_str);
if (nonoption_flags_max_len < argc)
nonoption_flags_max_len = argc;
__getopt_nonoption_flags =
Index: src/external/gpl2/grep/dist/lib/hard-locale.c
diff -u src/external/gpl2/grep/dist/lib/hard-locale.c:1.1.1.1 src/external/gpl2/grep/dist/lib/hard-locale.c:1.2
--- src/external/gpl2/grep/dist/lib/hard-locale.c:1.1.1.1 Sun Jan 10 16:36:18 2016
+++ src/external/gpl2/grep/dist/lib/hard-locale.c Sun Jan 10 17:16:40 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: hard-locale.c,v 1.1.1.1 2016/01/10 21:36:18 christos Exp $ */
+/* $NetBSD: hard-locale.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
/* hard-locale.c -- Determine whether a locale is hard.
Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
@@ -48,6 +48,10 @@ char *alloca ();
# include <string.h>
#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
/* Return nonzero if the current CATEGORY locale is hard, i.e. if you
can't get away with assuming traditional C or POSIX behavior. */
int
Index: src/external/gpl2/grep/dist/lib/regex.c
diff -u src/external/gpl2/grep/dist/lib/regex.c:1.1.1.1 src/external/gpl2/grep/dist/lib/regex.c:1.2
--- src/external/gpl2/grep/dist/lib/regex.c:1.1.1.1 Sun Jan 10 16:36:19 2016
+++ src/external/gpl2/grep/dist/lib/regex.c Sun Jan 10 17:16:40 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: regex.c,v 1.1.1.1 2016/01/10 21:36:19 christos Exp $ */
+/* $NetBSD: regex.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
/* Extended regular expression matching and search library,
version 0.12.
@@ -1127,7 +1127,7 @@ print_double_string (where, string1, siz
int size1;
int size2;
{
- int this_char;
+ ptrdiff_t this_char;
if (where == NULL)
printf ("(null)");
Index: src/external/gpl2/grep/dist/lib/savedir.c
diff -u src/external/gpl2/grep/dist/lib/savedir.c:1.1.1.1 src/external/gpl2/grep/dist/lib/savedir.c:1.2
--- src/external/gpl2/grep/dist/lib/savedir.c:1.1.1.1 Sun Jan 10 16:36:19 2016
+++ src/external/gpl2/grep/dist/lib/savedir.c Sun Jan 10 17:16:40 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: savedir.c,v 1.1.1.1 2016/01/10 21:36:19 christos Exp $ */
+/* $NetBSD: savedir.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
/* savedir.c -- save the list of files in a directory in a string
Copyright (C) 1990, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
@@ -70,6 +70,7 @@ char *stpcpy ();
#include <fnmatch.h>
#include "savedir.h"
+#include "system.h"
char *path;
size_t pathlen;
Index: src/external/gpl2/grep/dist/src/ansi2knr.c
diff -u src/external/gpl2/grep/dist/src/ansi2knr.c:1.1.1.1 src/external/gpl2/grep/dist/src/ansi2knr.c:1.2
--- src/external/gpl2/grep/dist/src/ansi2knr.c:1.1.1.1 Sun Jan 10 16:36:20 2016
+++ src/external/gpl2/grep/dist/src/ansi2knr.c Sun Jan 10 17:16:40 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ansi2knr.c,v 1.1.1.1 2016/01/10 21:36:20 christos Exp $ */
+/* $NetBSD: ansi2knr.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
/* Copyright (C) 1989, 1997, 1998, 1999 Aladdin Enterprises. All rights reserved. */
@@ -461,7 +461,7 @@ test1(buf)
}
{
char *id = p;
- int len;
+ ptrdiff_t len;
/*
* Check for identifier1(identifier2) and not
* identifier1(void), or identifier1(identifier2, xxxx).
Index: src/external/gpl2/grep/dist/src/dfa.c
diff -u src/external/gpl2/grep/dist/src/dfa.c:1.1.1.1 src/external/gpl2/grep/dist/src/dfa.c:1.2
--- src/external/gpl2/grep/dist/src/dfa.c:1.1.1.1 Sun Jan 10 16:36:21 2016
+++ src/external/gpl2/grep/dist/src/dfa.c Sun Jan 10 17:16:40 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: dfa.c,v 1.1.1.1 2016/01/10 21:36:21 christos Exp $ */
+/* $NetBSD: dfa.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
/* dfa.c - deterministic extended regexp routines for GNU
Copyright 1988, 1998, 2000 Free Software Foundation, Inc.
@@ -46,7 +46,7 @@ extern void free();
# include <locale.h>
#endif
-#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC
+#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC && defined HAVE_WCTYPE
/* We can handle multibyte string. */
# define MBS_SUPPORT
#endif
@@ -334,9 +334,9 @@ static int hard_LC_COLLATE; /* Nonzero i
#ifdef MBS_SUPPORT
/* These variables are used only if (MB_CUR_MAX > 1). */
static mbstate_t mbs; /* Mbstate for mbrlen(). */
-static int cur_mb_len; /* Byte length of the current scanning
+static ssize_t cur_mb_len; /* Byte length of the current scanning
multibyte character. */
-static int cur_mb_index; /* Byte index of the current scanning multibyte
+static ssize_t cur_mb_index; /* Byte index of the current scanning multibyte
character.
singlebyte character : cur_mb_index = 0
@@ -369,7 +369,7 @@ static unsigned char const *buf_end; /*
/* This function update cur_mb_len, and cur_mb_index.
p points current lexptr, len is the remaining buffer length. */
static void
-update_mb_len_index (unsigned char const *p, int len)
+update_mb_len_index (unsigned char const *p, size_t len)
{
/* If last character is a part of a multibyte character,
we update cur_mb_index. */
@@ -484,7 +484,8 @@ parse_bracket_exp_mb ()
work_mbc->nchars = work_mbc->nranges = work_mbc->nch_classes = 0;
work_mbc->nequivs = work_mbc->ncoll_elems = 0;
- work_mbc->chars = work_mbc->ch_classes = NULL;
+ work_mbc->chars = NULL;
+ work_mbc->ch_classes = NULL;
work_mbc->range_sts = work_mbc->range_ends = NULL;
work_mbc->equivs = work_mbc->coll_elems = NULL;
@@ -553,7 +554,7 @@ parse_bracket_exp_mb ()
wt = wctype (str);
if (ch_classes_al == 0)
- MALLOC(work_mbc->ch_classes, wchar_t, ++ch_classes_al);
+ MALLOC(work_mbc->ch_classes, wctype_t, ++ch_classes_al);
REALLOC_IF_NECESSARY(work_mbc->ch_classes, wctype_t,
ch_classes_al,
work_mbc->nch_classes + 1);
@@ -2465,7 +2466,7 @@ match_mb_charset (struct dfa *d, int s,
int match; /* Flag which represent that matching succeed. */
int match_len; /* Length of the character (or collating element)
with which this operator match. */
- int op_len; /* Length of the operator. */
+ size_t op_len; /* Length of the operator. */
char buffer[128];
wchar_t wcbuf[6];
Index: src/external/gpl2/grep/dist/src/grep.c
diff -u src/external/gpl2/grep/dist/src/grep.c:1.1.1.1 src/external/gpl2/grep/dist/src/grep.c:1.2
--- src/external/gpl2/grep/dist/src/grep.c:1.1.1.1 Sun Jan 10 16:36:20 2016
+++ src/external/gpl2/grep/dist/src/grep.c Sun Jan 10 17:16:40 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: grep.c,v 1.1.1.1 2016/01/10 21:36:20 christos Exp $ */
+/* $NetBSD: grep.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
/* grep.c - main driver file for grep.
Copyright 1992, 1997-1999, 2000 Free Software Foundation, Inc.
@@ -53,6 +53,13 @@ struct stats
struct stat stat;
};
+#include <limits.h>
+#define MAX_OFF_T (sizeof(off_t) == sizeof(char) ? INT_MAX : \
+ (sizeof(off_t) == sizeof(short) ? SHRT_MAX : \
+ (sizeof(off_t) == sizeof(int) ? INT_MAX : \
+ (sizeof(off_t) == sizeof(long) ? LONG_MAX : \
+ (sizeof(off_t) == sizeof(long long) ? LLONG_MAX : INTMAX_MAX)))))
+
/* base of chain of stat buffers, used to detect directory loops */
static struct stats stats_base;
@@ -204,7 +211,7 @@ context_length_arg (char const *str, int
&& 0 <= (*out = value)
&& *out == value))
{
- error (2, 0, "%s: %s\n", str, _("invalid context length argument"));
+ error (2, 0, "%s: %s", str, _("invalid context length argument"));
}
}
@@ -542,7 +549,10 @@ prline (char const *beg, char const *lim
if (b == lim)
break;
if (match_size == 0)
- break;
+ {
+ beg++;
+ continue;
+ }
if(color_option)
printf("\33[%sm", grep_color);
fwrite(b, sizeof (char), match_size, stdout);
@@ -998,7 +1008,7 @@ grepdir (char const *dir, struct stats c
&& ancestor->stat.st_dev == stats->stat.st_dev)
{
if (!suppress_errors)
- error (0, 0, _("warning: %s: %s\n"), dir,
+ error (0, 0, _("warning: %s: %s"), dir,
_("recursive directory loop"));
return 1;
}
@@ -1063,8 +1073,11 @@ Regexp selection and interpretation:\n")
printf (_("\
-E, --extended-regexp PATTERN is an extended regular expression\n\
-F, --fixed-strings PATTERN is a set of newline-separated strings\n\
- -G, --basic-regexp PATTERN is a basic regular expression\n\
+ -G, --basic-regexp PATTERN is a basic regular expression\n"));
+#if HAVE_LIBPCRE
+ printf (_("\
-P, --perl-regexp PATTERN is a Perl regular expression\n"));
+#endif
printf (_("\
-e, --regexp=PATTERN use PATTERN as a regular expression\n\
-f, --file=FILE obtain PATTERN from FILE\n\
@@ -1283,13 +1296,16 @@ int
main (int argc, char **argv)
{
char *keys;
- size_t keycc, oldcc, keyalloc;
+ size_t cc, keycc, oldcc, keyalloc;
int with_filenames;
- int opt, cc, status;
+ int opt, status;
int default_context;
FILE *fp;
extern char *optarg;
extern int optind;
+#ifdef __NetBSD__
+ extern char *__progname;
+#endif
initialize_main (&argc, &argv);
program_name = argv[0];
@@ -1332,7 +1348,7 @@ main (int argc, char **argv)
eolbyte = '\n';
filename_mask = ~0;
- max_count = TYPE_MAXIMUM (off_t);
+ max_count = MAX_OFF_T;
/* The value -1 means to use DEFAULT_CONTEXT. */
out_after = out_before = -1;
@@ -1507,7 +1523,7 @@ main (int argc, char **argv)
break;
/* Fall through. */
case LONGINT_OVERFLOW:
- max_count = TYPE_MAXIMUM (off_t);
+ max_count = MAX_OFF_T;
break;
default:
@@ -1657,7 +1673,11 @@ main (int argc, char **argv)
}
if (! matcher)
+#ifdef __NetBSD__
+ matcher = __progname;
+#else
matcher = "grep";
+#endif
if (show_version)
{
@@ -1736,7 +1756,12 @@ warranty; not even for MERCHANTABILITY o
while ( ++optind < argc);
}
else
- status = grepfile ((char *) NULL, &stats_base);
+ {
+ if (directories == RECURSE_DIRECTORIES) {
+ error (0, 0, _("warning: recursive search of stdin"));
+ }
+ status = grepfile ((char *) NULL, &stats_base);
+ }
/* We register via atexit() to test stdout. */
exit (errseen ? 2 : status);
Index: src/external/gpl2/grep/dist/src/search.c
diff -u src/external/gpl2/grep/dist/src/search.c:1.1.1.1 src/external/gpl2/grep/dist/src/search.c:1.2
--- src/external/gpl2/grep/dist/src/search.c:1.1.1.1 Sun Jan 10 16:36:21 2016
+++ src/external/gpl2/grep/dist/src/search.c Sun Jan 10 17:16:40 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: search.c,v 1.1.1.1 2016/01/10 21:36:21 christos Exp $ */
+/* $NetBSD: search.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
/* search.c - searching subroutines using dfa, kwset and regex for grep.
Copyright 1992, 1998, 2000 Free Software Foundation, Inc.
@@ -24,7 +24,7 @@
# include <config.h>
#endif
#include <sys/types.h>
-#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC
+#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC && defined HAVE_WCTYPE
/* We can handle multibyte string. */
# define MBS_SUPPORT
# include <wchar.h>
@@ -153,7 +153,7 @@ check_multibyte_string(char const *buf,
{
char *mb_properties = malloc(size);
mbstate_t cur_state;
- int i;
+ size_t i;
memset(&cur_state, 0, sizeof(mbstate_t));
memset(mb_properties, 0, sizeof(char)*size);
for (i = 0; i < size ;)
@@ -339,7 +339,8 @@ EGexecute (char const *buf, size_t size,
{
register char const *buflim, *beg, *end;
char eol = eolbyte;
- int backref, start, len;
+ int backref;
+ ptrdiff_t start, len;
struct kwsmatch kwsm;
size_t i;
#ifdef MBS_SUPPORT
@@ -362,13 +363,7 @@ EGexecute (char const *buf, size_t size,
/* Find a possible match using the KWset matcher. */
size_t offset = kwsexec (kwset, beg, buflim - beg, &kwsm);
if (offset == (size_t) -1)
- {
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free(mb_properties);
-#endif
- return (size_t)-1;
- }
+ goto failure;
beg += offset;
/* Narrow down to the line containing the candidate, and
run it through DFA. */
@@ -381,7 +376,7 @@ EGexecute (char const *buf, size_t size,
while (beg > buf && beg[-1] != eol)
--beg;
if (kwsm.index < kwset_exact_matches)
- goto success;
+ goto success_in_beg_and_end;
if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
continue;
}
@@ -400,7 +395,7 @@ EGexecute (char const *buf, size_t size,
}
/* Successful, no backreferences encountered! */
if (!backref)
- goto success;
+ goto success_in_beg_and_end;
}
else
end = beg + size;
@@ -415,14 +410,11 @@ EGexecute (char const *buf, size_t size,
end - beg - 1, &(patterns[i].regs))))
{
len = patterns[i].regs.end[0] - start;
- if (exact)
- {
- *match_size = len;
- return start;
- }
+ if (exact && !match_words)
+ goto success_in_start_and_len;
if ((!match_lines && !match_words)
|| (match_lines && len == end - beg - 1))
- goto success;
+ goto success_in_beg_and_end;
/* If -w, check if the match aligns with word boundaries.
We do this iteratively because:
(a) the line may contain more than one occurence of the
@@ -436,7 +428,7 @@ EGexecute (char const *buf, size_t size,
if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1]))
&& (len == end - beg - 1
|| !WCHAR ((unsigned char) beg[start + len])))
- goto success;
+ goto success_in_start_and_len;
if (len > 0)
{
/* Try a shorter length anchored at the same place. */
@@ -463,19 +455,26 @@ EGexecute (char const *buf, size_t size,
}
} /* for Regex patterns. */
} /* for (beg = end ..) */
+
+ failure:
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1 && mb_properties)
free (mb_properties);
#endif /* MBS_SUPPORT */
return (size_t) -1;
- success:
+ success_in_beg_and_end:
+ len = end - beg;
+ start = beg - buf;
+ /* FALLTHROUGH */
+
+ success_in_start_and_len:
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1 && mb_properties)
free (mb_properties);
#endif /* MBS_SUPPORT */
- *match_size = end - beg;
- return beg - buf;
+ *match_size = len;
+ return start;
}
static void
@@ -518,28 +517,15 @@ Fexecute (char const *buf, size_t size,
{
size_t offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch);
if (offset == (size_t) -1)
- {
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free(mb_properties);
-#endif /* MBS_SUPPORT */
- return offset;
- }
+ goto failure;
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0)
continue; /* It is a part of multibyte character. */
#endif /* MBS_SUPPORT */
beg += offset;
len = kwsmatch.size[0];
- if (exact)
- {
- *match_size = len;
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free (mb_properties);
-#endif /* MBS_SUPPORT */
- return beg - buf;
- }
+ if (exact && !match_words)
+ goto success_in_beg_and_len;
if (match_lines)
{
if (beg > buf && beg[-1] != eol)
@@ -549,31 +535,37 @@ Fexecute (char const *buf, size_t size,
goto success;
}
else if (match_words)
- for (try = beg; len; )
- {
- if (try > buf && WCHAR((unsigned char) try[-1]))
- break;
- if (try + len < buf + size && WCHAR((unsigned char) try[len]))
- {
- offset = kwsexec (kwset, beg, --len, &kwsmatch);
- if (offset == (size_t) -1)
- {
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free (mb_properties);
-#endif /* MBS_SUPPORT */
- return offset;
- }
- try = beg + offset;
- len = kwsmatch.size[0];
- }
- else
- goto success;
- }
+ {
+ while (offset >= 0)
+ {
+ if ((offset == 0 || !WCHAR ((unsigned char) beg[-1]))
+ && (len == end - beg - 1 || !WCHAR ((unsigned char) beg[len])))
+ {
+ if (!exact)
+ /* Returns the whole line now we know there's a word match. */
+ goto success;
+ else
+ /* Returns just this word match. */
+ goto success_in_beg_and_len;
+ }
+ if (len > 0)
+ {
+ /* Try a shorter length anchored at the same place. */
+ --len;
+ offset = kwsexec (kwset, beg, len, &kwsmatch);
+ if (offset == -1) {
+ break; /* Try a different anchor. */
+ }
+ beg += offset;
+ len = kwsmatch.size[0];
+ }
+ }
+ }
else
goto success;
}
+ failure:
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
free (mb_properties);
@@ -585,7 +577,11 @@ Fexecute (char const *buf, size_t size,
end++;
while (buf < beg && beg[-1] != eol)
--beg;
- *match_size = end - beg;
+ len = end - beg;
+ /* FALLTHROUGH */
+
+ success_in_beg_and_len:
+ *match_size = len;
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
free (mb_properties);
Added files:
Index: src/external/gpl2/grep/Makefile
diff -u /dev/null src/external/gpl2/grep/Makefile:1.1
--- /dev/null Sun Jan 10 17:16:40 2016
+++ src/external/gpl2/grep/Makefile Sun Jan 10 17:16:40 2016
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile,v 1.1 2016/01/10 22:16:40 christos Exp $
+
+SUBDIR= lib .WAIT bin
+
+.include <bsd.subdir.mk>
Index: src/external/gpl2/grep/Makefile.inc
diff -u /dev/null src/external/gpl2/grep/Makefile.inc:1.1
--- /dev/null Sun Jan 10 17:16:40 2016
+++ src/external/gpl2/grep/Makefile.inc Sun Jan 10 17:16:40 2016
@@ -0,0 +1,19 @@
+# $NetBSD: Makefile.inc,v 1.1 2016/01/10 22:16:40 christos Exp $
+
+.include <bsd.own.mk>
+
+WARNS= 0
+
+IDIST= ${NETBSDSRCDIR}/external/gpl2/grep/dist
+
+CPPFLAGS+= -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H \
+ -I${.CURDIR}/../include -I${IDIST}/lib -I${IDIST}/src
+
+DOBJDIR!= cd $(.CURDIR)/../lib && ${PRINTOBJDIR}
+
+LIBGREPUTILS= ${DOBJDIR}/libgreputils.a
+BINDIR= /usr/bin
+
+.if exists(${.CURDIR}/../../Makefile.inc)
+.include "${.CURDIR}/../../Makefile.inc"
+.endif
Index: src/external/gpl2/grep/grep2netbsd
diff -u /dev/null src/external/gpl2/grep/grep2netbsd:1.1
--- /dev/null Sun Jan 10 17:16:40 2016
+++ src/external/gpl2/grep/grep2netbsd Sun Jan 10 17:16:40 2016
@@ -0,0 +1,74 @@
+#! /bin/sh
+#
+# $NetBSD: grep2netbsd,v 1.1 2016/01/10 22:16:40 christos Exp $
+#
+# Copyright (c) 2003 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# grep2netbsd: convert an grep source tree into a
+# format suitable for commit. Works on current dir.
+#
+
+# delete some superfluous files
+echo deleting some superfluous files
+rm -rf bootstrap djgpp m4 tests vms autom4te-2.53.cache
+find . -type f -name .cvsignore -exec rm {} \;
+
+echo done
+
+### Remove the $'s around RCS tags
+cleantags .
+
+### Add our NetBSD RCS Id
+find . -type f -name '*.[chly]' -print | while read c; do
+ sed 1q < $c | grep -q '\$NetBSD' || (
+echo "/* \$NetBSD\$ */" >/tmp/grep3$$
+echo "" >>/tmp/grep3$$
+cat $c >> /tmp/grep3$$
+mv /tmp/grep3$$ $c && echo added NetBSD RCS tag to $c
+ )
+done
+
+find . -type f -name '*.[0-9]' -print | while read m; do
+ sed 1q < $m | grep -q '\$NetBSD' || (
+echo ".\\\" \$NetBSD\$" >/tmp/grep4$$
+echo ".\\\"" >>/tmp/grep4$$
+cat $m >> /tmp/grep4$$
+mv /tmp/grep4$$ $m && echo added NetBSD RCS tag to $m
+ )
+done
+
+find . -type f -name '*.texi' -print | while read t; do
+ sed "2 s/^/@c \$NetBSD\$\\
+/" < $t > /tmp/grep5$$
+ mv /tmp/grep5$$ $t && echo added NetBSD RCS tag to $t
+done
+
+echo done
+
+cat << EOF
+To import:
+cvs -d cvs.netbsd.org:/cvsroot import src/external/gpl2/grep/dist FSF grep-X-Y
+EOF
+exit 0
Index: src/external/gpl2/grep/bin/Makefile
diff -u /dev/null src/external/gpl2/grep/bin/Makefile:1.1
--- /dev/null Sun Jan 10 17:16:40 2016
+++ src/external/gpl2/grep/bin/Makefile Sun Jan 10 17:16:40 2016
@@ -0,0 +1,42 @@
+# $NetBSD: Makefile,v 1.1 2016/01/10 22:16:40 christos Exp $
+
+.include "${.CURDIR}/../Makefile.inc"
+
+DIST= ${IDIST}/src
+.PATH: ${DIST} ${IDIST}/doc ${IDIST}/man ${.CURDIR}/../po
+
+PROG= grep
+SRCS= grep.c dfa.c kwset.c search.c grepmat.c
+
+CWARNFLAGS.clang+= -Wno-format-security -Wno-tautological-compare
+
+.ifndef HOSTPROG
+DPADD+= ${LIBGREPUTILS} ${LIBINTL}
+LDADD+= ${LIBGREPUTILS} -lintl
+.else
+.PATH: ${IDIST}/lib
+SRCS+= closeout.c error.c exclude.c hard-locale.c isdir.c \
+ obstack.c quotearg.c regex.c savedir.c stpcpy.c \
+ xmalloc.c xstrtol.c xstrtoumax.c
+.endif
+
+INFOFLAGS= -I${IDIST}/doc -I${.CURDIR}/../include
+TEXINFO= grep.texi
+
+LINKS= ${BINDIR}/grep ${BINDIR}/egrep \
+ ${BINDIR}/grep ${BINDIR}/fgrep
+MLINKS= grep.1 egrep.1 \
+ grep.1 fgrep.1
+
+.if !defined(HOSTPROG) && ${MKNLS} != "no"
+.for F in cs.gmo de.gmo el.gmo eo.gmo es.gmo et.gmo fr.gmo gl.gmo hr.gmo \
+ id.gmo it.gmo ja.gmo ko.gmo nl.gmo no.gmo pl.gmo pt_BR.gmo ru.gmo \
+ sl.gmo sv.gmo
+FILES+= ${F}
+FILESDIR_${F}= /usr/share/locale/${F:.gmo=}/LC_MESSAGES
+FILESNAME_${F}= grep.mo
+.endfor
+.endif
+
+.include <bsd.info.mk>
+.include <bsd.prog.mk>
Index: src/external/gpl2/grep/include/config.h
diff -u /dev/null src/external/gpl2/grep/include/config.h:1.1
--- /dev/null Sun Jan 10 17:16:40 2016
+++ src/external/gpl2/grep/include/config.h Sun Jan 10 17:16:40 2016
@@ -0,0 +1,341 @@
+/* config.h. Generated by configure. */
+/* config.hin. Generated from configure.in by autoheader. */
+
+/* Define to 1 if the `closedir' function returns void instead of `int'. */
+/* #undef CLOSEDIR_VOID */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+#define ENABLE_NLS 1
+
+/* We are building grep */
+#define GREP 1
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define to 1 if you have the <argz.h> header file. */
+/* #undef HAVE_ARGZ_H */
+
+/* Define to 1 if you have the `atexit' function. */
+#define HAVE_ATEXIT 1
+
+/* Define to 1 if you have the `btowc' function. */
+#define HAVE_BTOWC 1
+
+/* Define to 1 if you have the `dcgettext' function. */
+#define HAVE_DCGETTEXT 1
+
+/* Define to 1 if strerror_r is declared. */
+#define HAVE_DECL_STRERROR_R 1
+
+/* Define if <stdlib.h> declares strtoul. */
+#define HAVE_DECL_STRTOUL 1
+
+/* Define if <stdlib.h> declares strtoull. */
+#define HAVE_DECL_STRTOULL 1
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#define HAVE_DIRENT_H 1
+
+/* Define if the malloc check has been performed. */
+#define HAVE_DONE_WORKING_MALLOC_CHECK 1
+
+/* Define if the realloc check has been performed. */
+#define HAVE_DONE_WORKING_REALLOC_CHECK 1
+
+/* Define to 1 if you have the `doprnt' function. */
+/* #undef HAVE_DOPRNT */
+
+/* Define if text file lines end in CRLF. */
+/* #undef HAVE_DOS_FILE_CONTENTS */
+
+/* Define if your OS uses backslashes as directory separators */
+/* #undef HAVE_DOS_FILE_NAMES */
+
+/* Define to 1 if you have the `feof_unlocked' function. */
+/* #undef HAVE_FEOF_UNLOCKED */
+
+/* Define to 1 if you have the `fgets_unlocked' function. */
+/* #undef HAVE_FGETS_UNLOCKED */
+
+/* Define to 1 if you have the `fnmatch' function. */
+#define HAVE_FNMATCH 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `getegid' function. */
+#define HAVE_GETEGID 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#define HAVE_GETEUID 1
+
+/* Define to 1 if you have the `getgid' function. */
+#define HAVE_GETGID 1
+
+/* Define to 1 if you have the `getpagesize' function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#define HAVE_GETTEXT 1
+
+/* Define to 1 if you have the `getuid' function. */
+#define HAVE_GETUID 1
+
+/* Define if you have the iconv() function. */
+#define HAVE_ICONV 1
+
+/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
+ declares uintmax_t. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isascii' function. */
+#define HAVE_ISASCII 1
+
+/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
+#define HAVE_LANGINFO_CODESET 1
+
+/* Define if your <locale.h> file defines LC_MESSAGES. */
+#define HAVE_LC_MESSAGES 1
+
+/* Define to 1 if you have the <libintl.h> header file. */
+#define HAVE_LIBINTL_H 1
+
+/* Define to 1 if you have the `pcre' library (-lpcre). */
+/* #undef HAVE_LIBPCRE */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define to 1 if you have the `mbrtowc' function. */
+#define HAVE_MBRTOWC 1
+
+/* Define to 1 if you have the `memchr' function. */
+#define HAVE_MEMCHR 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mempcpy' function. */
+/* #undef HAVE_MEMPCPY */
+
+/* Define to 1 if you have a working `mmap' system call. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `munmap' function. */
+#define HAVE_MUNMAP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <nl_types.h> header file. */
+#define HAVE_NL_TYPES_H 1
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the `setmode' function. */
+#define HAVE_SETMODE 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `stpcpy' function. */
+#define HAVE_STPCPY 1
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+#define HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtoul' function. */
+#define HAVE_STRTOUL 1
+
+/* Define to 1 if you have the `strtoull' function. */
+/* #undef HAVE_STRTOULL */
+
+/* Define to 1 if you have the `strtoumax' function. */
+#define HAVE_STRTOUMAX 1
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `tsearch' function. */
+#define HAVE_TSEARCH 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the unsigned long long type. */
+#define HAVE_UNSIGNED_LONG_LONG 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define to 1 if you have the `wctype' function. */
+#define HAVE_WCTYPE 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define to 1 if strerror_r returns a string. */
+/* #undef HAVE_WORKING_STRERROR_R */
+
+/* Define to 1 if you have the `__argz_count' function. */
+/* #undef HAVE___ARGZ_COUNT */
+
+/* Define to 1 if you have the `__argz_next' function. */
+/* #undef HAVE___ARGZ_NEXT */
+
+/* Define to 1 if you have the `__argz_stringify' function. */
+/* #undef HAVE___ARGZ_STRINGIFY */
+
+/* Define as const if the declaration of iconv() needs const. */
+#define ICONV_CONST const
+
+/* Name of package */
+#define PACKAGE "grep"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define if compiler has function prototypes */
+#define PROTOTYPES 1
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "2.5.1a nb1"
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to make fseeko etc. visible, on some hosts. */
+/* #undef _LARGEFILE_SOURCE */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define if your compiler is broken */
+/* #undef alloca */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+ if it is not supported. */
+/* #undef inline */
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
+
+/* Define to a type if <wchar.h> does not define. */
+/* #undef mbstate_t */
+
+/* Define to `long' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to rpl_realloc if the replacement function should be used. */
+/* #undef realloc */
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to unsigned long or unsigned long long if <inttypes.h> doesn't
+ define. */
+/* #undef uintmax_t */
Index: src/external/gpl2/grep/lib/Makefile
diff -u /dev/null src/external/gpl2/grep/lib/Makefile:1.1
--- /dev/null Sun Jan 10 17:16:40 2016
+++ src/external/gpl2/grep/lib/Makefile Sun Jan 10 17:16:40 2016
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.1 2016/01/10 22:16:40 christos Exp $
+
+LIBISPRIVATE= yes
+
+.include "${.CURDIR}/../Makefile.inc"
+
+LIB= greputils
+
+DIST= ${IDIST}/lib
+.PATH: ${DIST}
+
+SRCS= closeout.c error.c exclude.c hard-locale.c isdir.c \
+ obstack.c quotearg.c regex.c savedir.c stpcpy.c \
+ xmalloc.c xstrtol.c xstrtoumax.c
+
+COPTS.hard-locale.c = -Wno-stack-protector
+COPTS.regex.c = -Wno-stack-protector
+
+CWARNFLAGS.clang+= -Wno-unused-value
+
+.include <bsd.lib.mk>
Index: src/external/gpl2/grep/po/cs.gmo
Binary files are different
Index: src/external/gpl2/grep/po/de.gmo
Binary files are different
Index: src/external/gpl2/grep/po/el.gmo
Binary files are different
Index: src/external/gpl2/grep/po/eo.gmo
Binary files are different
Index: src/external/gpl2/grep/po/es.gmo
Binary files are different
Index: src/external/gpl2/grep/po/et.gmo
Binary files are different
Index: src/external/gpl2/grep/po/fr.gmo
Binary files are different
Index: src/external/gpl2/grep/po/gl.gmo
Binary files are different
Index: src/external/gpl2/grep/po/hr.gmo
Binary files are different
Index: src/external/gpl2/grep/po/id.gmo
Binary files are different
Index: src/external/gpl2/grep/po/it.gmo
Binary files are different
Index: src/external/gpl2/grep/po/ja.gmo
Binary files are different
Index: src/external/gpl2/grep/po/ko.gmo
Binary files are different
Index: src/external/gpl2/grep/po/nl.gmo
Binary files are different
Index: src/external/gpl2/grep/po/no.gmo
Binary files are different
Index: src/external/gpl2/grep/po/pl.gmo
Binary files are different
Index: src/external/gpl2/grep/po/pt_BR.gmo
Binary files are different
Index: src/external/gpl2/grep/po/ru.gmo
Binary files are different
Index: src/external/gpl2/grep/po/sl.gmo
Binary files are different
Index: src/external/gpl2/grep/po/sv.gmo
Binary files are different