adu.ggo: Remove unused --config-file option.
[adu.git] / error.h
diff --git a/error.h b/error.h
index 4c9bcac21f11f722640ad6046eb666c8b9709906..9849916c13446fb05da69f6c7b7ddada2fe0dae3 100644 (file)
--- a/error.h
+++ b/error.h
@@ -1,3 +1,11 @@
+/*
+ * Copyright (C) 2008 Andre Noll <maan@systemlinux.org>
+ *
+ * Licensed under the GPL v2. For licencing details see COPYING.
+ */
+
+/** \file error.h \brief Error handling functions and macros. */
+
 /**
  * This bit indicates whether a number is considered a system error code.
  * If yes, the system errno is just the result of clearing this bit from
@@ -11,6 +19,7 @@
 /** Set the system error bit for the given number. */
 #define ERRNO_TO_ERROR(num) ((num) | (1 << SYSTEM_ERROR_BIT))
 
+/** The list of all adu error codes with descriptions. */
 #define ALL_ERRORS \
        _ERROR(SUCCESS, "success") \
        _ERROR(SYNTAX, "syntax error") \
@@ -24,7 +33,7 @@
        _ERROR(EMPTY, "file empty") \
        _ERROR(MMAP, "mmap error") \
        _ERROR(OSL, "osl error") \
-       _ERROR(SIGNAL_SIG_ERR, "signal() returned SIG_ERR") \
+       _ERROR(SIGACTION, "could not install signal handler") \
        _ERROR(OUTPUT, "error writing output") \
        _ERROR(MALFORMED_FORMAT, "malformed format string") \
        _ERROR(BAD_ALIGN_SPEC, "bad alignment specifier") \
@@ -33,7 +42,8 @@
        _ERROR(BAD_UNIT, "invalid unit specifier") \
        _ERROR(BAD_ATOM, "invalid atom") \
        _ERROR(BAD_OUTPUT_ARG, "invalid name for output") \
-       _ERROR(REGEX, "regular expression error")
+       _ERROR(REGEX, "regular expression error") \
+       _ERROR(MKDIR, "could not create directory")
 
 
 /**
  */
 #define _ERROR(err, msg) E_ ## err,
 
+/**
+ * \cond (doxygen can not handle multiple definitions of the same macro).
+ *
+ * This just creates an enum consisting of the first argument of the above
+ * error list.
+ */
 enum error_codes {
        ALL_ERRORS
 };
 #undef _ERROR
+
+/*
+ * Here we define the array of error texts used by adu_strerror().
+ */
 #define _ERROR(err, msg) msg,
 #define DEFINE_ERRLIST char *adu_errlist[] = {ALL_ERRORS}
+/** \endcond */
 
 extern int osl_errno;
+
+/** Contains the description of all adu error codes. */
 extern char *adu_errlist[];
 
 
@@ -60,7 +83,7 @@ extern char *adu_errlist[];
  *
  * \return The error text of \a num.
  */
-static inline const char *adu_strerror(int num)
+_static_inline_ const char *adu_strerror(int num)
 {
        assert(num > 0);
        if (num == E_OSL) {
@@ -75,13 +98,15 @@ static inline const char *adu_strerror(int num)
 /**
  * Wrapper for osl library calls.
  *
+ * \param ret The return value of an osl library function.
+ *
  * This should be used for all calls to osl functions that return an osl error
  * code. It changes the return value to \p -E_OSL appropriately so that it can
  * be used for printing the correct error message.
  *
  * \return \a ret if \a ret >= 0, \p -E_OSL otherwise.
  */
-static inline int osl(int ret)
+_static_inline_ int osl(int ret)
 {
        if (ret >= 0)
                return ret;