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