Tiny strerror() implementation

Tiny strerror() implementation. More...

Detailed Description

Tiny strerror() implementation.


Select module tiny_strerror in order to use it.

#include "tiny_strerror.h"
Tiny strerror() implementation.
Using module tiny_strerror_as_strerror will replace all calls to strerror() by calls to tiny_strerror(), which may safe a bit of ROM.
Using module tiny_strerror_minimal will just print the error code value. This will save ~1k of ROM, but won't provide much more information.
The module tiny_strerror_minimal is not thread-safe.


file  tiny_strerror.h
 Tiny strerror() implementation.


const char * tiny_strerror (int errnum)
 Get the name of an errno macro. More...

Function Documentation

◆ tiny_strerror()

const char* tiny_strerror ( int  errnum)

Get the name of an errno macro.

[in]errnumError code to get the name of


puts(tiny_strerror(ENOENT)); // prints "ENOENT"
puts(tiny_strerror(-ENXIO)); // prints "-ENXIO"
puts(tiny_strerror(0)); // prints "OK"
puts(tiny_strerror(1337)); // prints "unknown"
puts(tiny_strerror(-1337)); // prints "-unknown"
#define ENOENT
No such file or directory.
Definition: errno.h:114
#define ENXIO
No such device or address.
Definition: errno.h:132
const char * tiny_strerror(int errnum)
Get the name of an errno macro.
String holding the macro name of the error given by errnum
Return values
<tt>"OK"</tt>If errnum is 0
<tt>"unknown"</tt>If errnum is not matching any POSIX errno constant
<tt>"-unknown"</tt>If errnum is negative not matching any negative POSIX errno constant