Loading...
Searching...
No Matches
Tiny strerror() implementation

Tiny strerror() implementation. More...

Detailed Description

Tiny strerror() implementation.

Usage

Select module tiny_strerror in order to use it.

#include "tiny_strerror.h"
Tiny strerror() implementation.
Note
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.
Warning
The module tiny_strerror_minimal is not thread-safe.

Files

file  tiny_strerror.h
 Tiny strerror() implementation.
 

Functions

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

Function Documentation

◆ tiny_strerror()

const char * tiny_strerror ( int  errnum)

Get the name of an errno macro.

Parameters
[in]errnumError code to get the name of

Example:

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.
Returns
String holding the macro name of the error given by errnum
Return values
`"OK"`If errnum is 0
`"unknown"`If errnum is not matching any POSIX errno constant
`"-unknown"`If errnum is negative not matching any negative POSIX errno constant