aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test2.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@inria.fr>1999-05-27 05:51:53 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-05-27 05:51:53 +0800
commit72c4a8deda6f0b0d740c8ba449bced1ac25de4d9 (patch)
treee94ceb1bb4d3e160f4dd44daa798e692553e7d9e /tests/test2.c
parentfa1d50623855f58ed95fba1f468d872a9e84e4d2 (diff)
downloadgsoc2013-evolution-72c4a8deda6f0b0d740c8ba449bced1ac25de4d9.tar.gz
gsoc2013-evolution-72c4a8deda6f0b0d740c8ba449bced1ac25de4d9.tar.zst
gsoc2013-evolution-72c4a8deda6f0b0d740c8ba449bced1ac25de4d9.zip
new func. Parses message header zone and returns a Glist of all header
1999-05-26 bertrand <Bertrand.Guiheneuf@inria.fr> * camel/gmime-utils.c (get_header_lines_from_file): new func. Parses message header zone and returns a Glist of all header lines. * tests/test2.c: tests message parsing * camel/gmime-utils.c (write_header_table_to_file): new func to write a table of headers. svn path=/trunk/; revision=948
Diffstat (limited to 'tests/test2.c')
-rw-r--r--tests/test2.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test2.c b/tests/test2.c
new file mode 100644
index 0000000000..be72e8f8a6
--- /dev/null
+++ b/tests/test2.c
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* tests mime message file parsing */
+#include "gmime-utils.h"
+#include "stdio.h"
+
+void print_header_line (gpointer data, gpointer user_data)
+{
+ GString *header_line = (GString *)data;
+ printf("\n--------- New Header ----------\n");
+ if ((header_line) && (header_line->str))
+ printf("%s\n", header_line->str);
+ printf("--------- End -----------------\n");
+}
+
+void
+main (int argc, char**argv)
+{
+ FILE *input_file;
+ GList *header_lines;
+
+
+ gtk_init (&argc, &argv);
+
+ input_file = fopen ("mail.test", "r");
+ if (!input_file) {
+ perror("could not open input file");
+ exit(2);
+ }
+
+ header_lines = get_header_lines_from_file (input_file);
+ if (header_lines) g_list_foreach (header_lines, print_header_line, NULL);
+ else printf("header is empty, no header line present\n");
+ fclose (input_file);
+
+
+}