-/* $NetBSD: hack.options.c,v 1.6 2003/04/02 18:36:39 jsm Exp $ */
+/* $NetBSD: hack.options.c,v 1.9 2009/06/07 20:13:18 dholland Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hack.options.c,v 1.6 2003/04/02 18:36:39 jsm Exp $");
+__RCSID("$NetBSD: hack.options.c,v 1.9 2009/06/07 20:13:18 dholland Exp $");
#endif /* not lint */
#include <stdlib.h>
#include "extern.h"
void
-initoptions()
+initoptions(void)
{
char *opts;
}
void
-parseoptions(opts, from_env)
- char *opts;
- boolean from_env;
+parseoptions(char *opts, boolean from_env)
{
char *op, *op2;
unsigned num;
if (!strncmp(opts, "help", 4)) {
pline("%s%s%s",
"To set options use `HACKOPTIONS=\"<options>\"' in your environment, or ",
- "give the command 'o' followed by the line `<options>' while playing. ",
+ "give the command 'O' followed by the line `<options>' while playing. ",
"Here <options> is a list of <option>s separated by commas.");
pline("%s%s%s",
"Simple (boolean) options are rest_on_space, news, time, ",
return;
}
pline("Bad option: %s.", opts);
- pline("Type `o help<cr>' for help.");
+ pline("Type `O help<cr>' for help.");
return;
}
puts("Bad syntax in HACKOPTIONS.");
}
int
-doset()
+doset(void)
{
- char buf[BUFSZ];
+ char buf[BUFSZ];
+ size_t pos;
pline("What options do you want to set? ");
getlin(buf);
(void) strcpy(buf, "HACKOPTIONS=");
(void) strcat(buf, flags.female ? "female," : "male,");
if (flags.standout)
- (void) strcat(buf, "standout,");
+ (void) strlcat(buf, "standout,", sizeof(buf));
if (flags.nonull)
- (void) strcat(buf, "nonull,");
+ (void) strlcat(buf, "nonull,", sizeof(buf));
if (flags.nonews)
- (void) strcat(buf, "nonews,");
+ (void) strlcat(buf, "nonews,", sizeof(buf));
if (flags.time)
- (void) strcat(buf, "time,");
+ (void) strlcat(buf, "time,", sizeof(buf));
if (flags.notombstone)
- (void) strcat(buf, "notombstone,");
+ (void) strlcat(buf, "notombstone,", sizeof(buf));
if (flags.no_rest_on_space)
- (void) strcat(buf, "!rest_on_space,");
+ (void) strlcat(buf, "!rest_on_space,", sizeof(buf));
if (flags.end_top != 5 || flags.end_around != 4 || flags.end_own) {
- (void) sprintf(eos(buf), "endgame: %u topscores/%u around me",
+ pos = strlen(buf);
+ (void) snprintf(buf+pos, sizeof(buf)-pos,
+ "endgame: %u topscores/%u around me",
flags.end_top, flags.end_around);
if (flags.end_own)
- (void) strcat(buf, "/own scores");
+ (void) strlcat(buf, "/own scores", sizeof(buf));
} else {
char *eop = eos(buf);
if (*--eop == ',')