From 09af091f50409a60a72086c737b9a6224dde5ab8 Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Mon, 17 Dec 2007 19:07:41 +0100 Subject: kconfig: make kconfig MinGW friendly Kconfig is powerfull tool. So powerfull that more and more software projects are using it for configuration. So instead of fixing some of them one by one, lets fix it in kernel and wait for sync. This work was originaly done for PTXdist - GPL licensed build system for userlands and cross-compilers, but it will not hurt kernel kconfig either. PTXdist menuconfig now works on Windows linked with PDCurses and compiled using MinGW - there is no termios and signals. * Do not include and (comes from times when lxdialog was separate process) * Do not mess with termios directly and let curses tell screen size. Comment to commit c8dc68ad0fbd934e78e913b8a8d7b45945db4930 says check for screen size could be removed later, but because it didn't happen for more than year I left it here as well. * Save cursor position added by Sam Signed-off-by: Ladislav Michl Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/lxdialog/util.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'scripts/kconfig/lxdialog/util.c') diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index a1bddefe73d0..86d95cca46a7 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c @@ -266,31 +266,41 @@ 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; } /* * 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(); } -- cgit