Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8098114c authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Sync with upstream grep."

parents 7a8420ec 04650ef7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@
/* We want chown to support user.group as well as user:group. */
#define SUPPORT_DOT

/* We don't localize /system/bin! */
#define WITHOUT_NLS

__BEGIN_DECLS

extern int uid_from_user(const char* name, uid_t* uid);
+5 −5
Original line number Diff line number Diff line
@@ -402,7 +402,7 @@ grep_main(int argc, char *argv[])
				Aflag = 0;
			else if (Aflag > LLONG_MAX / 10) {
				errno = ERANGE;
				err(2, "%llu", Aflag);
				err(2, NULL);
			}
			Aflag = Bflag = (Aflag * 10) + (c - '0');
			break;
@@ -419,10 +419,10 @@ grep_main(int argc, char *argv[])
			l = strtoull(optarg, &ep, 10);
			if (((errno == ERANGE) && (l == ULLONG_MAX)) ||
			    ((errno == EINVAL) && (l == 0)))
				err(2, "strtoull");
				err(2, NULL);
			else if (ep[0] != '\0') {
				errno = EINVAL;
				err(2, "empty");
				err(2, NULL);
			}
			if (c == 'A')
				Aflag = l;
@@ -508,10 +508,10 @@ grep_main(int argc, char *argv[])
			mcount = strtoull(optarg, &ep, 10);
			if (((errno == ERANGE) && (mcount == ULLONG_MAX)) ||
			    ((errno == EINVAL) && (mcount == 0)))
				err(2, "strtoull");
				err(2, NULL);
			else if (ep[0] != '\0') {
				errno = EINVAL;
				err(2, "empty");
				err(2, NULL);
			}
			break;
		case 'n':
+0 −4
Original line number Diff line number Diff line
@@ -29,10 +29,6 @@
 * SUCH DAMAGE.
 */

#ifdef ANDROID
#define WITHOUT_NLS
#endif

#ifndef ANDROID
#include <bzlib.h>
#endif
+11 −10
Original line number Diff line number Diff line
/*	$NetBSD: util.c,v 1.16 2012/05/06 22:32:05 joerg Exp $	*/
/*	$NetBSD: util.c,v 1.17 2013/01/21 03:24:43 msaitoh Exp $	*/
/*	$FreeBSD: head/usr.bin/grep/util.c 211496 2010-08-19 09:28:59Z des $	*/
/*	$OpenBSD: util.c,v 1.39 2010/07/02 22:18:03 tedu Exp $	*/

@@ -34,7 +34,7 @@
#endif

#include <sys/cdefs.h>
__RCSID("$NetBSD: util.c,v 1.16 2012/05/06 22:32:05 joerg Exp $");
__RCSID("$NetBSD: util.c,v 1.17 2013/01/21 03:24:43 msaitoh Exp $");

#include <sys/stat.h>
#include <sys/types.h>
@@ -74,9 +74,10 @@ file_matching(const char *fname)
	for (i = 0; i < fpatterns; ++i) {
		if (fnmatch(fpattern[i].pat, fname, 0) == 0 ||
		    fnmatch(fpattern[i].pat, fname_base, 0) == 0) {
			if (fpattern[i].mode == EXCL_PAT)
			if (fpattern[i].mode == EXCL_PAT) {
				free(fname_copy);
				return (false);
			else
			} else
				ret = true;
		}
	}
@@ -273,7 +274,7 @@ procfile(const char *fn)
	return (c);
}

#define iswword(x)	(iswalnum((wint_t)(x)) || (x) == L'_')
#define iswword(x)	(iswalnum((x)) || (x) == L'_')

/*
 * Processes a line comparing it with the specified patterns.  Each pattern
@@ -323,7 +324,7 @@ procline(struct str *l, int nottext)
				continue;
			/* Check for whole word match */
			if (fg_pattern[i].word && pmatch.rm_so != 0) {
				wchar_t wbegin, wend;
				wint_t wbegin, wend;

				wbegin = wend = L' ';
				if (pmatch.rm_so != 0 &&