diff options
author | imp <imp@FreeBSD.org> | 2007-03-28 21:18:45 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2007-03-28 21:18:45 +0000 |
commit | b5abcfde20bfc82de8c944f9bd7223dc4fcc3568 (patch) | |
tree | d3d65ca5ef771aff7eb7e34493e3f2aacce01999 | |
parent | 485d6cf39247045495c6b6a39db930507eb93273 (diff) | |
download | FreeBSD-src-b5abcfde20bfc82de8c944f9bd7223dc4fcc3568.zip FreeBSD-src-b5abcfde20bfc82de8c944f9bd7223dc4fcc3568.tar.gz |
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
-rw-r--r-- | sys/boot/arm/at91/boot2/boot2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/boot/arm/at91/boot2/boot2.c b/sys/boot/arm/at91/boot2/boot2.c index 5292f57..d336f40 100644 --- a/sys/boot/arm/at91/boot2/boot2.c +++ b/sys/boot/arm/at91/boot2/boot2.c @@ -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; |