Fandom

Wikihack

Source:NetHack 2.2a/ioctl.c

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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

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

Screenshots and source code from Hack are used under the CWI license.
1.    /*	SCCS Id: @(#)ioctl.c	2.0	87/09/18
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    
4.    /* This cannot be part of hack.tty.c (as it was earlier) since on some
5.       systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h>
6.       define the same constants, and the C preprocessor complains. */
7.    #include <stdio.h>
8.    #include "config.h"
9.    #ifdef BSD
10.   #include	<sgtty.h>
11.   struct ltchars ltchars, ltchars0;
12.   #else
13.   #include	<termio.h>	/* also includes part of <sgtty.h> */
14.   struct termio termio;
15.   #endif
16.   
17.   getioctls() {
18.   #ifdef BSD
19.   	(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) &ltchars);
20.   	(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars0);
21.   #else
22.   	(void) ioctl(fileno(stdin), (int) TCGETA, &termio);
23.   #endif
24.   }
25.   
26.   setioctls() {
27.   #ifdef BSD
28.   	(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars);
29.   #else
30.   	/* Now modified to run under Sys V R3.	- may have to be #ifdef'ed */
31.   	(void) ioctl(fileno(stdin), (int) TCSETAW, &termio);
32.   #endif
33.   }
34.   
35.   #ifdef SUSPEND		/* implies BSD */
36.   dosuspend() {
37.   #include	<signal.h>
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 /**/

Also on Fandom

Random Wiki