]> git.notmuchmail.org Git - notmuch/blobdiff - status.c
status: add print_status_gzbytes
[notmuch] / status.c
index d0ae47f4d03cb6eb5522df2913f170d77d15e71f..09d82a172ba8315aa5184db0aa6bedfa6651b180 100644 (file)
--- a/status.c
+++ b/status.c
@@ -72,3 +72,17 @@ status_to_exit (notmuch_status_t status)
        return EXIT_FAILURE;
     }
 }
+
+notmuch_status_t
+print_status_gzbytes (const char *loc, gzFile file, int bytes)
+{
+    if (bytes <= 0) {
+       int errnum;
+       const char *errstr = gzerror (file, &errnum);
+       fprintf (stderr, "%s: zlib error %s (%d)\n", loc, errstr, errnum);
+       return NOTMUCH_STATUS_FILE_ERROR;
+    } else {
+       return NOTMUCH_STATUS_SUCCESS;
+    }
+}
+