From 06b57b0e096b169e96e363151b867f99c7cd4877 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Thu, 3 Sep 1998 02:10:09 +0000 Subject: 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() --- sys/boot/common/commands.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'sys/boot/common/commands.c') diff --git a/sys/boot/common/commands.c b/sys/boot/common/commands.c index af6a4752daeb..8ed140affa82 100644 --- a/sys/boot/common/commands.c +++ b/sys/boot/common/commands.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: commands.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ */ #include @@ -61,7 +61,7 @@ command_commandlist(int argc, char *argv[]) printf("Available commands:\n"); cmdp = (struct bootblk_command **)Xcommand_set.ls_items; for (i = 0; i < Xcommand_set.ls_length; i++) - if (cmdp[i]->c_name != NULL) + if ((cmdp[i]->c_name != NULL) && (cmdp[i]->c_desc != NULL)) printf(" %-15s %s\n", cmdp[i]->c_name, cmdp[i]->c_desc); return(CMD_OK); } @@ -153,3 +153,38 @@ command_panic(int argc, char *argv[]) cp = unargv(argc - 1, argv + 1); panic(cp); } + +COMMAND_SET(echo, "echo", NULL, command_echo); + +static int +command_echo(int argc, char *argv[]) +{ + char *s; + int nl, ch; + + nl = 0; + optind = 1; + while ((ch = getopt(argc, argv, "n")) != -1) { + switch(ch) { + case 'n': + nl = 1; + break; + case '?': + default: + /* getopt has already reported an error */ + return(CMD_OK); + } + } + argv += (optind); + argc -= (optind); + + s = unargv(argc, argv); + if (s != NULL) { + printf(s); + free(s); + } + if (!nl) + printf("\n"); + return(CMD_OK); +} + -- cgit v1.2.3