diff options
author | msmith <msmith@FreeBSD.org> | 1998-09-03 02:10:09 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-09-03 02:10:09 +0000 |
commit | 2feae82d784a79b3fac686b4ca52c044fd75efda (patch) | |
tree | 1696a640576be6f4c71e821ec8a61a75f724a269 /sys/boot/common/interp.c | |
parent | 28865a6b9b25eb22c062e822e4a9f3d2da33e70b (diff) | |
download | FreeBSD-src-2feae82d784a79b3fac686b4ca52c044fd75efda.zip FreeBSD-src-2feae82d784a79b3fac686b4ca52c044fd75efda.tar.gz |
Bootstrap updates.
- Move some startup code from MD to MI sections
- Add a 'copyout' and some copyout-related functions. These will be
obsoleted when BTX is available for the 386 and the kernel load
area becomes directly addressable.
- Add the ability load an arbitrary file as a module, associating
and arbitrary type string with it. This can be used eg. for loading
splash-screen images etc.
- Add KLD module dependancy infrastructure. We know how to look for
dependancies inside KLD modules, how to resolve these dependancies
and what to do if things go wrong. Only works for a.out at the
moment, due to lack of an MI ELF loader. Attach KLD module information
to loaded modules as metadata, but don't pass it to the kernel (it
can find it itself).
- Load a.out KLD modules on a page boundary. Only pad the a.out BSS
for the kernel, as it may want to throw symbols away. (We might want
to do this for KLD modules too.)
- Allow commands to be hidden from the '?' display, to avoid cluttering
it with things like 'echo'. Add 'echo'.
- Bring the 'prompt' command into line with the parser syntax.
- Fix the verbose 'ls'; it was using an uninitialised stack variable.
- Add a '-v' flag to 'lsmod' to have it display module metadata as well
(not terribly useful for the average user)
- Support a 'module searchpath' for required modules.
- The bootstrap file on i386 is now called 'loader' to permit the
/boot directory to use that name.
- Discard the old i386 pread() function, as it's replaced by
arch_readin()
Diffstat (limited to 'sys/boot/common/interp.c')
-rw-r--r-- | sys/boot/common/interp.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/sys/boot/common/interp.c b/sys/boot/common/interp.c index a0162ba..c58b1c4 100644 --- a/sys/boot/common/interp.c +++ b/sys/boot/common/interp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: interp.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ + * $Id: interp.c,v 1.2 1998/09/01 00:41:24 msmith Exp $ */ /* * Simple commandline interpreter, toplevel and misc. @@ -83,6 +83,24 @@ interact(void) int argc; char **argv; + /* + * Read our default configuration + */ + source("/boot/boot.conf"); + printf("\n"); + /* + * Before interacting, we might want to autoboot + */ + if (getenv("no_autoboot") == NULL) + autoboot(10, NULL); /* try to boot automatically */ + + /* + * Not autobooting, go manual + */ + printf("\nType '?' for a list of commands, 'help' for more detailed help.\n"); + setenv("prompt", "${currdev}>", 1); + + for (;;) { input[0] = '\0'; prompt(); @@ -149,32 +167,29 @@ source(char *filename) } /* - * Emit the current prompt; support primitive embedding of - * environment variables. - * We're a little rude here, modifying the return from getenv(). + * Emit the current prompt; use the same syntax as the parser + * for embedding environment variables. */ static void prompt(void) { - char *p, *cp, *ev, c; + char *p, *cp, *ev; - if ((p = getenv("prompt")) == NULL) - p = ">"; + if ((cp = getenv("prompt")) == NULL) + cp = ">"; + p = strdup(cp); while (*p != 0) { - if (*p == '$') { - for (cp = p + 1; (*cp != 0) && isalpha(*cp); cp++) + if ((*p == '$') && (*(p+1) == '{')) { + for (cp = p + 2; (*cp != 0) && (*cp != '}'); cp++) ; - c = *cp; *cp = 0; - ev = getenv(p + 1); - *cp = c; + ev = getenv(p + 2); - if (ev != NULL) { + if (ev != NULL) printf(ev); - p = cp; - continue; - } + p = cp + 1; + continue; } putchar(*p++); } |