]> git.notmuchmail.org Git - notmuch/blobdiff - util/zlib-extra.h
util: add gz_readline
[notmuch] / util / zlib-extra.h
diff --git a/util/zlib-extra.h b/util/zlib-extra.h
new file mode 100644 (file)
index 0000000..aedfd48
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef _ZLIB_EXTRA_H
+#define _ZLIB_EXTRA_H
+
+#include "util.h"
+#include <zlib.h>
+
+/* Like getline, but read from a gzFile. Allocation is with talloc.
+ * Returns:
+ *
+ *   UTIL_SUCCESS, UTIL_OUT_OF_MEMORY, UTIL_ERRNO, UTIL_GZERROR
+ *                     Consult util.h for description
+ *
+ *   UTIL_EOF          End of file encountered before
+ *                     any characters read
+ */
+util_status_t
+gz_getline (void *ctx, char **lineptr, ssize_t *bytes_read, gzFile stream);
+
+/* return a suitable error string based on the return status
+ *  from gz_readline
+ */
+
+const char *
+gz_error_string (util_status_t status, gzFile stream);
+#endif