summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-02-29 13:42:26 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-02-29 13:43:00 +0000
commitf9c71e0714e1c2a0b7202ba08dc1012636e360c9 (patch)
tree4b743df8fe1de735345ad16af8f03cc25bbd8b7b
parent2ebdd848882a3c71f3e082e4182f414eec55b92e (diff)
downloadaports-f9c71e0714e1c2a0b7202ba08dc1012636e360c9.tar.bz2
aports-f9c71e0714e1c2a0b7202ba08dc1012636e360c9.tar.xz
main/busybox: backport grep -x support
util-vserver needs it
-rw-r--r--main/busybox/0001-grep-support-for-x-match-whole-line.patch68
-rw-r--r--main/busybox/APKBUILD4
2 files changed, 71 insertions, 1 deletions
diff --git a/main/busybox/0001-grep-support-for-x-match-whole-line.patch b/main/busybox/0001-grep-support-for-x-match-whole-line.patch
new file mode 100644
index 000000000..db8c4f2d9
--- /dev/null
+++ b/main/busybox/0001-grep-support-for-x-match-whole-line.patch
@@ -0,0 +1,68 @@
+From 7a526de36684e0c794c125d552931f59a91e445c Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 23 Feb 2012 14:08:45 +0000
+Subject: [PATCH] grep: support for -x, match whole line
+
+Specified in POSIX.
+http://pubs.opengroup.org/onlinepubs/009604499/utilities/grep.html
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ findutils/grep.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/findutils/grep.c b/findutils/grep.c
+index 5f42242..6125aca 100644
+--- a/findutils/grep.c
++++ b/findutils/grep.c
+@@ -85,6 +85,7 @@
+ //usage: "\n -r Recurse"
+ //usage: "\n -i Ignore case"
+ //usage: "\n -w Match whole words only"
++//usage: "\n -x Match whole lines only"
+ //usage: "\n -F PATTERN is a literal (not regexp)"
+ //usage: IF_FEATURE_GREP_EGREP_ALIAS(
+ //usage: "\n -E PATTERN is an extended regexp"
+@@ -113,7 +114,7 @@
+ //usage:#define fgrep_full_usage ""
+
+ #define OPTSTR_GREP \
+- "lnqvscFiHhe:f:Lorm:w" \
++ "lnqvscFiHhe:f:Lorm:wx" \
+ IF_FEATURE_GREP_CONTEXT("A:B:C:") \
+ IF_FEATURE_GREP_EGREP_ALIAS("E") \
+ IF_EXTRA_COMPAT("z") \
+@@ -138,6 +139,7 @@ enum {
+ OPTBIT_r, /* recurse dirs */
+ OPTBIT_m, /* -m MAX_MATCHES */
+ OPTBIT_w, /* -w whole word match */
++ OPTBIT_x, /* -x whole line match */
+ IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */
+ IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */
+ IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */
+@@ -160,6 +162,7 @@ enum {
+ OPT_r = 1 << OPTBIT_r,
+ OPT_m = 1 << OPTBIT_m,
+ OPT_w = 1 << OPTBIT_w,
++ OPT_x = 1 << OPTBIT_x,
+ OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0,
+ OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0,
+ OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0,
+@@ -370,9 +373,12 @@ static int grep_file(FILE *file)
+ &gl->matched_range) >= 0
+ #endif
+ ) {
+- if (!(option_mask32 & OPT_w))
++ if (option_mask32 & OPT_x) {
++ found = (gl->matched_range.rm_so == 0
++ && line[gl->matched_range.rm_eo] == 0);
++ } else if (!(option_mask32 & OPT_w)) {
+ found = 1;
+- else {
++ } else {
+ char c = ' ';
+ if (gl->matched_range.rm_so)
+ c = line[gl->matched_range.rm_so - 1];
+--
+1.7.9.2
+
diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD
index a0311abb6..460c753bb 100644
--- a/main/busybox/APKBUILD
+++ b/main/busybox/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.19.4
-pkgrel=0
+pkgrel=1
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
@@ -21,6 +21,7 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
acpid.patch
busybox-mkdir-permissions-64bit.patch
0001-acpid-do-not-install-handlers-for-fatal-signals.patch
+ 0001-grep-support-for-x-match-whole-line.patch
busyboxconfig"
@@ -92,4 +93,5 @@ b5375210f13fd6e1ca61a565e8fabd35 busybox-uname-is-not-gnu.patch
361a26d690e6f1585c6710b3afeb10a6 acpid.patch
78bb1e70897124a0e09d50c425210e83 busybox-mkdir-permissions-64bit.patch
cfafb917f777437f428ea97da0a63915 0001-acpid-do-not-install-handlers-for-fatal-signals.patch
+699701047d05468a13e5c37b5ebc3824 0001-grep-support-for-x-match-whole-line.patch
42e2f49483e650193c0e142ade7de142 busyboxconfig"