summaryrefslogtreecommitdiff
path: root/avr/command.c
diff options
context:
space:
mode:
authorLeo C2018-08-31 23:36:06 +0200
committerLeo C2018-08-31 23:36:06 +0200
commit414caa77d5709bf3372d1f9245312781eee7961b (patch)
treef2a6db4c2723cafed364bf73cf48f28c6666f86b /avr/command.c
parent85d34e1026065c340e2237e1d2ab56e868be86ec (diff)
downloadz180-stamp-414caa77d5709bf3372d1f9245312781eee7961b.zip
error handling: improved cmd_error() - print fatfs error strings
Diffstat (limited to 'avr/command.c')
-rw-r--r--avr/command.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/avr/command.c b/avr/command.c
index b0d9c90..ff3a685 100644
--- a/avr/command.c
+++ b/avr/command.c
@@ -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);
+ }
}