aboutsummaryrefslogtreecommitdiffstats
path: root/doc/info/chap
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2016-01-05 00:04:20 +0100
committerMattias Andrée <maandree@member.fsf.org>2016-01-05 00:04:20 +0100
commit66e0606efce292e5fc33375b9653e873dc91e8f9 (patch)
tree57f8deb452873809088b4993339c66c003b770e6 /doc/info/chap
parentmacro that allows errno == 0 (diff)
downloadlibhaiku-66e0606efce292e5fc33375b9653e873dc91e8f9.tar.gz
libhaiku-66e0606efce292e5fc33375b9653e873dc91e8f9.tar.bz2
libhaiku-66e0606efce292e5fc33375b9653e873dc91e8f9.tar.xz
add texinfo manual
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r--doc/info/chap/overview.texinfo38
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/info/chap/overview.texinfo b/doc/info/chap/overview.texinfo
new file mode 100644
index 0000000..d132354
--- /dev/null
+++ b/doc/info/chap/overview.texinfo
@@ -0,0 +1,38 @@
+@node Overview
+@chapter Overview
+
+@command{libhaiku} is a simply error message printing C library
+with a collection of haiku that it prints instead of traditional
+error messages.
+
+A known issue is that must of the haiku uses 5--7--5@tie{}syllables
+rather than 5--7--5@tie{}morae. This is however of lesser importance,
+as it is much harder to write a 5--7--5@tie{}mora haiku than a
+5--7--5@tie{}syllable haiku.
+
+To use @command{libhaiku} include the head file @file{<libhaiku.h>}
+and link with @option{-lhaiku}. The function
+@example
+void libhaiku_perror(const char* s);
+@end example
+is used to print the error
+messages. @code{libhaiku_perror} shall print an error message in the
+format of a haiku, appropriate for the current value of @code{errno}.
+If there is not haiku available for the current value of @code{errno},
+@code{libhaiku_perror} shall call @code{perror} with @code{s} as its
+argument unless @code{s} is @code{NULL}, and then print a generic haiku.
+
+Unlike @code{perror}, @code{libhaiku_perror} shall not print anything
+if @code{errno} is zero. If you rather it did, you can use the macro
+
+@example
+#define libhaiku_perror(s) \
+ do @{ \
+ const char *s__ = (s); \
+ if (errno && s__) \
+ perror(s__); \
+ errno = errno ? errno : -1; \
+ libhaiku_perror(s__); \
+ @} while (0)
+@end example
+