summaryrefslogtreecommitdiffstats
path: root/scripts/lxdialog
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
commit78c388aed2b7184182c08428db1de6c872d815f5 (patch)
tree4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /scripts/lxdialog
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'scripts/lxdialog')
-rw-r--r--scripts/lxdialog/dialog.h18
-rw-r--r--scripts/lxdialog/lxdialog.c3
-rw-r--r--scripts/lxdialog/menubox.c14
-rw-r--r--scripts/lxdialog/textbox.c17
4 files changed, 46 insertions, 6 deletions
diff --git a/scripts/lxdialog/dialog.h b/scripts/lxdialog/dialog.h
index 3be5feb21..0e30d00d0 100644
--- a/scripts/lxdialog/dialog.h
+++ b/scripts/lxdialog/dialog.h
@@ -28,6 +28,24 @@
#include CURSES_LOC
+/*
+ * Colors in ncurses 1.9.9e do not work properly since foreground and
+ * background colors are OR'd rather than separately masked. This version
+ * of dialog was hacked to work with ncurses 1.9.9e, making it incompatible
+ * with standard curses. The simplest fix (to make this work with standard
+ * curses) uses the wbkgdset() function, not used in the original hack.
+ * Turn it off if we're building with 1.9.9e, since it just confuses things.
+ */
+#if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE)
+#define OLD_NCURSES 1
+#undef wbkgdset
+#define wbkgdset(w,p) /*nothing*/
+#else
+#define OLD_NCURSES 0
+#endif
+
+#define TR(params) _tracef params
+
#define ESC 27
#define TAB 9
#define MAX_LEN 2048
diff --git a/scripts/lxdialog/lxdialog.c b/scripts/lxdialog/lxdialog.c
index 33f99fb09..6f4c1fd4e 100644
--- a/scripts/lxdialog/lxdialog.c
+++ b/scripts/lxdialog/lxdialog.c
@@ -63,6 +63,9 @@ main (int argc, const char * const * argv)
(void) setlocale (LC_ALL, "");
#endif
+#ifdef TRACE
+ trace(TRACE_CALLS|TRACE_UPDATE);
+#endif
if (argc < 2) {
Usage (argv[0]);
exit (-1);
diff --git a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c
index 5d5a6b46f..d6170ec46 100644
--- a/scripts/lxdialog/menubox.c
+++ b/scripts/lxdialog/menubox.c
@@ -60,7 +60,7 @@ static int menu_width, item_x;
static void
print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey)
{
- int i, j;
+ int j;
char menu_item[menu_width+1];
strncpy(menu_item, item, menu_width);
@@ -70,8 +70,15 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey
/* Clear 'residue' of last item */
wattrset (win, menubox_attr);
wmove (win, choice, 0);
- for (i = 0; i < menu_width; i++)
- waddch (win, ' ');
+#if OLD_NCURSES
+ {
+ int i;
+ for (i = 0; i < menu_width; i++)
+ waddch (win, ' ');
+ }
+#else
+ wclrtoeol(win);
+#endif
wattrset (win, selected ? item_selected_attr : item_attr);
mvwaddstr (win, choice, item_x, menu_item);
if (hotkey) {
@@ -173,6 +180,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width,
for (i = 0; i < width - 2; i++)
waddch (dialog, ACS_HLINE);
wattrset (dialog, dialog_attr);
+ wbkgdset (dialog, dialog_attr & A_COLOR);
waddch (dialog, ACS_RTEE);
if (title != NULL) {
diff --git a/scripts/lxdialog/textbox.c b/scripts/lxdialog/textbox.c
index df50f2c54..415a42f87 100644
--- a/scripts/lxdialog/textbox.c
+++ b/scripts/lxdialog/textbox.c
@@ -90,6 +90,8 @@ dialog_textbox (const char *title, const char *file, int height, int width)
/* Create window for text region, used for scrolling text */
text = subwin (dialog, height - 4, width - 2, y + 1, x + 1);
+ wattrset (text, dialog_attr);
+ wbkgdset (text, dialog_attr & A_COLOR);
keypad (text, TRUE);
@@ -101,6 +103,7 @@ dialog_textbox (const char *title, const char *file, int height, int width)
for (i = 0; i < width - 2; i++)
waddch (dialog, ACS_HLINE);
wattrset (dialog, dialog_attr);
+ wbkgdset (dialog, dialog_attr & A_COLOR);
waddch (dialog, ACS_RTEE);
if (title != NULL) {
@@ -448,7 +451,7 @@ print_page (WINDOW * win, int height, int width)
static void
print_line (WINDOW * win, int row, int width)
{
- int i, y, x;
+ int y, x;
char *line;
line = get_line ();
@@ -459,8 +462,15 @@ print_line (WINDOW * win, int row, int width)
getyx (win, y, x);
/* Clear 'residue' of previous line */
- for (i = 0; i < width - x; i++)
- waddch (win, ' ');
+#if OLD_NCURSES
+ {
+ int i;
+ for (i = 0; i < width - x; i++)
+ waddch (win, ' ');
+ }
+#else
+ wclrtoeol(win);
+#endif
}
/*
@@ -530,6 +540,7 @@ print_position (WINDOW * win, int height, int width)
exit (-1);
}
wattrset (win, position_indicator_attr);
+ wbkgdset (win, position_indicator_attr & A_COLOR);
percent = !file_size ?
100 : ((fpos - bytes_read + page - buf) * 100) / file_size;
wmove (win, height - 3, width - 9);