Fix reboot options handling; now one-letter kernel names can also be booted.

This commit is contained in:
pk 2003-01-16 11:33:21 +00:00
parent b3df6303a9
commit 26fa27a910
1 changed files with 15 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.219 2003/01/13 16:59:17 pk Exp $ */
/* $NetBSD: machdep.c,v 1.220 2003/01/16 11:33:21 pk Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -739,6 +739,7 @@ cpu_reboot(howto, user_boot_string)
char *user_boot_string;
{
int i;
char opts[4];
static char str[128];
/* If system is cold, just halt. */
@ -828,26 +829,24 @@ cpu_reboot(howto, user_boot_string)
}
printf("rebooting\n\n");
i = 1;
if (howto & RB_SINGLE)
opts[i++] = 's';
if (howto & RB_KDB)
opts[i++] = 'd';
opts[i] = '\0';
opts[0] = (i > 1) ? '-' : '\0';
if (user_boot_string && *user_boot_string) {
i = strlen(user_boot_string);
if (i > sizeof(str))
if (i > sizeof(str) - sizeof(opts) - 1)
prom_boot(user_boot_string); /* XXX */
bcopy(user_boot_string, str, i);
} else {
i = 1;
str[0] = '\0';
if (opts[0] != '\0')
str[i] = ' ';
}
if (howto & RB_SINGLE)
str[i++] = 's';
if (howto & RB_KDB)
str[i++] = 'd';
if (i > 1) {
if (str[0] == '\0')
str[0] = '-';
str[i] = 0;
} else
str[0] = 0;
strcat(str, opts);
prom_boot(str);
/*NOTREACHED*/
}