Source:Hack 1.0/hack.ioctl.c

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to hack.ioctl.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.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.    /* This cannot be part of hack.tty.c (as it was earlier) since on some
2.       systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h>
3.       define the same constants, and the C preprocessor complains. */
4.    #include <stdio.h>
5.    #include "config.h"
6.    #ifdef BSD
7.    #include	<sgtty.h>
8.    struct ltchars ltchars, ltchars0;
9.    #else
10.   #include	<termio.h>	/* also includes part of <sgtty.h> */
11.   struct termio termio;
12.   #endif BSD
13.   
14.   getioctls() {
15.   #ifdef BSD
16.   	(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) &ltchars);
17.   	(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars0);
18.   #else
19.   	(void) ioctl(fileno(stdin), (int) TCGETA, &termio);
20.   #endif BSD
21.   }
22.   
23.   setioctls() {
24.   #ifdef BSD
25.   	(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars);
26.   #else
27.   	(void) ioctl(fileno(stdin), (int) TCSETA, &termio);
28.   #endif BSD
29.   }
30.   
31.