diff options
author | Mattias Andrée <maandree@kth.se> | 2021-03-01 02:16:25 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-03-01 02:16:25 +0100 |
commit | 4c1a6e380ebe76e256b2af1313cf256d9fea70df (patch) | |
tree | e20184a304c0ba1160477b644504fbb2e8146319 /libhaiku.h | |
parent | Merge pull request #2 from ayekat/master (diff) | |
parent | misc + change license + changed behaviour of libhaiku_perror (diff) | |
download | libhaiku-4c1a6e380ebe76e256b2af1313cf256d9fea70df.tar.gz libhaiku-4c1a6e380ebe76e256b2af1313cf256d9fea70df.tar.bz2 libhaiku-4c1a6e380ebe76e256b2af1313cf256d9fea70df.tar.xz |
Merge branch 'rewrite'2.0
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libhaiku.h')
-rw-r--r-- | libhaiku.h | 47 |
1 files changed, 47 insertions, 0 deletions
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 <errno.h> + +/** + * 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 |