summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/hist.c8
-rw-r--r--Test/D04parameter.ztst2
3 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 2323d62c9..c8b152cbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-11 Peter Stephenson <pws@csr.com>
+
+ * unposted: Src/hist.c: make test in 24699 for the extra
+ space safer.
+
2008-03-09 Clint Adams <clint@zsh.org>
* 24701, 24702: Completion/Unix/Command/_git: use $service instead of
diff --git a/Src/hist.c b/Src/hist.c
index 806bd9be3..a19c94818 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2479,7 +2479,7 @@ bufferwords(LinkList list, char *buf, int *index)
*/
addedspaceptr = p + l;
*addedspaceptr = ' ';
- p[l + 1] = '\0';
+ addedspaceptr[1] = '\0';
inpush(p, 0, NULL);
zlemetall = strlen(p) ;
zlemetacs = zlemetall + 1;
@@ -2503,7 +2503,7 @@ bufferwords(LinkList list, char *buf, int *index)
memcpy(p + (hptr - chline), linein, ll);
addedspaceptr = p + (hptr - chline) + ll;
*addedspaceptr = ' ';
- p[(hptr - chline) + zlemetall] = '\0';
+ addedspaceptr[1] = '\0';
inpush(p, 0, NULL);
/*
@@ -2536,11 +2536,11 @@ bufferwords(LinkList list, char *buf, int *index)
break;
if (tokstr && *tokstr) {
untokenize((p = dupstring(tokstr)));
- if (ingetptr() > addedspaceptr) {
+ if (ingetptr() == addedspaceptr + 1) {
/*
* Whoops, we've read past the space we added, probably
* because we were expecting a terminator but when
- * it didn't turn up and shrugged our shoulders thinking
+ * it didn't turn up we shrugged our shoulders thinking
* it might as well be a complete string anyway.
* So remove the space. C.f. below for the case
* where the missing terminator caused a lex error.
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 57b87d687..79aecb6c3 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -336,7 +336,7 @@
# The following may look a bit random.
# For the split we are checking that anything that
# would normally be followed by a different word has
- # an argument break after it and anything that doesn't doesn't.
+ # an argument break after it and anything that wouldn't doesn't.
# For the (Q) we are simply checking that nothing disappears
# in the parsing.
foo='<five> {six} (seven) >eight< }nine{ |forty-two| $many$ )ten( more'