-/* $NetBSD: io.c,v 1.4 1999/09/08 21:17:54 jsm Exp $ */
+/* $NetBSD: io.c,v 1.14 2009/08/31 08:27:16 dholland Exp $ */
/*
* io.c - input/output routines for Phantasia
*/
-#include "include.h"
+#include <sys/cdefs.h>
+
+#include <ctype.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+#include "phantdefs.h"
+#include "phantstruct.h"
+#include "phantglobs.h"
+//#include "pathnames.h"
+
+#undef bool
+#include <curses.h>
+
+static void catchalarm(int) __dead;
void
-getstring(cp, mx)
- char *cp;
- int mx;
+getstring(char *cp, int mx)
{
char *inptr; /* pointer into string for next string */
int x, y; /* original x, y coordinates on screen */
}
void
-more(where)
- int where;
+more(int where)
{
mvaddstr(where, 0, "-- more --");
getanswer(" ", FALSE);
}
double
-infloat()
+infloat(void)
{
double result; /* return value */
}
int
-inputoption()
+inputoption(void)
{
++Player.p_age; /* increase age */
}
void
-interrupt()
+interrupt(void)
{
char line[81]; /* a place to store data already on screen */
int loop; /* counter */
}
int
-getanswer(choices, def)
- const char *choices;
- bool def;
+getanswer(const char *choices, phbool def)
{
int ch; /* input */
- int loop; /* counter */
- int oldx, oldy; /* original coordinates on screen */
+ volatile int loop; /* counter */
+ volatile int oldx, oldy; /* original coordinates on screen */
getyx(stdscr, oldy, oldx);
alarm(0); /* make sure alarm is off */
-#if __GNUC__
- (void)&loop; /* XXX quiet gcc */
-#endif
for (loop = 3; loop; --loop)
/* try for 3 times */
{
return (*choices);
}
-void
-catchalarm(dummy)
- int dummy;
+static void
+catchalarm(int dummy __unused)
{
longjmp(Timeoenv, 1);
}