]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/command.c
Tup: F_CPU per config
[z180-stamp.git] / avr / command.c
index b0d9c90219010a18d161fb52b045d9f14481715e..ff3a685831a51bf31da2b11ec63d4f22745d89b2 100644 (file)
@@ -22,6 +22,7 @@
 #include "env.h"
 #include "debug.h"
 #include "getopt-min.h"
+#include "strerror.h"
 
 #define DEBUG_CMD      0       /* set to 1 to debug */
 
@@ -791,16 +792,24 @@ int cmd_process_error(cmd_tbl_t *cmdtp, int err)
        return 0;
 }
 
-
-void cmd_error(const char *fmt, ...)
+void cmd_error(int status, int errnum, const char *fmt, ...)
 {
        va_list ap;
        va_start(ap, fmt);
        print_prefixed_name(cmd_invocation_ptr);
-       my_puts_P(PSTR(": "));
-       vfprintf_P(stdout, fmt, ap);
+       if (fmt != NULL) {
+               my_puts_P(PSTR(": "));
+               vfprintf_P(stdout, fmt, ap);
+       }
        va_end(ap);
+
+       if (errnum != 0)
+               printf_P(PSTR(": %S"), my_strerror_P(errnum));
+
        putchar('\n');
        _delay_ms(20);
-       //command_ret = CMD_RET_FAILURE;
+
+       if (status != 0) {
+               longjmp(cmd_jbuf, 1);
+       }
 }