Various buglets fixed (from submitter):

The changes to getstr() is so that the character that is
	passed in to it, is also processed just as the rest. I also
	removed one of the getc() calls otherwise you loose every
	second character.

	I also changed the strcpy of kname, so that it only happens if
	kname is '\0'. This is so that one can pass a kernel in
	through /boot.config.

	The last change to boot2.c is in parse(). If you tried to type
	a kernel name to boot, the first character was lost, the arg--
	fix that.

Submitted by: jhay
This commit is contained in:
Warner Losh 2007-03-28 21:18:45 +00:00
parent 5a8da39aa7
commit 89e75021fa

View File

@ -114,12 +114,10 @@ getstr(int c)
char *s;
s = cmd;
if (c)
*s++ = c;
for (;;) {
if (c == 0)
c = getc(10000);
switch (c = getc(10000)) {
for (;;) {
switch (c) {
case 0:
break;
case '\177':
@ -138,6 +136,7 @@ getstr(int c)
*s++ = c;
xputchar(c);
}
c = getc(10000);
}
}
@ -170,7 +169,8 @@ main(void)
/* Present the user with the boot2 prompt. */
strcpy(kname, PATH_KERNEL);
if (*kname == '\0')
strcpy(kname, PATH_KERNEL);
for (;;) {
printf("\nDefault: %s\nboot: ", kname);
if (!autoboot || (c = getc(2)) != -1)
@ -252,6 +252,7 @@ parse()
opts ^= OPT_SET(flags[i]);
}
} else {
arg--;
if ((i = ep - arg)) {
if ((size_t)i >= sizeof(kname))
return -1;