gmime-test: ensure fileno is defined

This commit is contained in:
Dirk-Jan C. Binnema
2021-11-03 22:08:16 +02:00
parent 8028f88a51
commit 32849b243c

View File

@ -1,7 +1,5 @@
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
/* /*
** Copyright (C) 2011-2017 Dirk-Jan C. Binnema <djcb@cthulhu> ** Copyright (C) 2011-2021 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify it ** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the ** under the terms of the GNU General Public License as published by the
@ -19,10 +17,7 @@
** **
*/ */
/* gmime-test; compile with: #define _POSIX_C_SOURCE
gcc -o gmime-test gmime-test.c -Wall -O0 -ggdb \
`pkg-config --cflags --libs gmime-2.6`
*/
#include <gmime/gmime.h> #include <gmime/gmime.h>
#include <stdio.h> #include <stdio.h>
@ -64,10 +59,7 @@ get_refs_str (GMimeMessage *msg)
for (rv = NULL, i = 0; i < refs_len; ++i) { for (rv = NULL, i = 0; i < refs_len; ++i) {
const char* msgid; const char* msgid;
msgid = g_mime_references_get_message_id(mime_refs, i); msgid = g_mime_references_get_message_id(mime_refs, i);
rv = g_strdup_printf ("%s%s%s", rv = g_strdup_printf("%s%s%s", rv ? rv : "", rv ? "," : "", msgid);
rv ? rv : "",
rv ? "," : "",
msgid);
} }
g_mime_references_free(mime_refs); g_mime_references_free(mime_refs);
@ -94,7 +86,6 @@ print_date (GMimeMessage *msg)
} }
} }
static void static void
print_body(GMimeMessage* msg) print_body(GMimeMessage* msg)
{ {
@ -106,7 +97,6 @@ print_body (GMimeMessage *msg)
if (GMIME_IS_MULTIPART(body)) if (GMIME_IS_MULTIPART(body))
body = g_mime_multipart_get_part(GMIME_MULTIPART(body), 0); body = g_mime_multipart_get_part(GMIME_MULTIPART(body), 0);
if (!GMIME_IS_PART(body)) if (!GMIME_IS_PART(body))
return; return;
@ -177,8 +167,6 @@ test_message (GMimeMessage *msg)
return TRUE; return TRUE;
} }
static gboolean static gboolean
test_stream(GMimeStream* stream) test_stream(GMimeStream* stream)
{ {
@ -215,7 +203,6 @@ leave:
return rv; return rv;
} }
static gboolean static gboolean
test_file(const char* path) test_file(const char* path)
{ {
@ -228,8 +215,7 @@ test_file (const char *path)
file = fopen(path, "r"); file = fopen(path, "r");
if (!file) { if (!file) {
g_warning ("cannot open file '%s': %s", path, g_warning("cannot open file '%s': %s", path, g_strerror(errno));
g_strerror(errno));
rv = FALSE; rv = FALSE;
goto leave; goto leave;
} }
@ -252,7 +238,6 @@ leave:
return rv; return rv;
} }
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {