From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ES0JFDnKk16NJwAA0tVLHw (envelope-from ) for ; Mon, 13 Apr 2020 02:11:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id AKcmNzvKk162dAAAbx9fmQ (envelope-from ) for ; Mon, 13 Apr 2020 02:11:07 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 84B60940446 for ; Mon, 13 Apr 2020 02:11:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 4AFF76DE13CD; Sun, 12 Apr 2020 19:10:46 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lrjfHL5ctMhC; Sun, 12 Apr 2020 19:10:45 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 23F816DE1492; Sun, 12 Apr 2020 19:10:32 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id C7FBC6DE13D3 for ; Sun, 12 Apr 2020 19:10:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y9_KMa9i2m39 for ; Sun, 12 Apr 2020 19:10:30 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 880A96DE0F1C for ; Sun, 12 Apr 2020 19:10:27 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.92) (envelope-from ) id 1jNoYM-0003j8-Iz; Sun, 12 Apr 2020 22:10:26 -0400 Received: (nullmailer pid 2799601 invoked by uid 1000); Mon, 13 Apr 2020 02:10:19 -0000 From: David Bremner To: David Bremner , notmuch@notmuchmail.org Subject: [PATCH 4/5] cli/dump: define GZPUTS and use it in notmuch-dump Date: Sun, 12 Apr 2020 23:10:15 -0300 Message-Id: <20200413021016.2799496-5-david@tethera.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200413021016.2799496-1-david@tethera.net> References: <20200412173432.2575450-1-david@tethera.net> <20200413021016.2799496-1-david@tethera.net> MIME-Version: 1.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 X-Spam-Score: -0.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Scan-Result: default: False [-0.01 / 13.00]; ARC_NA(0.00)[]; GENERIC_REPUTATION(0.00)[-0.449434545864]; FORGED_SENDER_MAILLIST(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:c]; IP_REPUTATION_HAM(0.00)[asn: 27017(-0.18), country: US(-0.01), ip: 50.126.95.6(-0.45)]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[notmuch@notmuchmail.org]; DMARC_NA(0.00)[tethera.net]; HAS_LIST_UNSUB(-0.01)[]; RCVD_TLS_LAST(0.00)[]; MX_GOOD(-0.50)[cached: notmuchmail.org]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; MAILLIST(-0.20)[mailman]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:27017, ipnet:50.126.64.0/18, country:US]; FROM_NEQ_ENVFROM(0.00)[david@tethera.net,notmuch-bounces@notmuchmail.org]; RCVD_COUNT_SEVEN(0.00)[8] X-TUID: CoaP3IrVBzXq Similarly to GZPRINTF, this is a drop in replacement that can be improved where needd. --- notmuch-client.h | 1 + notmuch-dump.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/notmuch-client.h b/notmuch-client.h index 55d4d526..7efcb06f 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -499,6 +499,7 @@ print_status_gzbytes (const char *loc, #define ASSERT_GZBYTES(file, bytes) ( (print_status_gzbytes(__location__, file, bytes)) ? exit(1) : 0 ) #define GZPRINTF(file, fmt, ...) ASSERT_GZBYTES(file, gzprintf (file, fmt, ##__VA_ARGS__)); +#define GZPUTS(file, str) ASSERT_GZBYTES(file, gzputs (file, str)); #include "command-line-arguments.h" diff --git a/notmuch-dump.c b/notmuch-dump.c index ca45d885..fb322237 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -76,7 +76,7 @@ print_dump_header (gzFile output, int output_format, int include) NOTMUCH_DUMP_VERSION); if (include & DUMP_INCLUDE_CONFIG) { - gzputs (output, "config"); + GZPUTS (output, "config"); sep = ","; } if (include & DUMP_INCLUDE_PROPERTIES) { @@ -86,7 +86,7 @@ print_dump_header (gzFile output, int output_format, int include) if (include & DUMP_INCLUDE_TAGS) { GZPRINTF (output, "%stags", sep); } - gzputs (output, "\n"); + GZPUTS (output, "\n"); } static int @@ -174,12 +174,12 @@ dump_tags_message (void *ctx, const char *tag_str = notmuch_tags_get (tags); if (! first) - gzputs (output, " "); + GZPUTS (output, " "); first = 0; if (output_format == DUMP_FORMAT_SUP) { - gzputs (output, tag_str); + GZPUTS (output, tag_str); } else { if (hex_encode (ctx, tag_str, buffer_p, size_p) != HEX_SUCCESS) { @@ -192,7 +192,7 @@ dump_tags_message (void *ctx, } if (output_format == DUMP_FORMAT_SUP) { - gzputs (output, ")\n"); + GZPUTS (output, ")\n"); } else { if (make_boolean_term (ctx, "id", message_id, buffer_p, size_p)) { -- 2.25.1