From eebadeb4b4ee60dc768afd3036e3a29833ccb51e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 1 Mar 2021 02:12:47 +0100 Subject: misc + change license + changed behaviour of libhaiku_perror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libhaiku.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 libhaiku.h (limited to 'libhaiku.h') diff --git a/libhaiku.h b/libhaiku.h new file mode 100644 index 0000000..b00523f --- /dev/null +++ b/libhaiku.h @@ -0,0 +1,47 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef LIBHAIKU_H +#define LIBHAIKU_H + +#include + +/** + * Get a random generic poetic error message + * + * @return A random generic poetic error message + */ +const char *libhaiku_generic(void); + +/** + * Get a poetic error message + * + * @param errnum `errno` value that the error message shall be selected for + * @param genericp Unless `NULL`, will be set to 1 if the function didn't have + * any haikus specific the the specified error, and had to + * return a generic haiku, and to 0 otherwise + * @return A poetic error message + */ +const char *libhaiku_strerror(int, int *); + +/** + * Print a poetic error message + * + * @param prefix Unless `NULL` or empty, each line will be prefixed + * by the specified string followed by a colon and a space + * @param errnum `errno` value that the error message shall be selected for; + * if negative, a generic error message is printed + */ +void libhaiku_perror2(const char *, int); + +/** + * Print a poetic error message + * + * @param prefix Unless `NULL` or empty, each line will be prefixed + * by the specified string followed by a colon and a space + */ +inline void +libhaiku_perror(const char *_libhaiku_prefix) +{ + libhaiku_perror2(_libhaiku_prefix, errno); +} + +#endif -- cgit v1.2.3-70-g09d2