Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!torsqnt!jtsv16!itcyyz!yrloc!hui
From: hui@yrloc.ipsa.reuter.COM (Roger Hui)
Subject: Re: A bugfix for jgets
Message-ID: <1992Mar7.035543.18246@yrloc.ipsa.reuter.COM>
Keywords: J bug
Organization: Iverson Software Inc.
References: <1992Mar4.055403.12697@apollo.hp.com>
Date: Sat, 7 Mar 92 03:55:43 GMT

In article <1992Mar4.055403.12697@apollo.hp.com> keil@apollo.hp.com (Mark Keil) writes:
> The problem is that in a small number of cases the byte just before s
> can be 0x04. (^d) 
> It only shows up when just a return is entered. In this case the
> character at s+n (s+1) gets zeroed, and n decremented to 0. Then when
> the ^d check is done, the byte at s+0-1 is checked, and is sometimes 0x04.
> I added a check for n>0 and it fixed the problem.

Thanks for pointing out the bug.  I'll fix it.

> I also note that a ^d at the end of a line of input text will cause
> termination without execution of the last input text. I will leave it to
> Roger to decide what to do about that case.

This one is a feature and not a bug.

> I made the following change.
>
>96c96
><  if(CCTRLD==*(s+n-1))joff();
>---
>>  if((n>0)&&(CCTRLD==*(s+n-1)))joff();

I myself would put it thus:

    if(n&&CTRLD==*(s+n-1))joff();

------------------------------------
Roger Hui, Iverson Software Inc., 33 Major Street, Toronto, Ontario  M5S 2K9
Phone: (416) 925 6096;  Fax: (416) 488 7559
