Source:Hack 1.0/hack.options.c

From NetHackWiki
(Redirected from Hack 1.0/hack.options.c)
Jump to navigation Jump to search

Below is the full text to hack.options.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.options.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.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
2.    
3.    #include "config.h"
4.    #ifdef OPTIONS
5.    #include "hack.h"
6.    
7.    doset()
8.    {
9.    	register flg = 1;
10.   	char buf[BUFSZ];
11.   	register char *str;
12.   
13.   	pline("What option do you want to set? [(!)eo] ");
14.   	getlin(buf);
15.   	str = buf;
16.   	while(*str == ' ') str++;
17.   	if(*str == '!') {
18.   		flg = 0;
19.   		str++;
20.   	}
21.   	switch(*str) {
22.   	case 'e':
23.   		flags.echo = flg;
24.   		if(flg) echo(ON);
25.   		else echo(OFF);
26.   		break;
27.   	case 'o':
28.   		flags.oneline = flg;
29.   		break;
30.   	default:
31.   		pline("Unknown option '%s'",str);
32.   	}
33.    return(0);
34.   }
35.   #endif OPTIONS