-/* $NetBSD: message.c,v 1.11 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: message.c,v 1.14 2009/08/12 08:44:45 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: message.c,v 1.11 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: message.c,v 1.14 2009/08/12 08:44:45 dholland Exp $");
#endif
#endif /* not lint */
#include <termios.h>
#include <stdarg.h>
#include "rogue.h"
+#include "pathnames.h"
-char msgs[NMESSAGES][DCOLS] = {"", "", "", "", ""};
-short msg_col = 0, imsg = -1;
-boolean msg_cleared = 1, rmsg = 0;
+static char msgs[NMESSAGES][DCOLS] = {"", "", "", "", ""};
+static short msg_col = 0, imsg = -1;
+static boolean rmsg = 0;
+
+boolean msg_cleared = 1;
char hunger_str[HUNGER_STR_LEN] = "";
const char *more = "-more-";
-static void message __P((const char *, boolean));
+static void save_screen(void);
static
void
-message(msg, intrpt)
- const char *msg;
- boolean intrpt;
+message(const char *msg, boolean intrpt)
{
cant_int = 1;
}
if (!rmsg) {
imsg = (imsg + 1) % NMESSAGES;
- (void) strlcpy(msgs[imsg], msg, sizeof(msgs[imsg]));
+ (void)strlcpy(msgs[imsg], msg, sizeof(msgs[imsg]));
}
mvaddstr(MIN_ROW-1, 0, msg);
addch(' ');
}
void
-remessage(c)
- short c;
+remessage(short c)
{
if (imsg != -1) {
check_message();
}
void
-check_message()
+check_message(void)
{
if (msg_cleared) {
return;
}
int
-get_input_line(prompt, insert, buf, buflen, if_cancelled, add_blank, do_echo)
- const char *prompt, *insert;
- char *buf;
- size_t buflen;
- const char *if_cancelled;
- boolean add_blank;
- boolean do_echo;
+get_input_line(const char *prompt, const char *insert,
+ char *buf, size_t buflen,
+ const char *if_cancelled,
+ boolean add_blank, boolean do_echo)
{
short ch;
- short i = 0, n;
+ size_t i = 0, n;
message(prompt, 0);
n = strlen(prompt);
if (insert[0]) {
mvaddstr(0, n + 1, insert);
- (void) strlcpy(buf, insert, buflen);
+ (void)strlcpy(buf, insert, buflen);
i = strlen(buf);
move(0, (n + i + 1));
refresh();
}
int
-rgetchar()
+rgetchar(void)
{
int ch;
ch = getchar();
switch(ch) {
- case '\022':
+ case '\022': /* ^R */
wrefresh(curscr);
break;
#ifdef UNIX_BSD4_2
- case '\032':
+ case '\032': /* ^Z */
printf("%s", CL);
fflush(stdout);
tstp();
*/
void
-print_stats(stat_mask)
- int stat_mask;
+print_stats(int stat_mask)
{
char buf[16];
boolean label;
refresh();
}
-void
-save_screen()
+static void
+save_screen(void)
{
FILE *fp;
short i, j;
char buf[DCOLS+2];
- if ((fp = fopen("rogue.screen", "w")) != NULL) {
+ if ((fp = fopen(_PATH_SCREENDUMP, "w")) != NULL) {
for (i = 0; i < DROWS; i++) {
for (j=0; j<DCOLS; j++) {
buf[j] = mvinch(i, j);
}
void
-sound_bell()
+sound_bell(void)
{
putchar(7);
fflush(stdout);
}
boolean
-is_digit(ch)
- short ch;
+is_digit(int ch)
{
return((ch >= '0') && (ch <= '9'));
}
int
-r_index(str, ch, last)
- const char *str;
- int ch;
- boolean last;
+r_index(const char *str, int ch, boolean last)
{
int i = 0;