diff options
author | Ladislav Michl <ladis@linux-mips.org> | 2008-01-03 21:43:30 +0000 |
---|---|---|
committer | Ladislav Michl <ladis@linux-mips.org> | 2008-01-03 21:43:30 +0000 |
commit | 46a6ee0914539e1f7f923b64060533b1528e67c1 (patch) | |
tree | 51182b2085738dfc77354bdc60292c15c27df72c /scripts/kconfig | |
parent | e0f1130e810aaeab70d63450c84cb0474335c566 (diff) | |
download | ptxdist-46a6ee0914539e1f7f923b64060533b1528e67c1.tar.gz ptxdist-46a6ee0914539e1f7f923b64060533b1528e67c1.tar.xz |
Make menuconfig work under MinGW.
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@7689 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/lxdialog/dialog.h | 3 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/util.c | 27 | ||||
-rw-r--r-- | scripts/kconfig/mconf.c | 46 |
3 files changed, 24 insertions, 52 deletions
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index 7e17eba75..80f5d69af 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h @@ -187,9 +187,8 @@ int item_is_tag(char tag); int on_key_esc(WINDOW *win); int on_key_resize(void); -void init_dialog(const char *backtitle); +int init_dialog(const char *backtitle); void set_dialog_backtitle(const char *backtitle); -void reset_dialog(void); void end_dialog(void); void attr_clear(WINDOW * win, int height, int width, chtype attr); void dialog_clear(void); diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index a1bddefe7..cc09f9e76 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c @@ -266,24 +266,31 @@ void dialog_clear(void) /* * Do some initialization for dialog */ -void init_dialog(const char *backtitle) +int init_dialog(const char *backtitle) { - dlg.backtitle = backtitle; - color_setup(getenv("MENUCONFIG_COLOR")); -} + int height, width; + + initscr(); /* Init curses */ + getmaxyx(stdscr, height, width); + if (height < 19 || width < 80) { + endwin(); + return -ERRDISPLAYTOOSMALL; + } -void set_dialog_backtitle(const char *backtitle) -{ 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; } /* diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 8d5c6c144..f15e397f8 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -8,7 +8,6 @@ * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> */ -#include <sys/ioctl.h> #include <ctype.h> #include <errno.h> #include <fcntl.h> @@ -265,7 +264,6 @@ search_help[] = N_( "\n"); static int indent; -static int rows = 0, cols = 0; static struct menu *current_menu; static int child_count; static int single_menu_mode; @@ -279,41 +277,6 @@ static void show_textbox(const char *title, const char *text, int r, int c); static void show_helptext(const char *title, const char *text); static void show_help(struct menu *menu); -static void init_wsize(void) -{ - struct winsize ws; - char *env; - - if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) { - rows = ws.ws_row; - cols = ws.ws_col; - } - - if (!rows) { - env = getenv("LINES"); - if (env) - rows = atoi(env); - if (!rows) - rows = 24; - } - if (!cols) { - env = getenv("COLUMNS"); - if (env) - cols = atoi(env); - if (!cols) - cols = 80; - } - - if (rows < 19 || cols < 80) { - fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); - fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); - exit(1); - } - - rows -= 4; - cols -= 5; -} - static void get_prompt_str(struct gstr *r, struct property *prop) { int i, j; @@ -897,9 +860,12 @@ int main(int ac, char **av) } atexit(conf_cleanup); - init_wsize(); - reset_dialog(); - init_dialog(NULL); + if (init_dialog(NULL)) { + fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); + fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); + return 1; + } + set_config_filename(conf_get_configname()); do { conf(&rootmenu); |