int prompt_width = strlen(prompt) + buffer + 1;
int prompt_height = 1;
int height = prompt_height;
-#if __STDC_VERSION__ >= 199901L
- char input[buffer];
-#else
-#ifndef BUFSZ
-#define BUFSZ 256
-#endif
char input[BUFSZ];
- buffer = BUFSZ - 1;
-#endif
-
+ if (buffer >= (int) sizeof input)
+ buffer = (int) sizeof input - 1;
maxwidth = term_cols - 2;
if (iflags.window_inited) {
CHAR_P def)
{
WINDOW *askwin = NULL;
+#ifdef PDCURSES
WINDOW *message_window;
+#endif
int answer, count, maxwidth, map_height, map_width;
char *linestr;
char askstr[BUFSZ + QBUFSZ];
nhmenu *current_menu = get_menu(wid);
if (current_menu == NULL) {
- impossible
- ("curses_add_nhmenu_item: attempt to add item to nonexistent menu");
+ impossible(
+ "curses_add_nhmenu_item: attempt to add item to nonexistent menu");
return;
}
curses_finalize_nhmenu(winid wid, const char *prompt)
{
int count = 0;
+ nhmenu_item *menu_item_ptr;
nhmenu *current_menu = get_menu(wid);
if (current_menu == NULL) {
- impossible("curses_finalize_nhmenu: attempt to finalize nonexistent menu");
+ impossible(
+ "curses_finalize_nhmenu: attempt to finalize nonexistent menu");
return;
}
-
- nhmenu_item *menu_item_ptr = current_menu->entries;
- while (menu_item_ptr != NULL) {
- menu_item_ptr = menu_item_ptr->next_item;
+ for (menu_item_ptr = current_menu->entries;
+ menu_item_ptr != NULL; menu_item_ptr = menu_item_ptr->next_item)
count++;
- }
current_menu->num_entries = count;
-
current_menu->prompt = curses_copy_of(prompt);
}
*_selected = NULL;
if (current_menu == NULL) {
- impossible("curses_display_nhmenu: attempt to display nonexistent menu");
+ impossible(
+ "curses_display_nhmenu: attempt to display nonexistent menu");
return '\033';
}
start_col += 4;
}
#if 0
- //FIXME: menuglyphs not implemented yet
+ /* FIXME: menuglyphs not implemented yet */
if (menu_item_ptr->glyph != NO_GLYPH && iflags.use_menu_glyphs) {
unsigned special; /*notused */
/* Adds an inventory item. */
void
-curses_add_inv(int y, int glyph, CHAR_P accelerator, attr_t attr,
- const char *str)
+curses_add_inv(int y,
+ int glyph UNUSED,
+ CHAR_P accelerator, attr_t attr, const char *str)
{
WINDOW *win = curses_get_nhwin(INV_WIN);
int color = NO_COLOR;
+ int x = 0;
/* Figure out where to draw the line */
- int x = 0;
if (curses_window_has_border(INV_WIN)) {
x++;
y++;
wmove(win, y, x);
if (accelerator) {
attr_t bold = A_BOLD;
+
wattron(win, bold);
waddch(win, accelerator);
wattroff(win, bold);
unsigned dummy = 0; /* Not used */
int color = 0;
int symbol = 0;
+ attr_t glyphclr;
+
mapglyph(glyph, &symbol, &color, &dummy,
u.ux, u.uy);
- attr_t glyphclr = curses_color_attr(color, 0);
+ glyphclr = curses_color_attr(color, 0);
wattron(win, glyphclr);
wprintw(win, "%c ", symbol);
wattroff(win, glyphclr);
}
#endif
- if (accelerator && /* Don't colorize categories */
- iflags.use_menu_color) {
+ if (accelerator /* Don't colorize categories */
+ && iflags.use_menu_color) {
char str_mutable[BUFSZ];
+
Strcpy(str_mutable, str);
attr = 0;
get_menu_coloring(str_mutable, &color, (int *) &attr);
/* Interface definition, for windows.c */
struct window_procs curses_procs = {
"curses",
- WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_HILITE_PET |
- WC_PERM_INVENT | WC_POPUP_DIALOG | WC_SPLASH_SCREEN,
- WC2_DARKGRAY | WC2_HITPOINTBAR |
+ (WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_HILITE_PET
+ | WC_PERM_INVENT | WC_POPUP_DIALOG | WC_SPLASH_SCREEN),
+ (WC2_DARKGRAY | WC2_HITPOINTBAR
#if defined(STATUS_HILITES)
- WC2_HILITE_STATUS |
+ | WC2_HILITE_STATUS
#endif
- WC2_HITPOINTBAR | WC2_FLUSH_STATUS |
- WC2_TERM_SIZE | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR,
+ | WC2_HITPOINTBAR | WC2_FLUSH_STATUS
+ | WC2_TERM_SIZE | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR),
curses_init_nhwindows,
curses_player_selection,
curses_askname,
** windows? Or at least all but WIN_INFO? -dean
*/
void
-curses_init_nhwindows(int *argcp, char **argv)
+curses_init_nhwindows(int *argcp UNUSED,
+ char **argv UNUSED)
{
#ifdef PDCURSES
char window_title[BUFSZ];
/* Prepare the window to be suspended. */
void
-curses_suspend_nhwindows(const char *str)
+curses_suspend_nhwindows(const char *str UNUSED)
{
endwin();
}
It's not used here.
*/
void
-curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph)
+curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
+ int bkglyph UNUSED)
{
int ch;
int color;
-- Initialize the number pad to the given state.
*/
void
-curses_number_pad(int state)
+curses_number_pad(int state UNUSED)
{
+ return;
}
/*
genl_outrip for the value and check the #if in rip.c.
*/
void
-curses_outrip(winid wid, int how)
+curses_outrip(winid wid UNUSED,
+ int how UNUSED)
{
+ return;
}
/*
{
int height, width, ret = 0;
WINDOW *win = curses_get_nhwin(MESSAGE_WIN);
- char *resp = " \r\n\033"; /* space, enter, esc */
-
+ const char *resp = " \r\n\033"; /* space, enter, esc */
curses_get_window_size(MESSAGE_WIN, &height, &width);
curses_toggle_color_attr(win, MORECOLOR, NONE, ON);
/* msgtype=stop should require space/enter rather than
* just any key, as we want to prevent YASD from
* riding direction keys. */
- while ((ret = wgetch(win)) && !index(resp,(char)ret));
+ while ((ret = wgetch(win)) != 0 && !index(resp, (char) ret))
+ continue;
if (height == 1) {
curses_clear_unhighlight_message_window();
} else {