Source:NetHack 1.4f/ioctl.c

Below is the full text to ioctl.c from the source code of NetHack 1.4f. To link to a particular line, write [[NetHack 1.4f/ioctl.c#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)ioctl.c	1.3	87/07/14 2.   /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3.    /* hack.ioctl.c - version 1.0.2 */ 4.    5.    /* This cannot be part of hack.tty.c (as it was earlier) since on some 6.      systems (e.g. MUNIX) the include files  and   7.       define the same constants, and the C preprocessor complains. */ 8.    #include   9.    #include "config.h"  10. #ifdef BSD 11.  #include	  12. struct ltchars ltchars, ltchars0; 13.  #else 14.  #include		/* also includes part of  */ 15.  struct termio termio; 16.  #endif 17.   18.   getioctls { 19.  #ifdef BSD 20.  	(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) &ltchars); 21.  	(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars0); 22.  #else 23.  	(void) ioctl(fileno(stdin), (int) TCGETA, &termio); 24.  #endif 25.  }  26.    27.   setioctls { 28.  #ifdef BSD 29.  	(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars); 30.  #else 31.  	(void) ioctl(fileno(stdin), (int) TCSETA, &termio); 32.  #endif 33.  }  34.    35.   #ifdef SUSPEND		/* implies BSD */ 36.  dosuspend { 37.  #include	  38. #ifdef SIGTSTP 39.  	if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) { 40.  		settty((char *) 0); 41.  		(void) signal(SIGTSTP, SIG_DFL); 42.  		(void) kill(0, SIGTSTP); 43.  		gettty; 44.  		setftty; 45.  		docrt; 46.  	} else { 47.  		pline("I don't think your shell has job control."); 48.  	}  49.   #else SIGTSTP 50.  	pline("Sorry, it seems we have no SIGTSTP here. Try ! or S."); 51.  #endif 52.  	return(0); 53.  }  54.   #endif /* SUSPEND /**/