2a3
>  * modifications by:  Robert Regn	   rtregn@faui32.uucp
5a7,21
> #ifdef MINIX
> #include <sgtty.h>
> 
> char *strchr(s, c)
> register char *s;
> {
> 	while (*s) {
> 		if (*s == c)
> 			return s;
> 		s++;
> 	}
> 	return 0;
> }
> 
> #else
6a23
> #endif
94a112,114
> #ifdef MINIX
> static	struct	sgttyb	ostate;
> #else
95a116
> #endif
101a123,141
> #ifdef MINIX
> 	struct	sgttyb	nstate;
> 
> 	if ((term = getenv("TERM")) == NULL || strcmp(term, "minix") != 0) {
> 		fprintf(stderr, "Invalid terminal type '%s'\n", term);
> 		exit(1);
> 	}
> 	Columns = 80;
> 	P(P_LI) = Rows = 24;
> 
> 	/*
> 	 * Go into cbreak mode
> 	 */
> 	 ioctl(0, TIOCGETP, &ostate);
> 	 nstate = ostate;
> 	 nstate.sg_flags |= CBREAK;
> 	 nstate.sg_flags &= ~ECHO;
> 	 ioctl(0, TIOCSETP, &nstate);
> #else
119a160
> #endif
128a170,173
> 	flushbuf();
> #ifdef MINIX
> 	ioctl(0, TIOCSETP, &ostate);
> #else
129a175
> #endif
132a179,211
> 
> #ifdef MINIX
> void
> doshell()
> {
> 	char	*sh, *getenv();
> 	struct	sgttyb	nstate;
> 
> 	if ((sh = getenv("SHELL")) == NULL) {
> 		sh = "/bin/sh";
> 	}
> 	gotocmd(TRUE, FALSE, 0);
> 
> 	switch (fork() ) {
> 		case	0:	ioctl(0, TIOCSETP, &ostate);
> 				write(1,"\n", 1);
> 				execl(sh, "sh", "-i", 0);
> 				write(1,"Exec failed", 11);
> 				exit(1);
> 
> 		case	-1:	emsg("fork failed");
> 				break;
> 
> 		default:	wait(0);
> 				nstate = ostate;
> 				nstate.sg_flags |= CBREAK;
> 				nstate.sg_flags &= ~ECHO;
> 				ioctl(0, TIOCSETP, &nstate);
> 	}
> 
> 	wait_return();
> }
> #endif
