]> cloudbase.mooo.com Git - z180-stamp.git/blob - avr/strerror.c
error handling: improved cmd_error() - print fatfs error strings
[z180-stamp.git] / avr / strerror.c
1 /*
2 * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
3 *
4 * SPDX-License-Identifier: GPL-2.0
5 */
6
7 #include "common.h"
8 #include "cmd_fat.h"
9
10 static const FLASH char * const FLASH error_strings[] = {
11 FSTR("Unknown error")
12 };
13
14 const FLASH char * my_strerror_P(int errnum)
15 {
16 if (errnum < 100)
17 return fat_rctostr(errnum);
18
19 errnum -= 100;
20 if (errnum < 0)
21 errnum = 0;
22 if ((unsigned) errnum >= ARRAY_SIZE(error_strings))
23 errnum = 0;
24
25 return error_strings[errnum];
26 }