summaryrefslogtreecommitdiff
path: root/avr/strerror.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/strerror.c
parent85d34e1026065c340e2237e1d2ab56e868be86ec (diff)
downloadz180-stamp-414caa77d5709bf3372d1f9245312781eee7961b.zip
error handling: improved cmd_error() - print fatfs error strings
Diffstat (limited to 'avr/strerror.c')
-rw-r--r--avr/strerror.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/avr/strerror.c b/avr/strerror.c
new file mode 100644
index 0000000..d80a3bc
--- /dev/null
+++ b/avr/strerror.c
@@ -0,0 +1,26 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include "common.h"
+#include "cmd_fat.h"
+
+static const FLASH char * const FLASH error_strings[] = {
+ FSTR("Unknown error")
+};
+
+const FLASH char * my_strerror_P(int errnum)
+{
+ if (errnum < 100)
+ return fat_rctostr(errnum);
+
+ errnum -= 100;
+ if (errnum < 0)
+ errnum = 0;
+ if ((unsigned) errnum >= ARRAY_SIZE(error_strings))
+ errnum = 0;
+
+ return error_strings[errnum];
+}