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
1 changed files with 92 additions and 107 deletions

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
** under the terms of the GNU General Public License as published by the
@ -19,10 +17,7 @@
**
*/
/* gmime-test; compile with:
gcc -o gmime-test gmime-test.c -Wall -O0 -ggdb \
`pkg-config --cflags --libs gmime-2.6`
*/
#define _POSIX_C_SOURCE
#include <gmime/gmime.h>
#include <stdio.h>
@ -64,10 +59,7 @@ get_refs_str (GMimeMessage *msg)
for (rv = NULL, i = 0; i < refs_len; ++i) {
const char* msgid;
msgid = g_mime_references_get_message_id(mime_refs, i);
rv = g_strdup_printf ("%s%s%s",
rv ? rv : "",
rv ? "," : "",
msgid);
rv = g_strdup_printf("%s%s%s", rv ? rv : "", rv ? "," : "", msgid);
}
g_mime_references_free(mime_refs);
@ -94,7 +86,6 @@ print_date (GMimeMessage *msg)
}
}
static void
print_body(GMimeMessage* msg)
{
@ -106,7 +97,6 @@ print_body (GMimeMessage *msg)
if (GMIME_IS_MULTIPART(body))
body = g_mime_multipart_get_part(GMIME_MULTIPART(body), 0);
if (!GMIME_IS_PART(body))
return;
@ -177,8 +167,6 @@ test_message (GMimeMessage *msg)
return TRUE;
}
static gboolean
test_stream(GMimeStream* stream)
{
@ -215,7 +203,6 @@ leave:
return rv;
}
static gboolean
test_file(const char* path)
{
@ -228,8 +215,7 @@ test_file (const char *path)
file = fopen(path, "r");
if (!file) {
g_warning ("cannot open file '%s': %s", path,
g_strerror(errno));
g_warning("cannot open file '%s': %s", path, g_strerror(errno));
rv = FALSE;
goto leave;
}
@ -252,7 +238,6 @@ leave:
return rv;
}
int
main(int argc, char* argv[])
{