summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2007-10-02 13:33:20 +0000
committerRoy Marples <uberlord@gentoo.org>2007-10-02 13:33:20 +0000
commit5b3018894e550c5edc0ea039a480c00b23ca548a (patch)
tree36f98ed80d24bb7d317d326737795cf95ce7ba52 /sys-freebsd
parentVersion bump, bug #194494 (diff)
downloadgentoo-2-5b3018894e550c5edc0ea039a480c00b23ca548a.tar.gz
gentoo-2-5b3018894e550c5edc0ea039a480c00b23ca548a.tar.bz2
gentoo-2-5b3018894e550c5edc0ea039a480c00b23ca548a.zip
support POSIX character class RE match for sh
(Portage version: 2.1.3.11)
Diffstat (limited to 'sys-freebsd')
-rw-r--r--sys-freebsd/freebsd-bin/ChangeLog6
-rw-r--r--sys-freebsd/freebsd-bin/files/freebsd-bin-6.2-sh-cclass.patch96
-rw-r--r--sys-freebsd/freebsd-bin/freebsd-bin-6.2.ebuild5
3 files changed, 104 insertions, 3 deletions
diff --git a/sys-freebsd/freebsd-bin/ChangeLog b/sys-freebsd/freebsd-bin/ChangeLog
index 180ce6a214e6..a5f97944208f 100644
--- a/sys-freebsd/freebsd-bin/ChangeLog
+++ b/sys-freebsd/freebsd-bin/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-freebsd/freebsd-bin
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-bin/ChangeLog,v 1.28 2007/05/18 16:47:49 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-bin/ChangeLog,v 1.29 2007/10/02 13:33:19 uberlord Exp $
+
+ 02 Oct 2007; Roy Marples <uberlord@gentoo.org>
+ +files/freebsd-bin-6.2-sh-cclass.patch, freebsd-bin-6.2.ebuild:
+ support POSIX character class RE match for sh
18 May 2007; Roy Marples <uberlord@gentoo.org>
+files/freebsd-bin-6.2-sh-libedit.patch, freebsd-bin-6.2.ebuild:
diff --git a/sys-freebsd/freebsd-bin/files/freebsd-bin-6.2-sh-cclass.patch b/sys-freebsd/freebsd-bin/files/freebsd-bin-6.2-sh-cclass.patch
new file mode 100644
index 000000000000..f3ed0744cf45
--- /dev/null
+++ b/sys-freebsd/freebsd-bin/files/freebsd-bin-6.2-sh-cclass.patch
@@ -0,0 +1,96 @@
+Allow sh to use POSIX character classes, as specified in
+sections 2.13.1 and 9.3.5
+
+diff -u a/sh/expand.c b/sh/expand.c
+--- a/sh/expand.c 2005-11-06 20:39:47 +0000
++++ b/sh/expand.c 2007-10-02 13:46:28 +0100
+@@ -1320,6 +1320,42 @@
+ }
+
+
++STATIC int ccmatch(char *p, int chr, char **r)
++{
++ static const struct class {
++ char name[10];
++ int (*fn)(int);
++ } classes[] = {
++ { .name = ":alnum:]", .fn = isalnum },
++ { .name = ":cntrl:]", .fn = iscntrl },
++ { .name = ":lower:]", .fn = islower },
++ { .name = ":space:]", .fn = isspace },
++ { .name = ":alpha:]", .fn = isalpha },
++ { .name = ":digit:]", .fn = isdigit },
++ { .name = ":print:]", .fn = isprint },
++ { .name = ":upper:]", .fn = isupper },
++ { .name = ":blank:]", .fn = isblank },
++ { .name = ":graph:]", .fn = isgraph },
++ { .name = ":punct:]", .fn = ispunct },
++ { .name = ":xdigit:]", .fn = isxdigit },
++ };
++ const struct class *class, *end;
++ char *q;
++
++ end = classes + sizeof(classes) / sizeof(classes[0]);
++ for (class = classes; class < end; class++) {
++ q = prefix(class->name, p);
++ if (!q)
++ continue;
++ *r = q;
++ return class->fn(chr);
++ }
++
++ *r = 0;
++ return 0;
++}
++
++
+ STATIC int
+ pmatch(char *pattern, char *string, int squoted)
+ {
+@@ -1405,6 +1441,15 @@
+ continue;
+ if (c == CTLESC)
+ c = *p++;
++ else if (c == '[') {
++ char *r;
++
++ found |= ccmatch(p, chr, &r);
++ if (r) {
++ p = r;
++ continue;
++ }
++ }
+ if (*p == '-' && p[1] != ']') {
+ p++;
+ while (*p == CTLQUOTEMARK)
+diff -u a/sh/mystring.c b/sh/mystring.c
+--- a/sh/mystring.c 2004-04-06 21:06:51 +0100
++++ b/sh/mystring.c 2007-10-02 13:45:31 +0100
+@@ -88,14 +88,14 @@
+ * prefix -- see if pfx is a prefix of string.
+ */
+
+-int
++char *
+ prefix(const char *pfx, const char *string)
+ {
+ while (*pfx) {
+ if (*pfx++ != *string++)
+ return 0;
+ }
+- return 1;
++ return (char *)string;
+ }
+
+
+diff -u a/sh/mystring.h b/sh/mystring.h
+--- a/sh/mystring.h 2004-04-06 21:06:51 +0100
++++ b/sh/mystring.h 2007-10-02 13:45:35 +0100
+@@ -36,7 +36,7 @@
+ #include <string.h>
+
+ void scopyn(const char *, char *, int);
+-int prefix(const char *, const char *);
++char *prefix(const char *, const char *);
+ int number(const char *);
+ int is_number(const char *);
diff --git a/sys-freebsd/freebsd-bin/freebsd-bin-6.2.ebuild b/sys-freebsd/freebsd-bin/freebsd-bin-6.2.ebuild
index 508c9d811b01..3af7d277d25d 100644
--- a/sys-freebsd/freebsd-bin/freebsd-bin-6.2.ebuild
+++ b/sys-freebsd/freebsd-bin/freebsd-bin-6.2.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-bin/freebsd-bin-6.2.ebuild,v 1.2 2007/05/18 16:47:49 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-bin/freebsd-bin-6.2.ebuild,v 1.3 2007/10/02 13:33:19 uberlord Exp $
inherit bsdmk freebsd
@@ -27,7 +27,8 @@ S=${WORKDIR}/bin
PATCHES="${FILESDIR}/${PN}-6.0-flex-2.5.31.patch
${FILESDIR}/${PN}-6.2-mkdir-posix.patch
- ${FILESDIR}/${PN}-6.2-sh-libedit.patch"
+ ${FILESDIR}/${PN}-6.2-sh-libedit.patch
+ ${FILESDIR}/${PN}-6.2-sh-cclass.patch"
pkg_setup() {
use nls || mymakeopts="${mymakeopts} NO_NLS= "