[comp.unix.aix] That !%$@ 3-character buffer.

jpe@egr.duke.edu (John P. Eisenmenger) (11/21/90)

I'm having a problem with my RS6000 buffering input.  I compiled
Berkeley's vi (along with the "new" termcap library) and everything
works fine, *except* that input is buffered by three characters.  I
had seen this resolved before, but unfortunately didn't save the
posting.  Could someone please post some help (direct mail will be
accepted also)?

-John Eisenmenger			jpe@cameron.egr.duke.edu
 Dept. of Electrical Engineering	jpe@cs.duke.edu
 Duke University
 Durham, NC 27707

slk@clutx.clarkson.edu (Steve Knodle, ERC,,) (11/21/90)

From article <1190@cameron.egr.duke.edu>, by jpe@egr.duke.edu (John P. Eisenmenger):
> I'm having a problem with my RS6000 buffering input.  I compiled
> Berkeley's vi (along with the "new" termcap library) and everything
> works fine, *except* that input is buffered by three characters.  I
> had seen this resolved before, but unfortunately didn't save the
> posting.  Could someone please post some help (direct mail will be
> accepted also)?
> 
> -John Eisenmenger			jpe@cameron.egr.duke.edu
>  Dept. of Electrical Engineering	jpe@cs.duke.edu
>  Duke University
>  Durham, NC 27707

I hit similar problem porting Microemacs3.10 (heavily used here).
Termcap apparently requires tty bsd line discipline mode.

So a wrapper shell script works:

stty add bsd
/usr/local/bin/me.bin
stty del bsd

and the bsd line discipline is pushed and popped from the tty driver's stack.

This is not fully satisfactory since if a ptty is left in bsd mode,
if the next user rlogs in, the PASSWORD ECHOS. Be warned.  The login
program ought to reinitialize the tty line discipline.

gs26@prism.gatech.EDU (Glenn R. Stone) (11/22/90)

In <1190@cameron.egr.duke.edu> jpe@egr.duke.edu (John P. Eisenmenger) writes:

>I'm having a problem with my RS6000 buffering input.  I compiled
>Berkeley's vi (along with the "new" termcap library) and everything
>works fine, *except* that input is buffered by three characters.  I
>had seen this resolved before, but unfortunately didn't save the
>posting.  Could someone please post some help (direct mail will be
>accepted also)?

You've run headlong into the POSIX line discipline.  You need to
change "O_NDELAY" to "O_NONBLOCK" on your open statements, and
you also need to change the line discipline itself, with 
TXGETLD (get line discipline, to restore it later) and TXSETLD (set it)
ioctl() calls; you'll want to save the original discipline string in
a char var[TTNAMEMAX], and set the discipline to "bsd" (that's right,
TXSETLD takes a string).  Oh, yeah.  #include <sys/tty.h> instead of
<sgtty.h>; sys/tty.h does everything sgtty.h does (with #includes), and
also adds the stuff you need to change the discipline.  

I think everything else works, assuming you're using the bsdcc stanza
from /usr/lpp/bos/bsdport..... that's all I did (in that vein) to kermit,
and it seems to work ok.... I'll be glad to mail (or, if enough requests,
post) my kermit diffs so you can see exactly how it's done.... but
that's 160 lines of bandwidth I'm not going to use unless there's demand
for it....

-- Glenn R. Stone
gs26@prism.gatech.edu, glenns@eas.gatech.edu <--- the '6000
Earth and Atmospheric Sciences, Georgia Tech, Atlanta, GA 30332-0340
(404) 894-3890 M-F 1000-1700 EST