diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-03-11 10:00:38 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-03-11 10:00:38 +0000 |
commit | e9b11fa9f00cb061d8f92d469a12d47b6d230214 (patch) | |
tree | 85d649d9a332a20d50e8947c5b1c8eb4a4fac835 /Src/hist.c | |
parent | 9e1c419497c8b604174c4af5af90ebd8c3707a77 (diff) | |
download | zsh-e9b11fa9f00cb061d8f92d469a12d47b6d230214.tar.gz zsh-e9b11fa9f00cb061d8f92d469a12d47b6d230214.tar.xz zsh-e9b11fa9f00cb061d8f92d469a12d47b6d230214.zip |
unposted: make test for added space in 24699 safer
Diffstat (limited to 'Src/hist.c')
-rw-r--r-- | Src/hist.c | 8 |
1 files changed, 4 insertions, 4 deletions
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. |