aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test2.c
blob: be72e8f8a6752bae48309b8bcdc795b91f9527f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
    

}