From 917c49789cb6a80698d7274d9736cbbe3296fa44 Mon Sep 17 00:00:00 2001 From: chuck Date: Wed, 29 May 1996 15:30:45 +0000 Subject: new arg passing --- sys/arch/mvme68k/stand/sboot/sboot.c | 45 +++++++++++++++++++++--------------- sys/arch/mvme68k/stand/sboot/sboot.h | 6 ++--- 2 files changed, 30 insertions(+), 21 deletions(-) (limited to 'sys') diff --git a/sys/arch/mvme68k/stand/sboot/sboot.c b/sys/arch/mvme68k/stand/sboot/sboot.c index 5553227793e..fd218d54879 100644 --- a/sys/arch/mvme68k/stand/sboot/sboot.c +++ b/sys/arch/mvme68k/stand/sboot/sboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sboot.c,v 1.4 1996/04/28 10:49:43 deraadt Exp $ */ +/* $OpenBSD: sboot.c,v 1.5 1996/05/29 15:30:44 chuck Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -66,14 +66,14 @@ void main() { - char buf[128]; + char buf[128], *ebuf; buf[0] = '0'; printf("\nsboot: MVME147 bootstrap program\n"); while (1) { printf(">>> "); - gets(buf); - do_cmd(buf); + ebuf = ngets(buf, sizeof(buf)); + do_cmd(buf, ebuf); } /* not reached */ } @@ -91,8 +91,8 @@ callrom() * do_cmd: do a command */ void -do_cmd(buf) - char *buf; +do_cmd(buf, ebuf) + char *buf, *ebuf; { switch (*buf) { case '\0': @@ -137,7 +137,7 @@ do_cmd(buf) } if (*++buf == '\0') buf = "bsd"; - go(buf); + go(LOAD_ADDR, buf+1, ebuf); break; case 'h': case '?': @@ -154,22 +154,31 @@ do_cmd(buf) le_init(); break; case 'g': - go(buf); + go(LOAD_ADDR, buf+1, ebuf); break; default: printf("sboot: %s: Unknown command\n", buf); } } -go(buf) - char *buf; +/* + * ngets: get string from console + */ + +char *ngets ( char * str, int size ) { - void (*entry)() = (void (*))LOAD_ADDR; - - printf("jumping to boot program at 0x%x.\n", entry); - - asm("clrl d0; clrl d1"); /* XXX network device */ - asm("movl %0, a3" : : "a" (buf) : "a3"); - asm("movl %0, a4" : : "a" (buf + strlen(buf)) : "a4"); - asm("jmp %0@" : : "a" (entry)); + int i = 0; + while ( (i < size - 1) && (str[i] = getchar()) != '\r') { + if ( str[i] == '\b' || str[i] == 0x7F ) { + if ( i == 0) continue; + i--; + printf("\b \b"); + continue; + } + putchar(str[i]); + i++; + } + printf("\n"); + str[i] = '\0'; + return(&str[i]); } diff --git a/sys/arch/mvme68k/stand/sboot/sboot.h b/sys/arch/mvme68k/stand/sboot/sboot.h index 0f79362de45..377329e1e35 100644 --- a/sys/arch/mvme68k/stand/sboot/sboot.h +++ b/sys/arch/mvme68k/stand/sboot/sboot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sboot.h,v 1.2 1996/04/28 10:49:44 deraadt Exp $ */ +/* $OpenBSD: sboot.h,v 1.3 1996/05/29 15:30:44 chuck Exp $ */ /* * Copyright (c) 1995 Charles D. Cranor and Seth Widoff @@ -53,11 +53,11 @@ int printf __P((const char *, ...)); /* libc_sa */ void puts __P((char *)); void putchar __P((char)); char cngetc __P((void)); -void ngets __P((char *, int)); +char *ngets __P((char *, int)); /* sboot */ void callrom __P((void)); -void do_cmd __P((char *)); +void do_cmd __P((char *, char*)); /* le */ #define LANCE_ADDR 0xfffe0778 -- cgit v1.2.3