summaryrefslogtreecommitdiffstats
path: root/src/intrfn.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-05-17 16:59:23 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-05-17 16:59:23 +0200
commit8a1a00406d86e2389ec4a0947f08d9fe4f943a9b (patch)
treecdcf6b3b406ff49121418227fdb4de64cb78d961 /src/intrfn.c
parentc0613313cb0f308038766d14fa411a490eef33cd (diff)
Disable menu_to_command() compilation if ENABLE_MOUSE is undefined.
Remove ask_confirmation_with_default() function wmenuSimple(): make some variables more local
Diffstat (limited to 'src/intrfn.c')
-rw-r--r--src/intrfn.c45
1 files changed, 4 insertions, 41 deletions
diff --git a/src/intrfn.c b/src/intrfn.c
index dbea886..33a2600 100644
--- a/src/intrfn.c
+++ b/src/intrfn.c
@@ -266,6 +266,7 @@ static int wmenuUpdate(WINDOW *window, const int yinfo, int y, int x, const stru
return y;
}
+#if defined(KEY_MOUSE) && defined(ENABLE_MOUSE)
int menu_to_command(const unsigned int yinfo, const unsigned int y_org, const unsigned int x_org, const struct MenuItem *menuItems, const unsigned int itemLength, const char *available, const int menuType, const unsigned int y_real, const unsigned int x_real)
{
unsigned int y=y_org;
@@ -329,6 +330,7 @@ int menu_to_command(const unsigned int yinfo, const unsigned int y_org, const un
log_info("menu_to_command not found\n");
return 0;
}
+#endif
/* This function takes a list of menu items, lets the user choose one *
* and returns the value keyboard shortcut of the selected menu item */
@@ -516,12 +518,12 @@ int wmenuSelect_ext(WINDOW *window, const int yinfo, const int y_org, const int
int wmenuSimple(WINDOW *window,const struct MenuItem *menuItems, const unsigned int menuDefault)
{
- unsigned int i, j, itemLength = 0;
+ unsigned int i, itemLength = 0;
char available[MENU_MAX_ITEMS];
for(i = 0; menuItems[i].key; i++)
{
- j = strlen(menuItems[i].name);
+ const unsigned int j = strlen(menuItems[i].name);
if( j > itemLength ) itemLength = j;
available[i] = menuItems[i].key;
}
@@ -1011,45 +1013,6 @@ int ask_confirmation(const char*_format, ...)
return res;
}
-int ask_confirmation_with_default(const int key_default, const char*_format, ...)
-{
- va_list ap;
- int res;
- WINDOW *window=newwin(LINES, COLS, 0, 0); /* full screen */
- aff_copy(window);
- va_start(ap,_format);
- vaff_txt(4, window, _format, ap);
- va_end(ap);
- curs_set(1);
- wrefresh(window);
- do
- {
- res=wgetch(window);
- switch(res)
- {
-#ifdef PADENTER
- case PADENTER:
-#endif
- case KEY_ENTER:
- case '\n':
- case '\r':
- res=key_default;
- break;
- default:
- res=toupper(res);
- break;
- }
- } while(res!=c_NO && res!=c_YES);
- curs_set(0);
- wprintw(window,"%c\n",res);
- delwin(window);
- (void) clearok(stdscr, TRUE);
-#ifdef HAVE_TOUCHWIN
- touchwin(stdscr);
-#endif
- return (res==c_YES);
-}
-
void not_implemented(const char *msg)
{
WINDOW *window=newwin(LINES, COLS, 0, 0); /* full screen */