[comp.unix.xenix] Xlisp 2.0 on SCO Xenix

root@libove.UUCP (The Super User) (05/10/88)

I have the sources for Xlisp 2.0 and a unix module that someone across
the net provided me with. The setup works perfectly (in the minimal
testing I've done) on BSD 4.3, but on SCO Xenix SysV/286 rel 2.2.1
with development system 2.1.4d, the terminal gets put in a strange
mode where characters input are not always taken, and output goes one
character at a time, following each input character... The code that
sets up the terminal is:

	ioctl( 0, TIOCGETP, &tty_old );
	tty_new = tty_old;
	tty_new.sg_flags &= ~(ECHO);
	tty_new.sg_flags |= RAW|CRMOD;
	ioctl( 0, TIOCSETP, &tty_new );

Can someone tell me where this is going wrong, or perhaps if they have
written the module necessary to put Xlisp 2.0 on SCO Xenix?

Thanks
Jay Libove (pitt!darth!libove!libove or Jay.Libove@andrew.cmu.edu)
-- 
Jay Libove (Jay.Libove@andrew.cmu.edu  or  pitt!darth!libove!libove)

peter@ficc.UUCP (Peter da Silva) (05/18/88)

Reposted because it didn't get off-site (news was busted. My fault).

In article <21@libove.UUCP>, root@libove.UUCP writes:
> Xlisp... on SCO Xenix SysV/286 rel 2.2.1 with development system 2.1.4d,
> the terminal gets put in a strange mode...

> The code that sets up the terminal is:

> 	ioctl( 0, TIOCGETP, &tty_old );
> 	tty_new = tty_old;
> 	tty_new.sg_flags &= ~(ECHO);
> 	tty_new.sg_flags |= RAW|CRMOD;
> 	ioctl( 0, TIOCSETP, &tty_new );

> Can someone tell me where this is going wrong, or perhaps if they have
> written the module necessary to put Xlisp 2.0 on SCO Xenix?

What's going wrong is that Xlisp is dorking with the terminal at all. I
have Xlisp 1.6, and I ripped out all the PC-DOS style cbreak-mode I/O
completely. There's no need for Xlisp to do erase and kill processing.
The terminal driver does an adequate job on Xenix, and an excellent job
on BSD.

I'd like to upgrade to a later release than 1.6, myself. Anyone nearby got
2.0?

The relevent code I use is:

---- unixio.c ----
#include "xlisp.h"

extern int prompt;
extern int errno;

int osgetc(fp)
FILE *fp;
{
	int ch;

	ch = getc(fp);
	if(fp==stdin)
		if(ch=='\n')
			prompt = 1;
	return ch;
}

osputc(ch, fp)
int ch;
FILE *fp;
{
	putc(ch, fp);
}

osinit(banner)
{
	if(isatty(fileno(stdin)) && isatty(fileno(stdout)))
		fprintf(stderr, "%s\n", banner);
}

oscheck()
{
}

osfinit()
{
}
---- end ----

For most purposes under UNIX, you won't need any more than this. Any
extensions (such as (raw), (cbreak), or even (stty ...) and (gtty... ))
should be done by defining a bunch of functions and setting them up in
osfinit().

You may find you have to provide osrand() as well:

---- unixmisc.c ----
#include "xlisp.h"

#define MAXRND 32767

int osrand(n)
  int n;
{
    int m;

    do
        ;
	while ( (m = rand()) > (MAXRND % n) * n );
    return (m % n);
}
---- end ----
-- 
-- Peter da Silva, Ferranti International Controls Corporation.
-- Phone: 713-274-5180. Remote UUCP: uunet!nuchat!sugar!peter.