1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 #include <libebook-contacts/libebook-contacts.h>
12 GString *str = g_string_new ("");
16 g_warning ("Requires one parameter, a vCard file\n");
20 #if !GLIB_CHECK_VERSION (2, 35, 1)
21 g_type_init_with_debug_flags (G_TYPE_DEBUG_OBJECTS);
24 fp = fopen (argv[1], "r");
26 g_warning ("Faile to open vCard file '%s'", argv[1]);
32 if (fgets (buf, sizeof (buf), fp))
33 str = g_string_append (str, buf);
37 vcard = e_vcard_new_from_string (str->str);
38 g_string_free (str, TRUE);
40 e_vcard_dump_structure (vcard);
42 parsed_vcard = e_vcard_to_string (vcard, EVC_FORMAT_VCARD_21);
43 printf ("\nvCard 2.1: %s\n", parsed_vcard);
44 g_free (parsed_vcard);
46 parsed_vcard = e_vcard_to_string (vcard, EVC_FORMAT_VCARD_30);
47 printf ("\nvCard 3.0: %s\n", parsed_vcard);
48 g_free (parsed_vcard);
50 g_object_unref (vcard);