]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/cmd_run.c
rewrite of cmd_cpu/do_cpu_freq
[z180-stamp.git] / avr / cmd_run.c
index 719b9a85709c9d9deb7cc3ab9f6a8a0c812533c6..6482d0bb26bd8c7fa5478eecf49010b0d8e1a906 100644 (file)
@@ -1,30 +1,23 @@
 /*
- * (C) Copyright 2016 Leo C. <erbl259-lmu@yahoo.de>
+ * (C) Copyright 2016, 2018 Leo C. <erbl259-lmu@yahoo.de>
  *
  * SPDX-License-Identifier:    GPL-2.0
  */
 
-#include "common.h"
-#include <string.h>
-#include <stdio.h>
+#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;