diff options
author | Tom Cosgrove <tom@cvs.openbsd.org> | 2004-06-24 22:10:19 +0000 |
---|---|---|
committer | Tom Cosgrove <tom@cvs.openbsd.org> | 2004-06-24 22:10:19 +0000 |
commit | f3d661eb8e637d97d8ae225211419f3ca300e4e1 (patch) | |
tree | b37aa30aa93d3e5de1e74c1469e0fe87d4a8ccd5 /sys | |
parent | 3da9c2f3810100c666999a5f2c6941f9c5df3d20 (diff) |
Minor changes (structural, not behavioural) in order to support a regress
test for boot command handling.
Suggested by avsm@; discussed with avsm@ and weingart@ - thanks
Diffstat (limited to 'sys')
-rw-r--r-- | sys/stand/boot/cmd.c | 22 | ||||
-rw-r--r-- | sys/stand/boot/cmd.h | 5 |
2 files changed, 20 insertions, 7 deletions
diff --git a/sys/stand/boot/cmd.c b/sys/stand/boot/cmd.c index 258dde30634..fe778ccdf07 100644 --- a/sys/stand/boot/cmd.c +++ b/sys/stand/boot/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.53 2004/06/24 16:38:59 tom Exp $ */ +/* $OpenBSD: cmd.c,v 1.54 2004/06/24 22:10:18 tom Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -24,13 +24,19 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * */ #include <sys/param.h> -#include <libsa.h> #include <sys/reboot.h> + +#ifdef REGRESS +#include <sys/stat.h> +#include <errno.h> +#else +#include <libsa.h> #include <lib/libkern/funcs.h> +#endif + #include "cmd.h" #define CTRL(c) ((c)&0x1f) @@ -72,10 +78,9 @@ static void ls(char *, struct stat *); static int readline(char *, size_t, int); char *nextword(char *); static char *whatcmd(const struct cmd_table **ct, char *); -static int docmd(void); static char *qualify(char *); -char cmd_buf[133]; +char cmd_buf[CMD_BUFF_SIZE]; int getcmd(void) @@ -144,7 +149,7 @@ read_conf(void) return rc; } -static int +int docmd(void) { char *p = NULL; @@ -195,7 +200,12 @@ docmd(void) } cmd.argv[cmd.argc] = NULL; +#ifdef REGRESS + printf("%s %s\n", cmd.argv[0], + (cmd.argv[1] == NULL) ? "(null)" : cmd.argv[1]); +#else return (*cmd.cmd->cmd_exec)(); +#endif } static char * diff --git a/sys/stand/boot/cmd.h b/sys/stand/boot/cmd.h index bc7547eaffb..d123530964c 100644 --- a/sys/stand/boot/cmd.h +++ b/sys/stand/boot/cmd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.h,v 1.14 2003/08/11 06:23:07 deraadt Exp $ */ +/* $OpenBSD: cmd.h,v 1.15 2004/06/24 22:10:18 tom Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -27,6 +27,7 @@ * */ +#define CMD_BUFF_SIZE 133 struct cmd_table { char *cmd_name; @@ -57,3 +58,5 @@ int getcmd(void); int read_conf(void); int bootparse(int); void boot(dev_t); + +int docmd(void); /* No longer static: needed by regress test */ |