summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-09-01 01:20:28 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-09-01 01:20:28 -0700
commit743ac8f1721cef695e1393f8bc76ccdb62445762 (patch)
tree1d138fac06f03f861c2f1020ab21a750147c93db
parent2facad3d8802ccc83bcfee902782a63ddf848bce (diff)
downloadsyslinux-743ac8f1721cef695e1393f8bc76ccdb62445762.tar.gz
Lots of fixes to make the graphical menu actually work.syslinux-3.30-pre1
-rw-r--r--com32/lib/Makefile2
-rw-r--r--com32/lib/sys/ansicon_write.c9
-rw-r--r--com32/lib/sys/ansiserial_write.c2
-rw-r--r--com32/lib/sys/colortable.c9
-rw-r--r--com32/lib/sys/vesa/drawtxt.c11
-rw-r--r--com32/lib/sys/vesa/initvesa.c9
-rw-r--r--com32/lib/sys/vesacon_write.c25
-rw-r--r--com32/lib/sys/xserial_write.c9
-rw-r--r--com32/modules/Makefile2
-rw-r--r--com32/modules/menu.c3
-rw-r--r--com32/modules/menumain.c146
-rw-r--r--com32/modules/readconfig.c20
-rw-r--r--com32/modules/vesamenu.c3
13 files changed, 139 insertions, 111 deletions
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 12d567a7..8b16422b 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -28,6 +28,8 @@ LIBOBJS = \
sys/fileinfo.o sys/opendev.o sys/read.o sys/write.o sys/ftell.o \
sys/close.o sys/open.o sys/fileread.o sys/fileclose.o \
sys/isatty.o sys/fstat.o sys/openconsole.o sys/line_input.o \
+ sys/colortable.o \
+ \
sys/stdcon_read.o sys/stdcon_write.o sys/rawcon_read.o \
sys/rawcon_write.o sys/err_read.o sys/err_write.o \
sys/null_read.o sys/null_write.o sys/serial_write.o \
diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c
index 9fcc075c..594a01fa 100644
--- a/com32/lib/sys/ansicon_write.c
+++ b/com32/lib/sys/ansicon_write.c
@@ -36,6 +36,7 @@
#include <string.h>
#include <com32.h>
#include <minmax.h>
+#include <colortbl.h>
#include <klibc/compiler.h>
#include "file.h"
@@ -519,7 +520,7 @@ static void ansicon_putchar(int ch)
{
int n = (unsigned char)ch - '0';
if (n < 10) {
- st.param[0] = n*10;
+ st.parms[0] = n*10;
st.state = st_sohc1;
} else {
st.state = st_init;
@@ -533,11 +534,11 @@ static void ansicon_putchar(int ch)
const char *p;
if (n < 10) {
- st.param[0] += n;
+ st.parms[0] += n;
/* Emulate the appropriate CSI m sequence */
- if (st.param[0] < console_color_table_size) {
+ if (st.parms[0] < console_color_table_size) {
st.state = st_csi;
- for (p = console_color_table[st.param[0]]; *p; p++)
+ for (p = console_color_table[st.parms[0]].ansi; *p; p++)
ansicon_putchar(*p);
ansicon_putchar('m');
}
diff --git a/com32/lib/sys/ansiserial_write.c b/com32/lib/sys/ansiserial_write.c
index bfb6ef20..d4521100 100644
--- a/com32/lib/sys/ansiserial_write.c
+++ b/com32/lib/sys/ansiserial_write.c
@@ -37,7 +37,7 @@
#include <minmax.h>
#include "file.h"
-extern int __ansicon_open(void);
+extern int __ansicon_open(struct file_info *);
extern int __ansicon_close(struct file_info *);
extern ssize_t __ansicon_write(struct file_info *, const void *, size_t);
extern ssize_t __xserial_write(struct file_info *, const void *, size_t);
diff --git a/com32/lib/sys/colortable.c b/com32/lib/sys/colortable.c
new file mode 100644
index 00000000..aa1ed6ed
--- /dev/null
+++ b/com32/lib/sys/colortable.c
@@ -0,0 +1,9 @@
+#include <colortbl.h>
+
+static struct color_table default_color_table[] = {
+ {"default", "0", 0xffffffff, 0x00000000 }
+};
+
+struct color_table *console_color_table = &default_color_table;
+int console_color_table_size =
+ (sizeof default_color_table/sizeof(struct color_table));
diff --git a/com32/lib/sys/vesa/drawtxt.c b/com32/lib/sys/vesa/drawtxt.c
index 08957443..820fc40e 100644
--- a/com32/lib/sys/vesa/drawtxt.c
+++ b/com32/lib/sys/vesa/drawtxt.c
@@ -190,9 +190,10 @@ void __vesacon_erase(int x0, int y0, int x1, int y1, uint8_t attr, int rev)
void __vesacon_scroll_up(int nrows, uint8_t attr, int rev)
{
struct vesa_char *fromptr = &__vesacon_text_display
- [nrows*(TEXT_PIXEL_COLS/FONT_WIDTH+2)];
- struct vesa_char *toptr = __vesacon_text_display;
- int dword_count = nrows*(TEXT_PIXEL_COLS/FONT_WIDTH+2);
+ [(nrows+1)*(TEXT_PIXEL_COLS/FONT_WIDTH+2)];
+ struct vesa_char *toptr = &__vesacon_text_display
+ [(TEXT_PIXEL_COLS/FONT_WIDTH+2)];
+ int dword_count = (__vesacon_text_rows-nrows)*(TEXT_PIXEL_COLS/FONT_WIDTH+2);
struct vesa_char fill = {
.ch = ' ',
.attr = attr,
@@ -202,7 +203,9 @@ void __vesacon_scroll_up(int nrows, uint8_t attr, int rev)
asm volatile("cld ; rep ; movsl"
: "+D" (toptr), "+S" (fromptr), "+c" (dword_count));
- dword_count = (__vesacon_text_rows-nrows)*(TEXT_PIXEL_COLS/FONT_WIDTH+2);
+ dword_count = nrows*(TEXT_PIXEL_COLS/FONT_WIDTH+2);
+
+ /* Danger, Will Robinson: this is wrong if rev != SHADOW_NORMAL */
vesacon_fill(toptr, fill, dword_count);
vesacon_update_characters(0, 0, __vesacon_text_rows,
diff --git a/com32/lib/sys/vesa/initvesa.c b/com32/lib/sys/vesa/initvesa.c
index 022fb321..ad551a91 100644
--- a/com32/lib/sys/vesa/initvesa.c
+++ b/com32/lib/sys/vesa/initvesa.c
@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
+#include <sys/fpu.h>
#include "vesa.h"
#include "video.h"
@@ -65,7 +66,7 @@ static void debug(const char *str, ...)
if (len >= sizeof buf)
len = sizeof buf - 1;
- __serial_write(NULL, buf, len);
+ //__serial_write(NULL, buf, len);
}
static void unpack_font(uint8_t *dst, uint8_t *src, int height)
@@ -194,7 +195,7 @@ static int init_text_display(void)
/* I really which C had a memset() for larger-than-bytes objects... */
asm volatile("cld; rep; stosl"
: "+D" (ptr), "+c" (nchars)
- : "a" (' '+(0x07 << 8)+(SHADOW_NORMAL << 16))
+ : "a" (' '+(0 << 8)+(SHADOW_NORMAL << 16))
: "memory");
return 0;
@@ -204,6 +205,10 @@ int __vesacon_init(void)
{
int rv;
+ /* We need the FPU for graphics, at least libpng et al will need it... */
+ if (x86_init_fpu())
+ return 10;
+
rv = vesacon_set_mode();
if (rv)
return rv;
diff --git a/com32/lib/sys/vesacon_write.c b/com32/lib/sys/vesacon_write.c
index cb0c5870..e0d47f3f 100644
--- a/com32/lib/sys/vesacon_write.c
+++ b/com32/lib/sys/vesacon_write.c
@@ -36,6 +36,7 @@
#include <string.h>
#include <com32.h>
#include <minmax.h>
+#include <colortbl.h>
#include <klibc/compiler.h>
#include "file.h"
#include "vesa/video.h"
@@ -158,15 +159,16 @@ static void showcursor(int yes)
static void vesacon_putchar(int ch)
{
- static com32sys_t ireg;
const int rows = __vesacon_text_rows;
- const int cols = VIDEO_X_SIZE/FONT_WIDTH;
- const int page = 0;
+ const int cols = TEXT_PIXEL_COLS/FONT_WIDTH;
struct curxy xy = st.xy;
switch ( st.state ) {
case st_init:
switch ( ch ) {
+ case 1:
+ st.state = st_soh;
+ break;
case '\b':
if ( xy.x > 0 ) xy.x--;
break;
@@ -232,6 +234,7 @@ static void vesacon_putchar(int ch)
memcpy(&st, &default_state, sizeof st);
vesacon_erase(0, 0, cols-1, rows-1);
xy.x = xy.y = 1;
+ st.state = st_init;
break;
default:
/* Ignore sequence */
@@ -468,7 +471,7 @@ static void vesacon_putchar(int ch)
{
int n = (unsigned char)ch - '0';
if (n < 10) {
- st.param[0] = n*10;
+ st.parms[0] = n*10;
st.state = st_sohc1;
} else {
st.state = st_init;
@@ -482,15 +485,17 @@ static void vesacon_putchar(int ch)
const char *p;
if (n < 10) {
- st.param[0] += n;
- if (st.param[0] < console_color_table_size) {
+ st.parms[0] += n;
+ if (st.parms[0] < console_color_table_size) {
/* Set the color table index */
- st.attr = st.param[0];
+ st.attr = st.parms[0];
/* See if there are any other attributes we care about */
- st.state = st_csi;
- for (p = console_color_table[st.param[0]]; *p; p++)
- vesacon_putchar(*p);
+ p = console_color_table[st.parms[0]].ansi;
+ st.state = st_esc;
+ vesacon_putchar('[');
+ while (*p)
+ vesacon_putchar(*p++);
vesacon_putchar('m');
}
}
diff --git a/com32/lib/sys/xserial_write.c b/com32/lib/sys/xserial_write.c
index 51a89e88..6b3fbaf9 100644
--- a/com32/lib/sys/xserial_write.c
+++ b/com32/lib/sys/xserial_write.c
@@ -55,6 +55,7 @@ ssize_t __xserial_write(struct file_info *fp, const void *buf, size_t count)
static enum { st_0, st_1, st_2, st_3 } state = st_0;
static int ncolor = 0;
int num;
+ const char *p;
(void)fp;
@@ -97,14 +98,12 @@ ssize_t __xserial_write(struct file_info *fp, const void *buf, size_t count)
if (ncolor < console_color_table_size) {
emit('\033');
emit('[');
- __xserial_write(fp, console_color_table[ncolor].ansi,
- strlen(console_color_table[ncolor].ansi));
+ for (p = console_color_table[ncolor].ansi; *p; p++)
+ emit(*p);
emit('m');
}
- state = st_0;
- } else {
- state = st_0;
}
+ state = st_0;
break;
}
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 860f9f78..c9f0a6ea 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -45,7 +45,7 @@ INCDIR = /usr/include
COM32DIR = $(AUXDIR)/com32
MODULES = chain.c32 menu.c32 vesamenu.c32 ethersel.c32 mboot.c32 dmitest.c32
-TESTFILES = menu.lnx
+TESTFILES =
all: $(MODULES) $(TESTFILES)
diff --git a/com32/modules/menu.c b/com32/modules/menu.c
index 248be357..b7338641 100644
--- a/com32/modules/menu.c
+++ b/com32/modules/menu.c
@@ -17,6 +17,9 @@
* a command line and/or edit it.
*/
+#include <consoles.h>
+#include "menu.h"
+
int main(int argc, char *argv[])
{
console_ansi_raw();
diff --git a/com32/modules/menumain.c b/com32/modules/menumain.c
index 9aca2eb1..c82a582d 100644
--- a/com32/modules/menumain.c
+++ b/com32/modules/menumain.c
@@ -38,37 +38,39 @@
int (*draw_background)(const char *filename);
-struct menu_attrib {
- const char *border; /* Border area */
- const char *title; /* Title bar */
- const char *unsel; /* Unselected menu item */
- const char *hotkey; /* Unselected hotkey */
- const char *sel; /* Selected */
- const char *hotsel; /* Selected hotkey */
- const char *scrollbar; /* Scroll bar */
- const char *tabmsg; /* Press [Tab] message */
- const char *cmdmark; /* Command line marker */
- const char *cmdline; /* Command line */
- const char *screen; /* Rest of the screen */
- const char *pwdborder; /* Password box border */
- const char *pwdheader; /* Password box header */
- const char *pwdentry; /* Password box contents */
- const char *timeout_msg; /* Timeout message */
- const char *timeout; /* Timeout counter */
-};
+/*
+ * The color/attribute indexes (\1#XX) are as follows
+ *
+ * 00 - screen Rest of the screen
+ * 01 - border Border area
+ * 02 - title Title bar
+ * 03 - unsel Unselected menu item
+ * 04 - hotkey Unselected hotkey
+ * 05 - sel Selection bar
+ * 06 - hotsel Selected hotkey
+ * 07 - scrollbar Scroll bar
+ * 08 - tabmsg Press [Tab] message
+ * 09 - cmdmark Command line marker
+ * 10 - cmdline Command line
+ * 11 - pwdborder Password box border
+ * 12 - pwdheader Password box header
+ * 13 - pwdentry Password box contents
+ * 14 - timeout_msg Timeout message
+ * 15 - timeout Timeout counter
+ */
static const struct color_table default_color_table[] = {
- { "border", "0;30;44", 0x80ffffff, 0x00000000 },
- { "title", "1;36;44", 0x80ffcc00, 0x00000000 },
- { "unsel", "0;37;44", 0x80ffffff, 0x00000000 },
+ { "screen", "0;37;40", 0x80ffffff, 0x00000000 },
+ { "border", "0;30;44", 0x40000000, 0x00000000 },
+ { "title", "1;36;44", 0xc00090f0, 0x00000000 },
+ { "unsel", "0;37;44", 0x90ffffff, 0x00000000 },
{ "hotkey", "1;37;44", 0xffffffff, 0x00000000 },
- { "sel", "0;7;37;40", 0xff000000, 0x20ff8000 },
- { "hotsel", "1;7;37;40", 0xff404040, 0x20ff8000 },
- { "scrollbar", "0;30;44", 0x80ffffff, 0x00000000 },
- { "tabmsg", "0;31;40", 0x80ff8000, 0x00000000 },
+ { "sel", "0;7;37;40", 0xcf101010, 0x20ff8000 },
+ { "hotsel", "1;7;37;40", 0xff353535, 0x20ff8000 },
+ { "scrollbar", "0;30;44", 0x40000000, 0x00000000 },
+ { "tabmsg", "0;31;40", 0x90ffff00, 0x00000000 },
{ "cmdmark", "1;36;40", 0xc000ffff, 0x00000000 },
{ "cmdline", "0;37;40", 0xc0ffffff, 0x00000000 },
- { "screen", "0;37;40", 0x80ffffff, 0x00000000 },
{ "pwdborder", "0;30;47", 0x80ffffff, 0x20ffffff },
{ "pwdheader", "0;31;47", 0x80ff8080, 0x20ffffff },
{ "pwdentry", "0;30;47", 0x80ffffff, 0x20ffffff },
@@ -77,7 +79,6 @@ static const struct color_table default_color_table[] = {
};
#define NCOLORS (sizeof default_color_table/sizeof(struct color_table))
-static struct color_table color_table[NCOLORS];
struct menu_parameter mparm[] = {
{ "width", 80 },
@@ -108,6 +109,7 @@ install_default_color_table(void)
unsigned int i;
const struct color_table *dp;
struct color_table *cp;
+ static struct color_table color_table[NCOLORS];
dp = default_color_table;
cp = color_table;
@@ -116,8 +118,13 @@ install_default_color_table(void)
if (cp->ansi)
free((void *)cp->ansi);
- *cp++ = *dp++;
- cp->ansi = strdup(cp->ansi);
+ cp->name = dp->name;
+ cp->ansi = strdup(dp->ansi);
+ cp->argb_fg = dp->argb_fg;
+ cp->argb_bg = dp->argb_bg;
+
+ cp++;
+ dp++;
}
console_color_table = color_table;
@@ -180,26 +187,25 @@ draw_row(int y, int sel, int top, int sbtop, int sbbot)
{
int i = (y-4)+top;
- printf("\033[%d;%dH%s\016x\017%s ",
- y, MARGIN+1, menu_attrib->border,
- (i == sel) ? menu_attrib->sel : menu_attrib->unsel);
+ printf("\033[%d;%dH\1#01\016x\017%s ",
+ y, MARGIN+1, (i == sel) ? "\1#05" : "\1#03");
if ( i >= nentries ) {
fputs(pad_line("", 0, WIDTH-2*MARGIN-4), stdout);
} else {
display_entry(&menu_entries[i],
- (i == sel) ? menu_attrib->sel : menu_attrib->unsel,
- (i == sel) ? menu_attrib->hotsel : menu_attrib->hotkey,
+ (i == sel) ? "\1#05" : "\1#03",
+ (i == sel) ? "\1#06" : "\1#04",
WIDTH-2*MARGIN-4);
}
if ( nentries <= MENU_ROWS ) {
- printf(" %s\016x\017", menu_attrib->border);
+ printf(" \1#01\016x\017");
} else if ( sbtop > 0 ) {
if ( y >= sbtop && y <= sbbot )
- printf(" %s\016a\017", menu_attrib->scrollbar);
+ printf(" \1#07\016a\017");
else
- printf(" %s\016x\017", menu_attrib->border);
+ printf(" \1#01\016x\017");
} else {
putchar(' '); /* Don't modify the scrollbar */
}
@@ -221,13 +227,13 @@ passwd_compare(const char *passwd, const char *entry)
SHA1Init(&ctx);
if ( (p = strchr(passwd+3, '$')) ) {
- SHA1Update(&ctx, passwd+3, p-(passwd+3));
+ SHA1Update(&ctx, (void *)passwd+3, p-(passwd+3));
p++;
} else {
p = passwd+3; /* Assume no salt */
}
- SHA1Update(&ctx, entry, strlen(entry));
+ SHA1Update(&ctx, (void *)entry, strlen(entry));
SHA1Final(sha1, &ctx);
memset(pwdsha1, 0, 20);
@@ -281,8 +287,7 @@ ask_passwd(const char *menu_entry)
int key;
int x;
- printf("\033[%d;%dH%s\016l", PASSWD_ROW, PASSWD_MARGIN+1,
- menu_attrib->pwdborder);
+ printf("\033[%d;%dH\1#11\016l", PASSWD_ROW, PASSWD_MARGIN+1);
for ( x = 2 ; x <= WIDTH-2*PASSWD_MARGIN-1 ; x++ )
putchar('q');
@@ -294,10 +299,9 @@ ask_passwd(const char *menu_entry)
for ( x = 2 ; x <= WIDTH-2*PASSWD_MARGIN-1 ; x++ )
putchar('q');
- printf("j\017\033[%d;%dH%s %s \033[%d;%dH%s",
+ printf("j\017\033[%d;%dH\1#12 %s \033[%d;%dH\1#13",
PASSWD_ROW, (WIDTH-((int)sizeof(title)+1))/2,
- menu_attrib->pwdheader, title,
- PASSWD_ROW+1, PASSWD_MARGIN+3, menu_attrib->pwdentry);
+ title, PASSWD_ROW+1, PASSWD_MARGIN+3);
/* Actually allow user to type a password, then compare to the SHA1 */
done = 0;
@@ -368,18 +372,15 @@ draw_menu(int sel, int top, int edit_line)
sbtop += 4; sbbot += 4; /* Starting row of scrollbar */
}
- printf("\033[1;%dH%s\016l", MARGIN+1, menu_attrib->border);
+ printf("\033[1;%dH\1#01\016l", MARGIN+1);
for ( x = 2 ; x <= WIDTH-2*MARGIN-1 ; x++ )
putchar('q');
- printf("k\033[2;%dH%sx\017%s %s %s\016x",
+ printf("k\033[2;%dH\1#01x\017\1#02 %s \1#01\016x",
MARGIN+1,
- menu_attrib->border,
- menu_attrib->title,
- pad_line(menu_title, 1, WIDTH-2*MARGIN-4),
- menu_attrib->border);
+ pad_line(menu_title, 1, WIDTH-2*MARGIN-4));
- printf("\033[3;%dH%st", MARGIN+1, menu_attrib->border);
+ printf("\033[3;%dH\1#01t", MARGIN+1);
for ( x = 2 ; x <= WIDTH-2*MARGIN-1 ; x++ )
putchar('q');
fputs("u\017", stdout);
@@ -387,16 +388,22 @@ draw_menu(int sel, int top, int edit_line)
for ( y = 4 ; y < 4+MENU_ROWS ; y++ )
draw_row(y, sel, top, sbtop, sbbot);
- printf("\033[%d;%dH%s\016m", y, MARGIN+1, menu_attrib->border);
+ printf("\033[%d;%dH\1#01\016m", y, MARGIN+1);
for ( x = 2 ; x <= WIDTH-2*MARGIN-1 ; x++ )
putchar('q');
fputs("j\017", stdout);
if ( edit_line && allowedit && !menu_master_passwd )
- printf("%s\033[%d;1H%s", menu_attrib->tabmsg, TABMSG_ROW,
+ printf("\1#08\033[%d;1H%s", TABMSG_ROW,
pad_line("Press [Tab] to edit options", 1, WIDTH));
- printf("%s\033[%d;1H", menu_attrib->screen, END_ROW);
+ printf("\1#00\033[%d;1H", END_ROW);
+}
+
+static void
+clear_screen(void)
+{
+ fputs("\033e\033%@\033)0\033(B\1#00\033[?25l\033[2J", stdout);
}
static const char *
@@ -417,18 +424,17 @@ edit_cmdline(char *input, int top)
/* Clear and redraw whole screen */
/* Enable ASCII on G0 and DEC VT on G1; do it in this order
to avoid confusing the Linux console */
- printf("\033e\033%%@\033)0\033(B%s\033[?25l\033[2J", menu_attrib->screen);
+ clear_screen();
draw_menu(-1, top, 1);
prev_len = 0;
}
if ( redraw > 0 ) {
/* Redraw the command line */
- printf("\033[?25l\033[%d;1H%s> %s%s",
- CMDLINE_ROW, menu_attrib->cmdmark,
- menu_attrib->cmdline, pad_line(cmdline, 0, prev_len));
- printf("%s\033[%d;3H%s\033[?25h",
- menu_attrib->cmdline, CMDLINE_ROW, pad_line(cmdline, 0, cursor));
+ printf("\033[?25l\033[%d;1H\1#09> \1#10%s",
+ CMDLINE_ROW, pad_line(cmdline, 0, prev_len));
+ printf("\1#10\033[%d;3H%s\033[?25h",
+ CMDLINE_ROW, pad_line(cmdline, 0, cursor));
prev_len = len;
redraw = 0;
}
@@ -549,12 +555,6 @@ edit_cmdline(char *input, int top)
}
}
-static void
-clear_screen(void)
-{
- printf("\033e\033%%@\033)0\033(B%s\033[?25l\033[2J", menu_attrib->screen);
-}
-
static inline int
shift_is_held(void)
{
@@ -633,11 +633,8 @@ run_menu(void)
if ( key_timeout ) {
int tol = timeout_left/CLK_TCK;
int nc = snprintf(NULL, 0, " Automatic boot in %d seconds ", tol);
- printf("\033[%d;%dH%s Automatic boot in %s%d%s seconds ",
- TIMEOUT_ROW, 1+((WIDTH-nc)>>1),
- menu_attrib->timeout_msg,
- menu_attrib->timeout, tol,
- menu_attrib->timeout_msg);
+ printf("\033[%d;%dH\1#14 Automatic boot in \1#15%d\1#14 seconds ",
+ TIMEOUT_ROW, 1+((WIDTH-nc)>>1), tol);
to_clear = 1;
} else {
to_clear = 0;
@@ -649,7 +646,7 @@ run_menu(void)
if ( key != KEY_NONE ) {
timeout_left = key_timeout;
if ( to_clear )
- printf("\033[%d;1H%s\033[K", TIMEOUT_ROW, menu_attrib->screen);
+ printf("\033[%d;1H\1#00\033[K", TIMEOUT_ROW);
}
switch ( key ) {
@@ -753,7 +750,7 @@ run_menu(void)
draw_menu(-1, top, 0);
} else {
/* Erase [Tab] message */
- printf("\033[%d;1H%s\033[K", TABMSG_ROW, menu_attrib->screen);
+ printf("\033[%d;1H\1#00\033[K", TABMSG_ROW);
}
if ( ok ) {
@@ -849,7 +846,10 @@ int menu_main(int argc, char *argv[])
{
const char *cmdline;
+ (void)argc;
+
install_default_color_table();
+ fputs("\1#00", stdout);
parse_config(argv[1]);
diff --git a/com32/modules/readconfig.c b/com32/modules/readconfig.c
index a7af6826..7d2ee21a 100644
--- a/com32/modules/readconfig.c
+++ b/com32/modules/readconfig.c
@@ -16,6 +16,7 @@
#include <string.h>
#include <minmax.h>
#include <alloca.h>
+#include <colortbl.h>
#ifdef __COM32__
# include <com32.h>
#endif
@@ -220,7 +221,7 @@ unlabel(char *str)
return str;
}
-static const char *
+static char *
dup_word(char **p)
{
char *sp = *p;
@@ -250,7 +251,6 @@ static int my_isxdigit(char c)
static unsigned int hexval(char c)
{
- int v;
unsigned char uc = c | 0x20;
if (uc & 0x40)
@@ -303,9 +303,9 @@ static unsigned int parse_argb(char **p)
dl = len/3;
argb =
0xff000000 |
- (hexval2(sp[0]) << 16) |
- (hexval2(sp[dl]) << 8)|
- (hexval2(sp[dl*2]) << 0);
+ (hexval2(sp+0) << 16) |
+ (hexval2(sp+dl) << 8)|
+ (hexval2(sp+dl*2) << 0);
break;
case 8: /* #aarrggbb */
/* 12 is indistinguishable from #rrrrggggbbbb,
@@ -313,10 +313,10 @@ static unsigned int parse_argb(char **p)
case 16: /* #aaaarrrrggggbbbb */
dl = len/4;
argb =
- (hexval2(sp[0]) << 24) |
- (hexval2(sp[dl]) << 16) |
- (hexval2(sp[dl*2]) << 8)|
- (hexval2(sp[dl*3]) << 0);
+ (hexval2(sp+0) << 24) |
+ (hexval2(sp+dl) << 16) |
+ (hexval2(sp+dl*2) << 8)|
+ (hexval2(sp+dl*3) << 0);
break;
default:
argb = 0;
@@ -373,7 +373,7 @@ void parse_config(const char *filename)
if ( looking_at(p, "passwd") ) {
menu_master_passwd = strdup(skipspace(p+6));
}
- } else if ( (ep = looking_at("background")) ) {
+ } else if ( (ep = looking_at(p, "background")) ) {
p = skipspace(ep);
menu_background = dup_word(&p);
} else if ((ep = looking_at(p, "color")) ||
diff --git a/com32/modules/vesamenu.c b/com32/modules/vesamenu.c
index 01a0ecab..8d386d00 100644
--- a/com32/modules/vesamenu.c
+++ b/com32/modules/vesamenu.c
@@ -34,7 +34,8 @@ int vesacon_load_background(const char *);
int main(int argc, char *argv[])
{
openconsole(&dev_rawcon_r, &dev_vesaserial_w);
-
+ fputs("\033[0m\033[20h", stdout);
+
draw_background = vesacon_load_background;
return menu_main(argc, argv);