diff -up syslinux-3.36/com32/lib/sys/ansicon_write.c.hidden syslinux-3.36/com32/lib/sys/ansicon_write.c --- syslinux-3.36/com32/lib/sys/ansicon_write.c.hidden 2007-02-10 15:47:07.000000000 -0500 +++ syslinux-3.36/com32/lib/sys/ansicon_write.c 2007-08-14 13:20:46.000000000 -0400 @@ -88,15 +88,15 @@ int __ansicon_open(struct file_info *fp) if ( (signed char)oreg.ebx.b[1] < 0 ) { ti.disabled = 1; } else { + /* Force text mode */ + ireg.eax.w[0] = 0x0005; + __intcall(0x22, &ireg, NULL); + /* Initial state */ ti.rows = BIOS_ROWS ? BIOS_ROWS+1 : 25; ti.cols = BIOS_COLS; __ansi_init(&ti); - /* Force text mode */ - ireg.eax.w[0] = 0x0005; - __intcall(0x22, &ireg, NULL); - /* Get cursor shape and position */ ireg.eax.b[1] = 0x03; ireg.ebx.b[1] = BIOS_PAGE; diff -up syslinux-3.36/com32/modules/menu.h.hidden syslinux-3.36/com32/modules/menu.h --- syslinux-3.36/com32/modules/menu.h.hidden 2007-02-10 15:47:08.000000000 -0500 +++ syslinux-3.36/com32/modules/menu.h 2007-08-14 13:20:46.000000000 -0400 @@ -56,6 +56,7 @@ extern int defentry; extern int allowedit; extern int timeout; extern int shiftkey; +extern int hiddenmenu; extern long long totaltimeout; extern char *menu_title; diff -up syslinux-3.36/com32/modules/menumain.c.hidden syslinux-3.36/com32/modules/menumain.c --- syslinux-3.36/com32/modules/menumain.c.hidden 2007-02-10 15:47:08.000000000 -0500 +++ syslinux-3.36/com32/modules/menumain.c 2007-08-14 13:41:18.000000000 -0400 @@ -90,6 +90,7 @@ struct menu_parameter mparm[] = { { "endrow", -1 }, { "passwordrow", 11 }, { "timeoutrow", 20 }, + { "hiddenrow", -2 }, { NULL, 0 } }; @@ -102,6 +103,7 @@ struct menu_parameter mparm[] = { #define END_ROW mparm[6].value #define PASSWD_ROW mparm[7].value #define TIMEOUT_ROW mparm[8].value +#define HIDDEN_ROW mparm[9].value static void install_default_color_table(void) @@ -561,6 +563,61 @@ shift_is_held(void) return !!(shift_bits & 0x5d); /* Caps/Scroll/Alt/Shift */ } +static void +print_timeout_message(int tol, int row, const char *msg) +{ +#define HSHIFT 0 + char buf[256]; + int nc = 0, nnc; + const char *tp = msg; + char tc; + char *tq = buf; + + while ((size_t)(tq-buf) < (sizeof buf-16) && (tc = *tp)) { + if (tc == '#') { + nnc = sprintf(tq, "%d", tol); + tq += nnc; + nc += nnc-8; /* 8 formatting characters */ + } else { + *tq++ = tc; + nc++; + } + tp++; + } + *tq = '\0'; + + printf("\033[%d;%dH\2 %s ", row, HSHIFT+1+((WIDTH-nc-2)>>1), buf); +} + +static const char * +do_hidden_menu(void) +{ + int key; + int timeout_left, this_timeout; + + clear_screen(); + + if ( !setjmp(timeout_jump) ) { + timeout_left = timeout; + + while (!timeout || timeout_left) { + int tol = timeout_left/CLK_TCK; + + print_timeout_message(tol, HIDDEN_ROW, " Automatic boot in # seconds "); + + this_timeout = min(timeout_left, CLK_TCK); + key = mygetkey(this_timeout); + + if (key != KEY_NONE) + return NULL; /* Key pressed */ + + timeout_left -= this_timeout; + } + } + + return menu_entries[defentry].cmdline; /* Default entry */ +} + static const char * run_menu(void) { @@ -580,6 +637,18 @@ run_menu(void) return menu_entries[defentry].cmdline; } + /* Handle hiddenmenu */ + if ( hiddenmenu ) { + cmdline = do_hidden_menu(); + if (cmdline) + return cmdline; + + /* Otherwise display the menu now; the timeout has already been + cancelled, since the user pressed a key. */ + hiddenmenu = 0; + key_timeout = 0; + } + /* Handle both local and global timeout */ if ( setjmp(timeout_jump) ) { entry = defentry; @@ -632,7 +701,7 @@ run_menu(void) int tol = timeout_left/CLK_TCK; int nc = snprintf(NULL, 0, " Automatic boot in %d seconds ", tol); printf("\033[%d;%dH\1#14 Automatic boot in \1#15%d\1#14 seconds ", - TIMEOUT_ROW, 1+((WIDTH-nc)>>1), tol); + TIMEOUT_ROW, 1+((WIDTH-nc)>>1), tol); to_clear = 1; } else { to_clear = 0; diff -up syslinux-3.36/com32/modules/readconfig.c.hidden syslinux-3.36/com32/modules/readconfig.c --- syslinux-3.36/com32/modules/readconfig.c.hidden 2007-02-10 15:47:08.000000000 -0500 +++ syslinux-3.36/com32/modules/readconfig.c 2007-08-14 13:21:22.000000000 -0400 @@ -30,6 +30,7 @@ int defentry = 0; int allowedit = 1; /* Allow edits of the command line */ int timeout = 0; int shiftkey = 0; /* Only display menu if shift key pressed */ +int hiddenmenu = 0; long long totaltimeout = 0; char *menu_title = ""; @@ -417,6 +418,8 @@ static void parse_config_file(FILE *f) if (menu_background) free(menu_background); menu_background = dup_word(&p); + } else if ( (ep = looking_at(p, "hidden")) ) { + hiddenmenu = 1; } else if ((ep = looking_at(p, "color")) || (ep = looking_at(p, "colour"))) { int i;