From b7a51199bdd351992670e6466d36202c8e70d89a Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 5 Jun 2008 11:43:44 +0000 Subject: - pull kconfig from 2.6.25.4 It has nicer "-*-" etc hints --- extra/config/lxdialog/.gitignore | 4 ++++ extra/config/lxdialog/check-lxdialog.sh | 40 +++++++++++++++------------------ extra/config/lxdialog/checklist.c | 4 ++-- extra/config/lxdialog/dialog.h | 12 +++++++--- extra/config/lxdialog/inputbox.c | 4 ++-- extra/config/lxdialog/menubox.c | 6 ++--- extra/config/lxdialog/textbox.c | 2 +- extra/config/lxdialog/util.c | 27 +++++++++++++++++----- extra/config/lxdialog/yesno.c | 4 ++-- 9 files changed, 62 insertions(+), 41 deletions(-) create mode 100644 extra/config/lxdialog/.gitignore (limited to 'extra/config/lxdialog') diff --git a/extra/config/lxdialog/.gitignore b/extra/config/lxdialog/.gitignore new file mode 100644 index 000000000..90b08ff02 --- /dev/null +++ b/extra/config/lxdialog/.gitignore @@ -0,0 +1,4 @@ +# +# Generated files +# +lxdialog diff --git a/extra/config/lxdialog/check-lxdialog.sh b/extra/config/lxdialog/check-lxdialog.sh index df81c4455..62e1e0212 100755 --- a/extra/config/lxdialog/check-lxdialog.sh +++ b/extra/config/lxdialog/check-lxdialog.sh @@ -4,21 +4,15 @@ # What library to link ldflags() { - $cc -print-file-name=libncursesw.so | grep -q / - if [ $? -eq 0 ]; then - echo '-lncursesw' - exit - fi - $cc -print-file-name=libncurses.so | grep -q / - if [ $? -eq 0 ]; then - echo '-lncurses' - exit - fi - $cc -print-file-name=libcurses.so | grep -q / - if [ $? -eq 0 ]; then - echo '-lcurses' - exit - fi + for ext in so a dylib ; do + for lib in ncursesw ncurses curses ; do + $cc -print-file-name=lib${lib}.${ext} | grep -q / + if [ $? -eq 0 ]; then + echo "-l${lib}" + exit + fi + done + done exit 1 } @@ -42,14 +36,16 @@ trap "rm -f $tmp" 0 1 2 3 15 # Check if we can link to ncurses check() { - echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null + echo -e " #include CURSES_LOC \n main() {}" | + $cc -xc - -o $tmp 2> /dev/null if [ $? != 0 ]; then - echo " *** Unable to find the ncurses libraries." 1>&2 - echo " *** make menuconfig require the ncurses libraries" 1>&2 - echo " *** " 1>&2 - echo " *** Install ncurses (ncurses-devel) and try again" 1>&2 - echo " *** " 1>&2 - exit 1 + echo " *** Unable to find the ncurses libraries or the" 1>&2 + echo " *** required header files." 1>&2 + echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2 + echo " *** " 1>&2 + echo " *** Install ncurses (ncurses-devel) and try again." 1>&2 + echo " *** " 1>&2 + exit 1 fi } diff --git a/extra/config/lxdialog/checklist.c b/extra/config/lxdialog/checklist.c index cf697080d..b2a878c93 100644 --- a/extra/config/lxdialog/checklist.c +++ b/extra/config/lxdialog/checklist.c @@ -97,8 +97,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 11; int y = height - 2; - print_button(dialog, "Select", y, x, selected == 0); - print_button(dialog, " Help ", y, x + 14, selected == 1); + print_button(dialog, gettext("Select"), y, x, selected == 0); + print_button(dialog, gettext(" Help "), y, x + 14, selected == 1); wmove(dialog, y, x + 1 + 14 * selected); wrefresh(dialog); diff --git a/extra/config/lxdialog/dialog.h b/extra/config/lxdialog/dialog.h index fd695e107..b5211fce0 100644 --- a/extra/config/lxdialog/dialog.h +++ b/extra/config/lxdialog/dialog.h @@ -26,6 +26,12 @@ #include #include +#ifndef KBUILD_NO_NLS +# include +#else +# define gettext(Msgid) ((const char *) (Msgid)) +#endif + #ifdef __sun__ #define CURS_MACROS #endif @@ -187,9 +193,9 @@ int item_is_tag(char tag); int on_key_esc(WINDOW *win); int on_key_resize(void); -void init_dialog(const char *backtitle); -void reset_dialog(void); -void end_dialog(void); +int init_dialog(const char *backtitle); +void set_dialog_backtitle(const char *backtitle); +void end_dialog(int x, int y); void attr_clear(WINDOW * win, int height, int width, chtype attr); void dialog_clear(void); void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); diff --git a/extra/config/lxdialog/inputbox.c b/extra/config/lxdialog/inputbox.c index 05e72066b..4946bd02b 100644 --- a/extra/config/lxdialog/inputbox.c +++ b/extra/config/lxdialog/inputbox.c @@ -31,8 +31,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 11; int y = height - 2; - print_button(dialog, " Ok ", y, x, selected == 0); - print_button(dialog, " Help ", y, x + 14, selected == 1); + print_button(dialog, gettext(" Ok "), y, x, selected == 0); + print_button(dialog, gettext(" Help "), y, x + 14, selected == 1); wmove(dialog, y, x + 1 + 14 * selected); wrefresh(dialog); diff --git a/extra/config/lxdialog/menubox.c b/extra/config/lxdialog/menubox.c index 0d83159d9..fa9d633f2 100644 --- a/extra/config/lxdialog/menubox.c +++ b/extra/config/lxdialog/menubox.c @@ -157,9 +157,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected) int x = width / 2 - 16; int y = height - 2; - print_button(win, "Select", y, x, selected == 0); - print_button(win, " Exit ", y, x + 12, selected == 1); - print_button(win, " Help ", y, x + 24, selected == 2); + print_button(win, gettext("Select"), y, x, selected == 0); + print_button(win, gettext(" Exit "), y, x + 12, selected == 1); + print_button(win, gettext(" Help "), y, x + 24, selected == 2); wmove(win, y, x + 1 + 12 * selected); wrefresh(win); diff --git a/extra/config/lxdialog/textbox.c b/extra/config/lxdialog/textbox.c index fabfc1ad7..c704712d0 100644 --- a/extra/config/lxdialog/textbox.c +++ b/extra/config/lxdialog/textbox.c @@ -114,7 +114,7 @@ do_resize: print_title(dialog, title, width); - print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); + print_button(dialog, gettext(" Exit "), height - 2, width / 2 - 4, TRUE); wnoutrefresh(dialog); getyx(dialog, cur_y, cur_x); /* Save cursor position */ diff --git a/extra/config/lxdialog/util.c b/extra/config/lxdialog/util.c index a1a1354ba..86d95cca4 100644 --- a/extra/config/lxdialog/util.c +++ b/extra/config/lxdialog/util.c @@ -266,26 +266,41 @@ void dialog_clear(void) /* * Do some initialization for dialog */ -void init_dialog(const char *backtitle) +int init_dialog(const char *backtitle) { + int height, width; + + initscr(); /* Init curses */ + getmaxyx(stdscr, height, width); + if (height < 19 || width < 80) { + endwin(); + return -ERRDISPLAYTOOSMALL; + } + dlg.backtitle = backtitle; color_setup(getenv("MENUCONFIG_COLOR")); -} -void reset_dialog(void) -{ - initscr(); /* Init curses */ keypad(stdscr, TRUE); cbreak(); noecho(); dialog_clear(); + + return 0; +} + +void set_dialog_backtitle(const char *backtitle) +{ + dlg.backtitle = backtitle; } /* * End using dialog functions. */ -void end_dialog(void) +void end_dialog(int x, int y) { + /* move cursor back to original position */ + move(y, x); + refresh(); endwin(); } diff --git a/extra/config/lxdialog/yesno.c b/extra/config/lxdialog/yesno.c index ee0a04e3e..4e6e8090c 100644 --- a/extra/config/lxdialog/yesno.c +++ b/extra/config/lxdialog/yesno.c @@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 10; int y = height - 2; - print_button(dialog, " Yes ", y, x, selected == 0); - print_button(dialog, " No ", y, x + 13, selected == 1); + print_button(dialog, gettext(" Yes "), y, x, selected == 0); + print_button(dialog, gettext(" No "), y, x + 13, selected == 1); wmove(dialog, y, x + 1 + 13 * selected); wrefresh(dialog); -- cgit v1.2.3