Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: input.c and here documents bugfixes
- X-seq: zsh-workers 398
- From: hzoli@xxxxxxxxxx (Zoltan Hidvegi)
- To: schaefer@xxxxxxxxxx
- Subject: Re: input.c and here documents bugfixes
- Date: Fri, 22 Sep 1995 18:09:11 +0200 (MET DST)
- In-reply-to: <950921110903.ZM9297@xxxxxxxxxxxxxxxxx> from "Barton E. Schaefer" at Sep 21, 95 11:09:02 am
- Sender: hzoli@xxxxxxxxxx
Barton E. Schaefer wrote:
>
> I think Zoltan's input.c patch was incorrect. The exec.c part of the
> patch is OK. Here's the relevant bit:
>
-- patch deleted ---
Sorry, I forgot the semicolon at the end. The patch below should be correct.
The problem with the original file is that is can exit from the for loop on
two conditions. If it exits when the buffer is filled up, the l counter is
one more than otherwise.
Zoltan
*** 1.2 1995/09/19 17:57:52
--- input.c 1995/09/22 14:59:56
***************
*** 274,283 ****
{
int l;
! for (l = 0; l < n - 1; l++)
! if ((buf[l] = ingetc()) == '\n' || lexstop)
! break;
! buf[l + (lexstop ? 0 : 1)] = 0;
return (!lexstop || l) ? buf : NULL;
}
--- 274,283 ----
{
int l;
! for (l = 0; l < n - 1 && (buf[l++] = ingetc()) != '\n' && !lexstop;);
! if (lexstop)
! l--;
! buf[l] = '\0';
return (!lexstop || l) ? buf : NULL;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author