-/* $NetBSD: init.c,v 1.11 1999/09/18 16:47:11 jsm Exp $ */
+/* $NetBSD: init.c,v 1.14 2004/01/27 20:30:29 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
#if 0
static char sccsid[] = "@(#)init.c 8.4 (Berkeley) 4/30/95";
#else
-__RCSID("$NetBSD: init.c,v 1.11 1999/09/18 16:47:11 jsm Exp $");
+__RCSID("$NetBSD: init.c,v 1.14 2004/01/27 20:30:29 jsm Exp $");
#endif
#endif /* not lint */
#include "extern.h"
+static int checkout(const char *);
+static const char *getutmp(void);
+static int wizard(const char *);
+
void
initialize(filename)
const char *filename;
puts("Admiral D.W. Riggle\n");
location = dayfile;
srand(getpid());
- getutmp(username);
+ username = getutmp();
wordinit();
if (filename == NULL) {
direction = NORTH;
signal(SIGINT, diesig);
}
-void
-getutmp(uname)
- char *uname;
+static const char *
+getutmp()
{
struct passwd *ptr;
ptr = getpwuid(getuid());
- strncpy(uname, ptr ? ptr->pw_name : "", 8);
+ if (ptr == NULL)
+ return "";
+ else
+ return strdup(ptr->pw_name);
}
-const char *const list[] = { /* hereditary wizards */
+/* Hereditary wizards. A configuration file might make more sense. */
+static const char *const list[] = {
"riggle",
"chris",
"edward",
0
};
-const char *const badguys[] = {
+static const char *const badguys[] = {
"wnj",
"root",
"ted",
0
};
-int
+static int
wizard(uname)
const char *uname;
{
return flag;
}
-int
+static int
checkout(uname)
const char *uname;
{