From owner-svn-src-head@freebsd.org Mon Dec 11 16:18:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 940A7E969B6; Mon, 11 Dec 2017 16:18:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 029406CA9A; Mon, 11 Dec 2017 16:18:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBBGI6VX027957; Mon, 11 Dec 2017 16:18:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBBGI5nD027945; Mon, 11 Dec 2017 16:18:05 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201712111618.vBBGI5nD027945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 11 Dec 2017 16:18:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326772 - in head/stand: common efi/loader i386/loader mips/beri/loader ofw/common powerpc/kboot powerpc/ps3 sparc64/loader userboot/userboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: common efi/loader i386/loader mips/beri/loader ofw/common powerpc/kboot powerpc/ps3 sparc64/loader userboot/userboot X-SVN-Commit-Revision: 326772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2017 16:18:08 -0000 Author: imp Date: Mon Dec 11 16:18:05 2017 New Revision: 326772 URL: https://svnweb.freebsd.org/changeset/base/326772 Log: Fix regression with lua import Don't print when we can't find a file. Copy it instead to the error buffer. Higher level routines determine if it's appropriate to print the error message. Also, remove dead code (labeled bogusly lost functionality) since we never used that functionality. Remove unused arg from interact() too. Sponsored by: Netflix Modified: head/stand/common/bootstrap.h head/stand/common/interp.c head/stand/common/interp_forth.c head/stand/efi/loader/main.c head/stand/i386/loader/main.c head/stand/mips/beri/loader/main.c head/stand/ofw/common/main.c head/stand/powerpc/kboot/main.c head/stand/powerpc/ps3/main.c head/stand/sparc64/loader/main.c head/stand/userboot/userboot/main.c Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/common/bootstrap.h Mon Dec 11 16:18:05 2017 (r326772) @@ -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 */ @@ -53,10 +53,6 @@ char *backslash(const char *str); /* interp_parse.c */ int parse(int *argc, char ***argv, const char *str); - -/* interp_forth.c */ -void bf_init(const char *rc); -int bf_run(char *line); /* boot.c */ int autoboot(int timeout, char *prompt); Modified: head/stand/common/interp.c ============================================================================== --- head/stand/common/interp.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/common/interp.c Mon Dec 11 16:18:05 2017 (r326772) @@ -58,7 +58,7 @@ default_load_config(void *ctx) * Interactive mode */ void -interact(const char * rc) +interact(void) { static char input[256]; /* big enough? */ @@ -124,6 +124,9 @@ command_include(int argc, char *argv[]) for (i = 0; i < argc; i++) free(argvbuf[i]); free(argvbuf); + + if (res != CMD_OK) + printf("%s", command_errbuf); return(res); } Modified: head/stand/common/interp_forth.c ============================================================================== --- head/stand/common/interp_forth.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/common/interp_forth.c Mon Dec 11 16:18:05 2017 (r326772) @@ -294,21 +294,6 @@ interp_forth_init(void *ctx) /* Export some version numbers so that code can detect the loader/host version */ ficlSetEnv(bf_sys, "FreeBSD_version", __FreeBSD_version); ficlSetEnv(bf_sys, "loader_version", bootprog_rev); - -#if 0 /* XXX lost functionality -- imp */ - /* try to load and run init file if present */ - if (rc == NULL) - rc = "/boot/boot.4th"; - if (*rc != '\0') { - int fd; - - fd = open(rc, O_RDONLY); - if (fd != -1) { - (void)ficlExecFD(bf_vm, fd); - close(fd); - } - } -#endif } /* @@ -364,10 +349,12 @@ interp_forth_incl(void *ctx, const char *filename) fd = open(filename, O_RDONLY); if (fd == -1) { - printf("can't open %s\n", filename); + /* Hihger layers print the error message */ + snprintf(command_errbuf, sizeof(command_errbuf), + "can't open %s\n", filename); return (CMD_ERROR); } - return (ficlExecFD(softc->bf_vm, fd)); + return (ficlExecFD(softc->bf_vm, fd) == 0 ? CMD_OK : CMD_ERROR); } Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/efi/loader/main.c Mon Dec 11 16:18:05 2017 (r326772) @@ -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 */ } Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/i386/loader/main.c Mon Dec 11 16:18:05 2017 (r326772) @@ -232,7 +232,7 @@ main(void) bios_getsmap(); - interact(NULL); + interact(); /* if we ever get here, it is an error */ return (1); Modified: head/stand/mips/beri/loader/main.c ============================================================================== --- head/stand/mips/beri/loader/main.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/mips/beri/loader/main.c Mon Dec 11 16:18:05 2017 (r326772) @@ -149,7 +149,7 @@ main(int argc, char *argv[], char *envv[], struct boot printf("bootpath=\"%s\"\n", bootpath); #endif - interact(NULL); + interact(); return (0); } Modified: head/stand/ofw/common/main.c ============================================================================== --- head/stand/ofw/common/main.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/ofw/common/main.c Mon Dec 11 16:18:05 2017 (r326772) @@ -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(); Modified: head/stand/powerpc/kboot/main.c ============================================================================== --- head/stand/powerpc/kboot/main.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/powerpc/kboot/main.c Mon Dec 11 16:18:05 2017 (r326772) @@ -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); } Modified: head/stand/powerpc/ps3/main.c ============================================================================== --- head/stand/powerpc/ps3/main.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/powerpc/ps3/main.c Mon Dec 11 16:18:05 2017 (r326772) @@ -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); } Modified: head/stand/sparc64/loader/main.c ============================================================================== --- head/stand/sparc64/loader/main.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/sparc64/loader/main.c Mon Dec 11 16:18:05 2017 (r326772) @@ -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); } Modified: head/stand/userboot/userboot/main.c ============================================================================== --- head/stand/userboot/userboot/main.c Mon Dec 11 16:17:53 2017 (r326771) +++ head/stand/userboot/userboot/main.c Mon Dec 11 16:18:05 2017 (r326772) @@ -142,7 +142,7 @@ loader_main(struct loader_callbacks *cb, void *arg, in if (setjmp(jb)) return; - interact(NULL); /* doesn't return */ + interact(); /* doesn't return */ exit(0); }