X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/fcf1d5b30bd3b341fb7596aef395f347c6dc97b4..aea51b6c4c93c56715f50e64d424e1181c6d0242:/avr/cmd_run.c diff --git a/avr/cmd_run.c b/avr/cmd_run.c index 719b9a8..6482d0b 100644 --- a/avr/cmd_run.c +++ b/avr/cmd_run.c @@ -1,30 +1,23 @@ /* - * (C) Copyright 2016 Leo C. + * (C) Copyright 2016, 2018 Leo C. * * SPDX-License-Identifier: GPL-2.0 */ -#include "common.h" -#include -#include +#include "cmd_run.h" #include "ff.h" -#include "config.h" -#include "command.h" #include "cli_readline.h" /* console_buffer[] */ #include "cli.h" /* run_command() */ #include "env.h" -command_ret_t do_run(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]) +command_ret_t do_run(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag, int argc, char * const argv[]) { - int i; - (void) cmdtp; - if (argc < 2) return CMD_RET_USAGE; - for (i = 1; i < argc; ++i) { + for (int i = 1; i < argc; ++i) { char *arg; arg = getenv_str(argv[i]); @@ -39,13 +32,16 @@ command_ret_t do_run(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const return CMD_RET_SUCCESS; } -static int source(FIL *fp, uint_fast8_t flag, int argc, char * const argv[]) +command_ret_t do_bootd(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag, int argc UNUSED, char * const argv[] UNUSED) +{ + return run_command(getenv_str("bootcmd"), flag); +} + +static int source(FIL *fp, uint_fast8_t flag, int argc UNUSED, char * const argv[] UNUSED) { int lineno = 0; int res = 0; - (void)argc; (void)argv; - while (!f_eof(fp) && !f_error(fp) && !res) { lineno++; if (f_gets(console_buffer, CONFIG_SYS_CBSIZE, fp)) { @@ -66,13 +62,11 @@ static int source(FIL *fp, uint_fast8_t flag, int argc, char * const argv[]) return !f_eof(fp) || res; } -command_ret_t do_source(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]) +command_ret_t do_source(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag, int argc, char * const argv[]) { FIL File; int res; - (void) cmdtp; - if (argc < 2) return CMD_RET_USAGE;