diff --git a/share/man/man5/boot.cfg.5 b/share/man/man5/boot.cfg.5 index 244b7c946f88..cb467df1c6cd 100644 --- a/share/man/man5/boot.cfg.5 +++ b/share/man/man5/boot.cfg.5 @@ -1,4 +1,4 @@ -.\" $NetBSD: boot.cfg.5,v 1.3 2007/11/22 15:27:22 sborrill Exp $ +.\" $NetBSD: boot.cfg.5,v 1.4 2008/01/05 19:29:16 apb Exp $ .\" .\" Copyright (c) 2007 Stephen Borrill .\" All rights reserved. @@ -67,12 +67,16 @@ banner line with no value should be given. Used to define a menu item to be displayed to the end-user at boot time which allows a series of boot commands to be run without further typing. The value consists of the required menu text, followed by a colon -.Po So : Sc Pc +.Pq Sq \&: and then the desired command. +If the specified menu text is empty +(the colon appears immediately after the equals sign), +then the displayed menu text is the same as the command. For example: .Bd -literal menu=Boot normally:boot menu=Boot single-user:boot -s +menu=:boot hd1a:netbsd -as .Ed .Pp Each menu item will be prefixed by an ascending number when displayed, diff --git a/sys/arch/i386/stand/boot/boot2.c b/sys/arch/i386/stand/boot/boot2.c index f3632aeffeb2..0c1f6e51d779 100644 --- a/sys/arch/i386/stand/boot/boot2.c +++ b/sys/arch/i386/stand/boot/boot2.c @@ -1,4 +1,4 @@ -/* $NetBSD: boot2.c,v 1.20 2008/01/02 10:39:39 sborrill Exp $ */ +/* $NetBSD: boot2.c,v 1.21 2008/01/05 19:29:16 apb Exp $ */ /* * Copyright (c) 2003 @@ -288,6 +288,7 @@ atoi(const char *in) * banner=Please choose the boot type from the following menu * menu=Boot NetBSD:boot netbsd * menu=Boot into single user mode:boot netbsd -s + * menu=:boot hd1a:netbsd -cs * menu=Goto boot comand line:prompt * timeout=10 * consdev=com0 @@ -300,7 +301,7 @@ parsebootconf(const char *conf) int cmenu, cbanner, len; int fd, err, off; struct stat st; - char *value, *key; + char *key, *value, *v2; #ifdef SUPPORT_USTARFS void *op_open; #endif @@ -375,15 +376,23 @@ parsebootconf(const char *conf) *c = 0; if (!strncmp(key, "menu", 4)) { + /* + * Parse "menu=:". If the + * description is empty ("menu=:)", + * then re-use the command as the description. + * Note that the command may contain embedded + * colons. + */ if (cmenu >= MAXMENU) continue; bootconf.desc[cmenu] = value; - /* Look for : between description and command */ - for (; *value && *value != ':'; value++) + for (v2=value; *v2 && *v2 != ':'; v2++) continue; - if(*value) { - *value++ = 0; - bootconf.command[cmenu] = value; + if (*v2) { + *v2++ = 0; + bootconf.command[cmenu] = v2; + if (! *value) + bootconf.desc[cmenu] = v2; cmenu++; } else { /* No delimiter means invalid line */