/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* hack.options.c - version 1.0.3 */
flags
.time
= flags
.nonews
= flags
.notombstone
= flags
.end_own
=
flags
.standout
= flags
.nonull
= FALSE
;
flags
.no_rest_on_space
= TRUE
;
flags
.invlet_constant
= TRUE
;
flags
.female
= FALSE
; /* players are usually male */
if(opts
= getenv("HACKOPTIONS"))
parseoptions(opts
, from_env
)
if(op
= index(opts
, ',')) {
parseoptions(op
, from_env
);
if(op
= index(opts
, ' ')) {
if(*op
!= ' ') *op2
++ = *op
;
while((*opts
== '!') || !strncmp(opts
, "no", 2)) {
if(*opts
== '!') opts
++; else opts
+= 2;
if(!strncmp(opts
,"standout",8)) {
flags
.standout
= !negated
;
if(!strncmp(opts
,"null",3)) {
if(!strncmp(opts
,"tombstone",4)) {
flags
.notombstone
= negated
;
if(!strncmp(opts
,"news",4)) {
if(!strncmp(opts
,"time",4)) {
if(!strncmp(opts
,"restonspace",4)) {
flags
.no_rest_on_space
= negated
;
if(!strncmp(opts
,"fixinv",4)) {
flags
.invlet_constant
= !negated
;
pline("The fixinvlet option must be in HACKOPTIONS.");
if(!strncmp(opts
,"male",4)) {
if(!strncmp(opts
,"female",6)) {
if(!strncmp(opts
,"name",4)) {
extern char plname
[PL_NSIZ
];
pline("The playername can be set only from HACKOPTIONS.");
(void) strncpy(plname
, op
+1, sizeof(plname
)-1);
/* endgame:5t[op] 5a[round] o[wn] */
if(!strncmp(opts
,"endgame",3)) {
flags
.end_own
= !negated
;
if(!strncmp(opts
, "help", 4)) {
"To set options use `HACKOPTIONS=\"<options>\"' in your environment, or ",
"give the command 'o' followed by the line `<options>' while playing. ",
"Here <options> is a list of <option>s separated by commas." );
"Simple (boolean) options are rest_on_space, news, time, ",
"null, tombstone, (fe)male. ",
"These can be negated by prefixing them with '!' or \"no\"." );
"A string option is name, as in HACKOPTIONS=\"name:Merlin-W\"." );
"A compound option is endgame; it is followed by a description of what ",
"parts of the scorelist you want to see. You might for example say: ",
"`endgame:own scores/5 top scores/4 around my score'." );
pline("Bad option: %s.", opts
);
pline("Type `o help<cr>' for help.");
puts("Bad syntax in HACKOPTIONS.");
puts("Use for example:");
"HACKOPTIONS=\"!restonspace,notombstone,endgame:own/5 topscorers/4 around me\""
pline("What options do you want to set? ");
if(!buf
[0] || buf
[0] == '\033') {
(void) strcpy(buf
,"HACKOPTIONS=");
(void) strcat(buf
, flags
.female
? "female," : "male,");
if(flags
.standout
) (void) strcat(buf
,"standout,");
if(flags
.nonull
) (void) strcat(buf
,"nonull,");
if(flags
.nonews
) (void) strcat(buf
,"nonews,");
if(flags
.time
) (void) strcat(buf
,"time,");
if(flags
.notombstone
) (void) strcat(buf
,"notombstone,");
if(flags
.no_rest_on_space
)
(void) strcat(buf
,"!rest_on_space,");
if(flags
.end_top
!= 5 || flags
.end_around
!= 4 || flags
.end_own
){
(void) sprintf(eos(buf
), "endgame: %u topscores/%u around me",
flags
.end_top
, flags
.end_around
);
if(flags
.end_own
) (void) strcat(buf
, "/own scores");
register char *eop
= eos(buf
);
if(*--eop
== ',') *eop
= 0;
parseoptions(buf
, FALSE
);