Home | History | Annotate | Line # | Download | only in hack
hack.ioctl.c revision 1.6
      1 /*	$NetBSD: hack.ioctl.c,v 1.6 1997/10/19 16:58:07 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
      5  */
      6 
      7 #include <sys/cdefs.h>
      8 #ifndef lint
      9 __RCSID("$NetBSD: hack.ioctl.c,v 1.6 1997/10/19 16:58:07 christos Exp $");
     10 #endif				/* not lint */
     11 
     12 /*
     13  * This cannot be part of hack.tty.c (as it was earlier) since on some
     14  * systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h> define the
     15  * same constants, and the C preprocessor complains.
     16  */
     17 #include <termios.h>
     18 #include "hack.h"
     19 #include "extern.h"
     20 struct termios  termios;
     21 
     22 void
     23 getioctls()
     24 {
     25 	(void) tcgetattr(fileno(stdin), &termios);
     26 }
     27 
     28 void
     29 setioctls()
     30 {
     31 	(void) tcsetattr(fileno(stdin), TCSADRAIN, &termios);
     32 }
     33 
     34 #ifdef SUSPEND			/* implies BSD */
     35 #include	<signal.h>
     36 int
     37 dosuspend()
     38 {
     39 #ifdef SIGTSTP
     40 	if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
     41 		settty((char *) 0);
     42 		(void) signal(SIGTSTP, SIG_DFL);
     43 		(void) kill(0, SIGTSTP);
     44 		gettty();
     45 		setftty();
     46 		docrt();
     47 	} else {
     48 		pline("I don't think your shell has job control.");
     49 	}
     50 #else	/* SIGTSTP */
     51 	pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
     52 #endif				/* SIGTSTP */
     53 	return (0);
     54 }
     55 #endif				/* SUSPEND */
     56