Fandom

Wikihack

Source:NetHack 3.0.0/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 3.0.0. To link to a particular line, write [[NetHack 3.0.0/ioctl.c#line123]], for example.

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

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)ioctl.c	2.0	87/09/18
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
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 <termio.h> and <sgtty.h>
7.       define the same constants, and the C preprocessor complains. */
8.    
9.    /* block some unused #defines to avoid overloading some cpp's */
10.   #define MONATTK_H
11.   #include "hack.h"
12.   
13.   #if defined(BSD) || defined(ULTRIX)
14.   #include	<sgtty.h>
15.   struct ltchars ltchars, ltchars0;
16.   #else
17.   #include	<termio.h>	/* also includes part of <sgtty.h> */
18.   struct termio termio;
19.   #endif
20.   
21.   void
22.   getioctls() {
23.   #if defined(BSD) || defined(ULTRIX)
24.   	(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) &ltchars);
25.   	(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars0);
26.   #else
27.   	(void) ioctl(fileno(stdin), (int) TCGETA, &termio);
28.   #endif
29.   }
30.   
31.   void
32.   setioctls() {
33.   #if defined(BSD) || defined(ULTRIX)
34.   	(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars);
35.   #else
36.   	/* Now modified to run under Sys V R3.	- may have to be #ifdef'ed */
37.   	(void) ioctl(fileno(stdin), (int) TCSETAW, &termio);
38.   #endif
39.   }
40.   
41.   #ifdef SUSPEND		/* implies BSD */
42.   int
43.   dosuspend() {
44.   #include	<signal.h>
45.   #ifdef SIGTSTP
46.   	if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
47.   		settty(NULL);
48.   		(void) signal(SIGTSTP, SIG_DFL);
49.   		(void) kill(0, SIGTSTP);
50.   		gettty();
51.   		setftty();
52.   		docrt();
53.   	} else {
54.   		pline("I don't think your shell has job control.");
55.   	}
56.   #else
57.   	pline("Sorry, it seems we have no SIGTSTP here.  Try ! or S.");
58.   #endif
59.   	return(0);
60.   }
61.   #endif /* SUSPEND /**/

Also on Fandom

Random Wiki