diff options
author | Nat Friedman <nat@src.gnome.org> | 2000-03-23 10:18:50 +0800 |
---|---|---|
committer | Nat Friedman <nat@src.gnome.org> | 2000-03-23 10:18:50 +0800 |
commit | 9578e1f46fee373be32dbf67efe4af7638def701 (patch) | |
tree | 31c4dc8164538c354f2c1ac1e78efe7dad077d9f /addressbook/backend/ebook | |
parent | 425b07fa747e1bd02a5bb86e207de172e65d580c (diff) | |
download | gsoc2013-evolution-9578e1f46fee373be32dbf67efe4af7638def701.tar gsoc2013-evolution-9578e1f46fee373be32dbf67efe4af7638def701.tar.gz gsoc2013-evolution-9578e1f46fee373be32dbf67efe4af7638def701.tar.bz2 gsoc2013-evolution-9578e1f46fee373be32dbf67efe4af7638def701.tar.lz gsoc2013-evolution-9578e1f46fee373be32dbf67efe4af7638def701.tar.xz gsoc2013-evolution-9578e1f46fee373be32dbf67efe4af7638def701.tar.zst gsoc2013-evolution-9578e1f46fee373be32dbf67efe4af7638def701.zip |
The ECard tester.
svn path=/trunk/; revision=2148
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r-- | addressbook/backend/ebook/test-card.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c new file mode 100644 index 0000000000..2576c87e6b --- /dev/null +++ b/addressbook/backend/ebook/test-card.c @@ -0,0 +1,71 @@ +#include <gnome.h> +#include <e-card.h> + +#define TEST_VCARD \ +"BEGIN:VCARD +" \ +"FN:Nat +" \ +"N:Friedman;Nat;D;Mr. +" \ +"BDAY:1977-08-06 +" \ +"TEL;WORK:617 679 1984 +" \ +"TEL;CELL:123 456 7890 +" \ +"EMAIL;INTERNET:nat@nat.org +" \ +"EMAIL;INTERNET:nat@helixcode.com +" \ +"END:VCARD +" \ +" +" + +static char * +read_file (char *name) +{ + int len; + char buff[65536]; + char line[1024]; + FILE *f; + + f = fopen (name, "r"); + if (f == NULL) + g_error ("Unable to open %s!\n", name); + + len = 0; + while (fgets (line, sizeof (line), f) != NULL) { + strcpy (buff + len, line); + len += strlen (line); + } + + fclose (f); + + return g_strdup (buff); +} + + + +int +main (int argc, char **argv) +{ + char *cardstr; + ECard *card; + + gnome_init ("TestCard", "0.0", argc, argv); + + cardstr = NULL; + if (argc == 2) + cardstr = read_file (argv [1]); + + if (cardstr == NULL) + cardstr = TEST_VCARD; + + card = e_card_new (cardstr); + + gtk_object_unref (GTK_OBJECT (card)); + + return 0; +} |