diff options
author | Akinori MUSHA <knu@FreeBSD.org> | 2004-06-12 18:00:41 +0000 |
---|---|---|
committer | Akinori MUSHA <knu@FreeBSD.org> | 2004-06-12 18:00:41 +0000 |
commit | b97e1372378af5402d792691a7d5f10520664911 (patch) | |
tree | ba2bb10276c5874473c7601a61fa2a71815d99e2 /shells | |
parent | 3cedd6e4b9799f52b5a86c61796e08cef691d53f (diff) | |
download | ports-b97e1372378af5402d792691a7d5f10520664911.tar.gz ports-b97e1372378af5402d792691a7d5f10520664911.zip |
Fix a bug where a \ at EOL did not work as escape character.
Obtained from: [FDclone-users:00287]
Notes
Notes:
svn path=/head/; revision=111347
Diffstat (limited to 'shells')
-rw-r--r-- | shells/fd/Makefile | 1 | ||||
-rw-r--r-- | shells/fd/files/patch-pathname.c | 59 | ||||
-rw-r--r-- | shells/fd/files/patch-pathname.h | 10 | ||||
-rw-r--r-- | shells/fd/files/patch-system.c | 18 |
4 files changed, 88 insertions, 0 deletions
diff --git a/shells/fd/Makefile b/shells/fd/Makefile index 71fed2884bd7..6e6983007daf 100644 --- a/shells/fd/Makefile +++ b/shells/fd/Makefile @@ -7,6 +7,7 @@ PORTNAME= fd PORTVERSION= 2.05e +PORTREVISION= 1 CATEGORIES= shells MASTER_SITES= http://hp.vector.co.jp/authors/VA012337/soft/fd/ \ ftp://ftp.unixusers.net/src/fdclone/ diff --git a/shells/fd/files/patch-pathname.c b/shells/fd/files/patch-pathname.c new file mode 100644 index 000000000000..478740ca4e6a --- /dev/null +++ b/shells/fd/files/patch-pathname.c @@ -0,0 +1,59 @@ +--- pathname.c.orig Wed Jun 9 00:00:00 2004 ++++ pathname.c Sun Jun 13 01:48:43 2004 +@@ -141,7 +141,7 @@ + + static char *NEAR getenvvar __P_((char *, int)); + static int NEAR setvar __P_((char *, char *, int)); +-static int NEAR ismeta __P_((char *s, int, int, int)); ++static int NEAR ismeta __P_((char *s, int, int, int, int)); + #ifdef _NOORIGGLOB + static char *NEAR cnvregexp __P_((char *, int)); + #else +@@ -820,9 +820,9 @@ + return(s); + } + +-static int NEAR ismeta(s, ptr, quote, len) ++static int NEAR ismeta(s, ptr, quote, len, flags) + char *s; +-int ptr, quote, len; ++int ptr, quote, len, flags; + { + #ifdef FAKEMETA + return(0); +@@ -830,7 +830,7 @@ + if (s[ptr] != PMETA || quote == '\'') return(0); + + if (len >= 0) { +- if (ptr + 1 >= len) return(0); ++ if (!(flags & EA_EOLMETA) && ptr + 1 >= len) return(0); + # ifndef BASHSTYLE + /* bash does not treat "\" as \ */ + if (quote == '"' && s[ptr + 1] == quote && ptr + 2 >= len) +@@ -838,7 +838,7 @@ + # endif + } + else { +- if (!s[ptr + 1]) return(0); ++ if (!(flags & EA_EOLMETA) && !s[ptr + 1]) return(0); + # ifndef BASHSTYLE + /* bash does not treat "\" as \ */ + if (quote == '"' && s[ptr + 1] == quote && !s[ptr + 2]) +@@ -884,7 +884,7 @@ + re[j++] = s[i]; + continue; + } +- else if (ismeta(s, i, '\0', len)) { ++ else if (ismeta(s, i, '\0', len, 0)) { + re[j++] = s[i++]; + re[j++] = s[i]; + } +@@ -2183,7 +2183,7 @@ + #endif + else if (*qp == '\'') return(PC_SQUOTE); + else if (spc && *s == spc) return(*s); +- else if (ismeta(s, 0, *qp, len)) return(PC_META); ++ else if (ismeta(s, 0, *qp, len, flags)) return(PC_META); + #ifdef BASHSTYLE + /* bash can include `...` in "..." */ + else if ((flags & EA_BACKQ) && *s == '`') { diff --git a/shells/fd/files/patch-pathname.h b/shells/fd/files/patch-pathname.h new file mode 100644 index 000000000000..b5ff76f4ee07 --- /dev/null +++ b/shells/fd/files/patch-pathname.h @@ -0,0 +1,10 @@ +--- pathname.h.orig Wed Jun 9 00:00:00 2004 ++++ pathname.h Sun Jun 13 01:47:14 2004 +@@ -129,6 +129,7 @@ + #define EA_NOEVALQ 0010 + #define EA_STRIPQLATER 0020 + #define EA_NOUNIQDELIM 0040 ++#define EA_EOLMETA 0100 + + #ifdef NOUID_T + typedef u_short uid_t; diff --git a/shells/fd/files/patch-system.c b/shells/fd/files/patch-system.c new file mode 100644 index 000000000000..e6d4993981da --- /dev/null +++ b/shells/fd/files/patch-system.c @@ -0,0 +1,18 @@ +--- system.c.orig Wed Jun 9 00:00:00 2004 ++++ system.c Sun Jun 13 01:55:23 2004 +@@ -5795,11 +5795,12 @@ + } + } + +- pc = parsechar(&(s[i]), -1, ++ pc = parsechar(&(s[i]), -1, '$', EA_BACKQ | EA_EOLMETA, + #ifdef BASHSTYLE +- '$', EA_BACKQ, &(rp -> new), &(rp -> old)); ++ /* bash can include `...` in "..." */ ++ &(rp -> new), &(rp -> old)); + #else +- '$', EA_BACKQ, &(rp -> new), NULL); ++ &(rp -> new), NULL); + #endif + + if (pc == PC_OPQUOTE || pc == PC_CLQUOTE || pc == PC_SQUOTE) |