Code

utils error, strbuf: Added sdb_error_chomp(), sdb_strbuf_chomp().
[sysdb.git] / src / include / utils / error.h
index 73b48baacf2c1cdf9f5df66118166fc90c6df408..33731e129e72a2250f7b7d1ecbe25922359fc56d 100644 (file)
@@ -39,6 +39,8 @@
 #ifndef SDB_UTILS_ERROR_H
 #define SDB_UTILS_ERROR_H 1
 
+#include <stddef.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -89,6 +91,13 @@ sdb_error_set(const char *fmt, ...);
 int
 sdb_error_append(const char *fmt, ...);
 
+/*
+ * sdb_error_chomp:
+ * Remove all consecutive newline characters at the end of the error message.
+ */
+int
+sdb_error_chomp(void);
+
 /*
  * sdb_error_log:
  * Log the current error message with the specified priority. See sdb_log for
@@ -114,6 +123,14 @@ sdb_error_get(void);
 int
 sdb_error_get_prio(void);
 
+/*
+ * sdb_strerror:
+ * This is a wrapper around the system's strerror function which ensures that
+ * a pointer to the formatted error message is returned.
+ */
+char *
+sdb_strerror(int errnum, char *strerrbuf, size_t buflen);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif