diff options
author | Miles Bader <miles@gnu.org> | 1997-07-08 22:40:01 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-07-08 22:40:01 +0000 |
commit | 771f98f57a74418105afed405e4f3429a56dbbee (patch) | |
tree | c395e5838a306012dad52d90e5fbf73c66caa15a /serverboot | |
parent | df38e5153c5b268d42095eb452aec5b171c7c23e (diff) |
(safe_gets):
Make sure a newline exists before removing it.
Ensure that the cursor moves to the beginning of the next line.
(main):
Don't call translate_root.
Pass more than a single character to safe_gets.
(DEFAULT_ROOT):
New macro.
Don't include "translate_root.h".
Diffstat (limited to 'serverboot')
-rw-r--r-- | serverboot/bootstrap.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/serverboot/bootstrap.c b/serverboot/bootstrap.c index 5a104bf7..fd69f5d9 100644 --- a/serverboot/bootstrap.c +++ b/serverboot/bootstrap.c @@ -35,7 +35,10 @@ #include <stdio.h> #include "../boot/boot_script.h" -#include "translate_root.h" + +/* Use this device if no root specified. */ +#define DEFAULT_ROOT "hd0a" + #if 0 /* @@ -114,7 +117,9 @@ safe_gets (char *str, int maxlen) { char *c; c = index (fgets (str, maxlen, stdin), '\n'); - *c = '\0'; + if (c) + *c = '\0'; + printf ("\r\n"); } printf_init (device_t master) @@ -168,8 +173,6 @@ main(argc, argv) boolean_t ask_boot_script = 0; - static char new_root[16]; - /* * Use 4Kbyte cthread wait stacks. */ @@ -232,14 +235,14 @@ main(argc, argv) */ if (index(flag_string, 'a')) { - printf("root device? [%s] ", root_name); - safe_gets(new_root, sizeof(new_root)); - } + static char new_root[16]; - if (new_root[0] == '\0') - strcpy(new_root, root_name); + printf("root device? [%s] ", root_name); + safe_gets(new_root, sizeof(new_root)); - root_name = translate_root(new_root); + if (new_root[0] != '\0') + strcpy (root_name, new_root); + } (void) strbuild(boot_script_name, "/dev/", @@ -323,9 +326,9 @@ main(argc, argv) if (index (flag_string, 'd')) { - char c; + char xx[5]; printf ("Hit return to boot..."); - safe_gets (&c, 1); + safe_gets (xx, sizeof xx); } /* |