]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/cmd_misc.c
reset optind before executing command
[z180-stamp.git] / avr / cmd_misc.c
index 9061b5ad0d95cd7520093bf769352bd594142bb0..72102c66c46e82788cd314a9a85a18a4585e5904 100644 (file)
@@ -7,25 +7,21 @@
  * SPDX-License-Identifier:    GPL-2.0
  */
 
-#include "common.h"
+#include "cmd_misc.h"
 #include "eval_arg.h"
 #include <stdbool.h>
 
-#include "command.h"
 #include "timer.h"
 #include "con-utils.h"
 #include "getopt-min.h"
 
 
-command_ret_t do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+command_ret_t do_echo(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[])
 {
        bool put_newline = true;
 
        (void) cmdtp; (void) flag;
 
-       /* reset getopt() */
-       optind = 0;
-
        int opt;
        while ((opt = getopt(argc, argv, PSTR("n"))) != -1) {
                switch (opt) {
@@ -52,7 +48,7 @@ command_ret_t do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 }
 
 
-command_ret_t do_sleep(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+command_ret_t do_sleep(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[])
 {
        unsigned long start = get_timer(0);
        unsigned long delay;