[comp.unix.xenix] scrip + history = cmdline history ??????

larry@tapa.UUCP (Larry Pajakowski) (06/02/89)

We have several DOS users who would probably convert to Xenix for development
except they loose the ability to have a command line editor such as NDE inside
of the integrated 4GL environment we use.  [I miss DOS NDE or history  also.]

Script seems to have all the hooks necessary for such an effort and works well
under Xenix-386 except for one problem I can't figure a way around.  The
application (Zim if your interested) uses both cooked and raw modes.  

Under DOS this is easy to handle since the application uses DOS i/o for cooked
and BIOS and/or direct screen write for raw i/o.  Xenix/Unix on the other hand
uses ioctl calls to do this.  How could a program like script which uses pty's
figure out when to buffer keystrokes for the cooked input or get out of the
way for the raw input?

Any suggetions would be appreciated and of course I would be happy to share
anything useful which may come of this with this group.

TNX

Larry Pajakowski
...ddsw1!tapa!larry

shepperd@dms.UUCP (Dave Shepperd) (06/05/89)

From article <614@tapa.UUCP>, by larry@tapa.UUCP (Larry Pajakowski):
> 
> Under DOS this is easy to handle since the application uses DOS i/o for cooked
> and BIOS and/or direct screen write for raw i/o.  Xenix/Unix on the other hand
> uses ioctl calls to do this.  How could a program like script which uses pty's
> figure out when to buffer keystrokes for the cooked input or get out of the
> way for the raw input?
> 

I've written a command line editor with history as a line discipline which
makes it application independent. The line discipline is what does the
"cooking" of keyboard input. What the disciplines do to distinguish cooked
and raw modes is to inspect the flags in the tty structure. If certain bits
are set, then it assumes cooked mode. If certain bits are clear, it assumes
raw mode and steps aside. The same line discipline routines are used by
"real" terminal drivers as well as pseudo terminal drivers. This technique,
easy to do in kernel code, my be somewhat difficult to use in a user
program, but not impossible. It would require an ioctl to get the tty stats
at various places and times which might bring your system to its knees.


-- 

Dave Shepperd.	    shepperd@dms.UUCP or weitek!dms!shepperd
Atari Games Corporation, Sycamore Drive, Milpitas CA 95035.
(Arcade Video Game Manufacturer, NOT Atari Corp. ST manufacturer).

davidsen@sungod.crd.ge.com (William Davidsen) (06/08/89)

Break down and buy ksh for your users. It has command line history and
lots of other neat things.
	bill davidsen		(davidsen@crdos1.crd.GE.COM)
  {uunet | philabs}!crdgw1!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me