From ddaee943da158660c96670e7142298cf36772f9b Mon Sep 17 00:00:00 2001 From: gvf Date: Thu, 17 Apr 1997 19:16:39 +0000 Subject: [PATCH] Added -q to return to Motorola bug. Added loop to prompt for kernel name if it is not found. --- sys/arch/mvme68k/stand/bootsd/boot.c | 30 +++++++++++++++++++---- sys/arch/mvme68k/stand/libsa/libsa.h | 2 +- sys/arch/mvme68k/stand/libsa/parse_args.c | 7 ++++-- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/sys/arch/mvme68k/stand/bootsd/boot.c b/sys/arch/mvme68k/stand/bootsd/boot.c index 646dcb1d547..1fcc0bdf2e6 100644 --- a/sys/arch/mvme68k/stand/bootsd/boot.c +++ b/sys/arch/mvme68k/stand/bootsd/boot.c @@ -46,19 +46,39 @@ int debug; int errno; extern char *version; +char line[80]; int main() { char *cp, *file; - int io, flag; + int io, flag, ret; + int ask = 0; printf(">> OpenBSD MVME%x bootsd [%s]\n", bugargs.cputyp, version); - parse_args(&file, &flag); + ret = parse_args(&file, &flag); - exec_mvme(file, flag); - - printf("boot: %s: %s\n", file, strerror(errno)); + for (;;) { + if (ask) { + printf("boot: "); + gets(line); + if (line[0]) { + bugargs.arg_start = line; + cp = line; + while (cp < (line + sizeof(line) -1) && *cp) + cp++; + bugargs.arg_end = cp; + ret = parse_args(&file, &flag); + } + } + if ( ret == -1 ) { + printf("boot: -q returning to MVME-Bug\n"); + break; + } + exec_mvme(file, flag); + printf("boot: %s: %s\n", file, strerror(errno)); + ask = 1; + } return(0); } diff --git a/sys/arch/mvme68k/stand/libsa/libsa.h b/sys/arch/mvme68k/stand/libsa/libsa.h index 3657bc00636..eff5fd7988e 100644 --- a/sys/arch/mvme68k/stand/libsa/libsa.h +++ b/sys/arch/mvme68k/stand/libsa/libsa.h @@ -14,5 +14,5 @@ int bugscstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); void exec_mvme __P((char *, int)); /* parse_args.c */ -void parse_args __P((char **, int *)); +int parse_args __P((char **, int *)); diff --git a/sys/arch/mvme68k/stand/libsa/parse_args.c b/sys/arch/mvme68k/stand/libsa/parse_args.c index 2cdc474c360..25cecfcd533 100644 --- a/sys/arch/mvme68k/stand/libsa/parse_args.c +++ b/sys/arch/mvme68k/stand/libsa/parse_args.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse_args.c,v 1.2 1996/07/27 11:28:15 deraadt Exp $ */ +/* $OpenBSD: parse_args.c,v 1.3 1997/04/17 19:16:42 gvf Exp $ */ /*- * Copyright (c) 1995 Theo de Raadt @@ -56,7 +56,7 @@ struct flags { { 's', RB_SINGLE }, }; -void +int parse_args(filep, flagp) char **filep; @@ -83,6 +83,8 @@ int *flagp; continue; } while ((c = *++ptr) && c != ' ') { + if (c == 'q') + return (-1); for (i = 0; i < sizeof(bf)/sizeof(bf[0]); i++) if (bf[i].c == c) { howto |= bf[i].bit; @@ -92,4 +94,5 @@ int *flagp; } *flagp = howto; *filep = name; + return (0); } -- 2.20.1