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