Don't advance to the next default name if the user typed something.

Make gets() return void.
This commit is contained in:
mycroft 1996-06-18 07:47:02 +00:00
parent 398b638fbb
commit 584f242944
2 changed files with 33 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.30 1996/06/18 06:06:38 mycroft Exp $ */
/* $NetBSD: boot.c,v 1.31 1996/06/18 07:47:02 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@ -80,7 +80,7 @@ void
boot(drive)
int drive;
{
int loadflags, currname = 0;
int loadflags;
char *t;
printf("\n"
@ -90,27 +90,23 @@ boot(drive)
argv[8] = memsize(1),
version);
gateA20(1);
loadstart:
/***************************************************************\
* As a default set it to the first partition of the first *
* floppy or hard drive *
\***************************************************************/
part = 0;
unit = drive&0x7f;
maj = (drive&0x80 ? 0 : 2); /* a good first bet */
for (;;) {
/***************************************************************\
* As a default set it to the first partition of the first *
* floppy or hard drive *
\***************************************************************/
maj = (drive & 0x80 ? 0 : 2); /* a good first bet */
unit = drive & 0x7f;
part = 0;
name = names[currname++];
loadflags = 0;
if (currname == NUMNAMES)
currname = 0;
getbootdev(&loadflags);
if (openrd()) {
printf("Can't find %s\n", name);
goto loadstart;
loadflags = 0;
getbootdev(&loadflags);
if (openrd()) {
printf("Can't find %s\n", name);
continue;
}
loadprog(loadflags);
}
loadprog(loadflags);
goto loadstart;
}
static void
@ -279,14 +275,20 @@ static void
getbootdev(howto)
int *howto;
{
static int currname = 0;
static char namebuf[100]; /* don't allocate on stack! */
char c, *ptr = namebuf;
char c, *ptr;
name = names[currname];
printf("Boot: [[[%s(%d,%c)]%s][-adrs]] :- ",
devs[maj], unit, 'a'+part, name);
#ifdef CHECKSUM
cflag = 0;
#endif
if (awaitkey(PROMPTWAIT) && gets(namebuf)) {
if (awaitkey(PROMPTWAIT)) {
gets(namebuf);
ptr = namebuf;
while (c = *ptr) {
while (c == ' ')
c = *++ptr;
@ -316,6 +318,9 @@ getbootdev(howto)
*ptr++ = 0;
}
}
} else
} else {
putchar('\n');
if (++currname == NUMNAMES)
currname = 0;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.18 1995/12/23 17:21:26 perry Exp $ */
/* $NetBSD: io.c,v 1.19 1996/06/18 07:47:04 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@ -34,7 +34,7 @@
void gateA20 __P((int on));
/*void printf __P((const char *format, int data));*/ /* not quite right XXX */
void putchar __P((int c));
int gets __P((char *buf));
void gets __P((char *buf));
int strcmp __P((const char *s1, const char *s2));
void bcopy __P((char *from, char *to, int len));
int awaitkey __P((int seconds));
@ -143,7 +143,7 @@ putchar(c)
putc(c);
}
int
void
gets(buf)
char *buf;
{
@ -154,7 +154,7 @@ gets(buf)
if (c == '\n' || c == '\r') {
putchar('\n');
*ptr = '\0';
return 1;
return;
} else if (c == '\b' || c == '\177') {
if (ptr > buf) {
putchar('\b');