* It is now supported to load a different configuration file
with the CONFIG keyword.
* Fix API call 0x0019 (Read Disk.)
+ * MENU AUTOBOOT, MENU TABMSG, MENU PASSPROMPT allows
+ internationalization of menu messages.
Changes in 3.36:
* MEMDISK: Disable EDD by default on floppy disks. EDD can be
command, so any labels defined in it are unavailable.
+MENU AUTOBOOT message
+
+ Replaces the message "Automatic boot in # seconds". The
+ symbol # is replaced with the number of seconds remaining.
+
+
+MENU TABMSG message
+
+ Replaces the message "Press [Tab] to edit options".
+
+
+MENU PASSPROMPT message
+
+ Replaces the message "Password required".
+
+
MENU COLOR element ansi foreground background shadow
Sets the color of element "element" to the specified color
extern char *ontimeout;
extern char *onerror;
extern char *menu_master_passwd;
+extern char *menu_tab_msg;
+extern char *menu_autoboot_msg;
+extern char *menu_passprompt_msg;
extern char *menu_background;
static int
ask_passwd(const char *menu_entry)
{
- static const char title[] = "Password required";
char user_passwd[WIDTH], *p;
int done;
int key;
putchar('q');
printf("j\017\033[%d;%dH\1#12 %s \033[%d;%dH\1#13",
- PASSWD_ROW, (WIDTH-((int)sizeof(title)+1))/2,
- title, PASSWD_ROW+1, PASSWD_MARGIN+3);
+ PASSWD_ROW, (WIDTH-(strlen(menu_passprompt_msg)+2))/2,
+ menu_passprompt_msg, PASSWD_ROW+1, PASSWD_MARGIN+3);
/* Actually allow user to type a password, then compare to the SHA1 */
done = 0;
fputs("j\017", stdout);
if ( edit_line && allowedit && !menu_master_passwd )
- printf("\1#08\033[%d;1H%s", TABMSG_ROW,
- pad_line("Press [Tab] to edit options", 1, WIDTH));
+ printf("\1#08\033[%d;1H%s", TABMSG_ROW, pad_line(menu_tab_msg, 1, WIDTH));
printf("\1#00\033[%d;1H", END_ROW);
}
key_timeout = 0;
if ( key_timeout ) {
+ char buf[256];
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);
+ int nc = 0, nnc;
+ const char *tp = menu_autoboot_msg;
+ char tc;
+ char *tq = buf;
+
+ while ((tq-buf) < (sizeof buf-16) && (tc = *tp)) {
+ if (tc == '#') {
+ nnc = sprintf(tq, "\1#15%d\1#14", tol);
+ tq += nnc;
+ nc += nnc-8; /* 8 formatting characters */
+ } else {
+ *tq++ = tc;
+ nc++;
+ }
+ tp++;
+ }
+ *tq = '\0';
+
+ printf("\033[%d;%dH\1#14 %s ", TIMEOUT_ROW, 1+((WIDTH-nc)>>1), buf);
to_clear = 1;
} else {
to_clear = 0;
int shiftkey = 0; /* Only display menu if shift key pressed */
long long totaltimeout = 0;
-char *menu_title = "";
+char *menu_title = NULL;
char *ontimeout = NULL;
char *onerror = NULL;
char *menu_master_passwd = NULL;
+char *menu_tab_msg;
+char *menu_autoboot_msg;
+char *menu_passprompt_msg;
+
char *menu_background = NULL;
struct menu_entry menu_entries[MAX_ENTRIES];
if (menu_background)
free(menu_background);
menu_background = dup_word(&p);
+ } else if ( (ep = looking_at(p, "autoboot")) ) {
+ free(menu_autoboot_msg);
+ menu_autoboot_msg = strdup(skipspace(ep));
+ } else if ( (ep = looking_at(p, "tabmsg")) ) {
+ free(menu_tab_msg);
+ menu_tab_msg = strdup(skipspace(ep));
+ } else if ( (ep = looking_at(p, "passprompt")) ) {
+ free(menu_passprompt_msg);
+ menu_passprompt_msg = strdup(skipspace(ep));
} else if ((ep = looking_at(p, "color")) ||
(ep = looking_at(p, "colour"))) {
int i;
{
const char *filename;
+ /* Initialize defaults */
+
+ menu_title = strdup("");
+ menu_tab_msg = strdup("Press [Tab] to edit options");
+ menu_autoboot_msg = strdup("Automatic boot in # sections");
+ menu_passprompt_msg = strdup("Password required");
+
+ /* Other initialization */
+
get_ipappend();
+ /* Actually process the files */
+
if ( !*argv ) {
parse_one_config("~");
} else {