Interact is always called with NULL. Simplify code a little by

removing this argument, and expanding when rc is NULL. This
effectively completes the back out of custom scripts for tftp booted
loaders from r269153 that was started in r292344 with the new path
tricks that obsoleted it.

Submitted by: Netflix
This commit is contained in:
Warner Losh 2017-12-19 04:05:55 +00:00
parent 0ff3f28b2d
commit 6bc860372d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326961
12 changed files with 19 additions and 27 deletions

View File

@ -45,7 +45,7 @@ extern char command_errbuf[COMMAND_ERRBUFSZ];
#define CMD_FATAL 4
/* interp.c */
void interact(const char *rc);
void interact(void);
int include(const char *filename);
/* interp_backslash.c */
@ -55,7 +55,7 @@ char *backslash(const char *str);
int parse(int *argc, char ***argv, const char *str);
/* interp_forth.c */
void bf_init(const char *rc);
void bf_init(void);
int bf_run(char *line);
/* boot.c */

View File

@ -84,7 +84,7 @@ perform(int argc, char *argv[])
* Interactive mode
*/
void
interact(const char *rc)
interact(void)
{
static char input[256]; /* big enough? */
#ifndef BOOT_FORTH
@ -93,14 +93,11 @@ interact(const char *rc)
#endif
#ifdef BOOT_FORTH
bf_init((rc) ? "" : NULL);
bf_init();
#endif
if (rc == NULL) {
/* Read our default configuration. */
include("/boot/loader.rc");
} else if (*rc != '\0')
include(rc);
/* Read our default configuration. */
include("/boot/loader.rc");
printf("\n");

View File

@ -250,7 +250,7 @@ bf_command(FICL_VM *vm)
* Initialise the Forth interpreter, create all our commands as words.
*/
void
bf_init(const char *rc)
bf_init(void)
{
struct bootblk_command **cmdp;
char create_buf[41]; /* 31 characters-long builtins */
@ -280,14 +280,9 @@ bf_init(const char *rc)
ficlSetEnv(bf_sys, "loader_version", bootprog_rev);
/* try to load and run init file if present */
if (rc == NULL)
rc = "/boot/boot.4th";
if (*rc != '\0') {
fd = open(rc, O_RDONLY);
if (fd != -1) {
(void)ficlExecFD(bf_vm, fd);
close(fd);
}
if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) {
(void)ficlExecFD(bf_vm, fd);
close(fd);
}
}

View File

@ -501,7 +501,7 @@ main(int argc, CHAR16 *argv[])
#endif
}
interact(NULL); /* doesn't return */
interact(); /* doesn't return */
return (EFI_SUCCESS); /* keep compiler happy */
}

View File

@ -232,7 +232,7 @@ main(void)
bios_getsmap();
interact(NULL);
interact();
/* if we ever get here, it is an error */
return (1);

View File

@ -149,7 +149,7 @@ main(int argc, char *argv[], char *envv[], struct bootinfo *bootinfop)
printf("bootpath=\"%s\"\n", bootpath);
#endif
interact(NULL);
interact();
return (0);
}

View File

@ -157,7 +157,7 @@ main(int (*openfirm)(void *))
archsw.arch_readin = ofw_readin;
archsw.arch_autoload = ofw_autoload;
interact(NULL); /* doesn't return */
interact(); /* doesn't return */
OF_exit();

View File

@ -122,7 +122,7 @@ main(int argc, const char **argv)
setenv("loaddev", bootdev, 1);
setenv("LINES", "24", 1);
interact(NULL); /* doesn't return */
interact(); /* doesn't return */
return (0);
}

View File

@ -140,7 +140,7 @@ main(void)
setenv("LINES", "24", 1);
setenv("hw.platform", "ps3", 1);
interact(NULL); /* doesn't return */
interact(); /* doesn't return */
return (0);
}

View File

@ -902,7 +902,7 @@ main(int (*openfirm)(void *))
printf("bootpath=\"%s\"\n", bootpath);
/* Give control to the machine independent loader code. */
interact(NULL);
interact();
return (1);
}

View File

@ -500,7 +500,7 @@ main(int argc, char **argv)
archsw.arch_readin = uboot_readin;
archsw.arch_autoload = uboot_autoload;
interact(NULL); /* doesn't return */
interact(); /* doesn't return */
return (0);
}

View File

@ -142,7 +142,7 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks)
if (setjmp(jb))
return;
interact(NULL); /* doesn't return */
interact(); /* doesn't return */
exit(0);
}