diff options
author | 2009-04-30 01:12:44 +0000 | |
---|---|---|
committer | 2009-04-30 01:12:44 +0000 | |
commit | 26bbaf19c7f969405feb955a20a31c099765a574 (patch) | |
tree | 905c25001667e1f5889de473b0f3b6bdddc6762d | |
parent | Allow the user's password to not be set, but in that case do not leave it (diff) | |
download | wireguard-openbsd-26bbaf19c7f969405feb955a20a31c099765a574.tar.xz wireguard-openbsd-26bbaf19c7f969405feb955a20a31c099765a574.zip |
add another settable variable called db_console which the MD parts of a
bootloader will pass to the kernel to allow you to force ddb.console to be
set (and set early) on a machine without having to do it on a per kernel
basis using code or config tweaks.
requested by art@ (who owes me good whiskey now)
no problem! deraadt@
-rw-r--r-- | sys/stand/boot/vars.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/stand/boot/vars.c b/sys/stand/boot/vars.c index d889be91945..4cb31d95924 100644 --- a/sys/stand/boot/vars.c +++ b/sys/stand/boot/vars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vars.c,v 1.13 2005/05/24 20:48:35 uwe Exp $ */ +/* $OpenBSD: vars.c,v 1.14 2009/04/30 01:12:44 dlg Exp $ */ /* * Copyright (c) 1998-2000 Michael Shalayeff @@ -35,12 +35,14 @@ extern char prog_ident[]; extern int debug; +int db_console = -1; static int Xaddr(void); static int Xdevice(void); #ifdef DEBUG static int Xdebug(void); #endif +static int Xdb_console(void); static int Ximage(void); static int Xhowto(void); static int Xtty(void); @@ -58,6 +60,7 @@ const struct cmd_table cmd_set[] = { {"tty", CMDT_VAR, Xtty}, {"image", CMDT_VAR, Ximage}, {"timeout",CMDT_VAR, Xtimeout}, + {"db_console", CMDT_VAR, Xdb_console}, {NULL,0} }; @@ -75,6 +78,33 @@ Xdebug(void) } #endif +int +Xdb_console(void) +{ + if (cmd.argc != 2) { + switch (db_console) { + case 0: + printf("off\n"); + break; + case 1: + printf("on\n"); + break; + default: + printf("unset\n"); + break; + } + } else { + if (strcmp(cmd.argv[1], "0") == 0 || + strcmp(cmd.argv[1], "off") == 0) + db_console = 0; + else if (strcmp(cmd.argv[1], "1") == 0 || + strcmp(cmd.argv[1], "on") == 0) + db_console = 1; + } + + return (0); +} + static int Xtimeout(void) { |