Changes slightly the code in menu directory so that "conf"

and "mconf" build without issuing warnings
This commit is contained in:
Pierre Labastie 2012-02-10 09:39:11 +00:00
parent d7390a52cf
commit 743414bfa2
5 changed files with 12 additions and 13 deletions

View file

@ -179,7 +179,7 @@ int conf_string(struct menu *menu)
help = nohelp_text; help = nohelp_text;
if (menu->sym->help) if (menu->sym->help)
help = menu->sym->help; help = menu->sym->help;
printf("\n%s\n", menu->sym->help); printf("\n%s\n", help);
def = NULL; def = NULL;
break; break;
} }
@ -195,7 +195,6 @@ int conf_string(struct menu *menu)
static int conf_sym(struct menu *menu) static int conf_sym(struct menu *menu)
{ {
struct symbol *sym = menu->sym; struct symbol *sym = menu->sym;
int type;
tristate oldval, newval; tristate oldval, newval;
const char *help; const char *help;
@ -203,7 +202,7 @@ static int conf_sym(struct menu *menu)
printf("%*s%s ", indent - 1, "", menu->prompt->text); printf("%*s%s ", indent - 1, "", menu->prompt->text);
if (sym->name) if (sym->name)
printf("(%s) ", sym->name); printf("(%s) ", sym->name);
type = sym_get_type(sym); (void)sym_get_type(sym);
putchar('['); putchar('[');
oldval = sym_get_tristate_value(sym); oldval = sym_get_tristate_value(sym);
switch (oldval) { switch (oldval) {
@ -270,11 +269,10 @@ static int conf_choice(struct menu *menu)
{ {
struct symbol *sym, *def_sym; struct symbol *sym, *def_sym;
struct menu *child; struct menu *child;
int type;
bool is_new; bool is_new;
sym = menu->sym; sym = menu->sym;
type = sym_get_type(sym); (void)sym_get_type(sym);
is_new = !sym_has_value(sym); is_new = !sym_has_value(sym);
if (sym_is_changable(sym)) { if (sym_is_changable(sym)) {
conf_sym(menu); conf_sym(menu);

View file

@ -3,6 +3,10 @@
#define YY_INT_ALIGNED short int #define YY_INT_ALIGNED short int
/* Define this so that no warnings are issued during
compilation of jhalfs */
#define YY_NO_INPUT 1
/* A lexical scanner generated by flex */ /* A lexical scanner generated by flex */
#define FLEX_SCANNER #define FLEX_SCANNER

View file

@ -174,7 +174,7 @@ int dialog_menu (const char *title, const char *prompt, int height, int width,
int dialog_checklist (const char *title, const char *prompt, int height, int dialog_checklist (const char *title, const char *prompt, int height,
int width, int list_height, int item_no, int width, int list_height, int item_no,
struct dialog_list_item ** items, int flag); struct dialog_list_item ** items, int flag);
extern unsigned char dialog_input_result[]; extern char dialog_input_result[];
int dialog_inputbox (const char *title, const char *prompt, int height, int dialog_inputbox (const char *title, const char *prompt, int height,
int width, const char *init); int width, const char *init);

View file

@ -21,7 +21,7 @@
#include "dialog.h" #include "dialog.h"
unsigned char dialog_input_result[MAX_LEN + 1]; char dialog_input_result[MAX_LEN + 1];
/* /*
* Print the termination buttons * Print the termination buttons
@ -48,7 +48,7 @@ dialog_inputbox (const char *title, const char *prompt, int height, int width,
{ {
int i, x, y, box_y, box_x, box_width; int i, x, y, box_y, box_x, box_width;
int input_x = 0, scroll = 0, key = 0, button = -1; int input_x = 0, scroll = 0, key = 0, button = -1;
unsigned char *instr = dialog_input_result; char *instr = dialog_input_result;
WINDOW *dialog; WINDOW *dialog;
/* center dialog box on screen */ /* center dialog box on screen */

View file

@ -39,11 +39,8 @@ dialog_textbox (const char *title, const char *file, int height, int width)
{ {
int i, x, y, cur_x, cur_y, fpos, key = 0; int i, x, y, cur_x, cur_y, fpos, key = 0;
int passed_end; int passed_end;
char search_term[MAX_LEN + 1];
WINDOW *dialog, *text; WINDOW *dialog, *text;
search_term[0] = '\0'; /* no search term entered yet */
/* Open input file for reading */ /* Open input file for reading */
if ((fd = open (file, O_RDONLY)) == -1) { if ((fd = open (file, O_RDONLY)) == -1) {
endwin (); endwin ();
@ -459,7 +456,6 @@ print_page (WINDOW * win, int height, int width)
static void static void
print_line (WINDOW * win, int row, int width) print_line (WINDOW * win, int row, int width)
{ {
int y, x;
char *line; char *line;
line = get_line (); line = get_line ();
@ -468,11 +464,12 @@ print_line (WINDOW * win, int row, int width)
waddch (win, ' '); waddch (win, ' ');
waddnstr (win, line, MIN (strlen (line), width - 2)); waddnstr (win, line, MIN (strlen (line), width - 2));
getyx (win, y, x);
/* Clear 'residue' of previous line */ /* Clear 'residue' of previous line */
#if OLD_NCURSES #if OLD_NCURSES
{ {
int y, x;
int i; int i;
getyx (win, y, x);
for (i = 0; i < width - x; i++) for (i = 0; i < width - x; i++)
waddch (win, ' '); waddch (win, ' ');
} }