From: Raphaƫl Droz Date: Wed, 7 Nov 2012 23:04:01 +0000 (+0100) Subject: vformat: make use of libvformat to parse vcard input X-Git-Tag: upstream/0.6.1~2^2~38 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=6a914ed14df9e9bca28eaca566ed7894f5491894;p=pkg%2Fabook.git vformat: make use of libvformat to parse vcard input --- diff --git a/filter.c b/filter.c index 1c96a88..fd81174 100644 --- a/filter.c +++ b/filter.c @@ -29,6 +29,10 @@ #include "xmalloc.h" #include +#ifdef VFORMAT +#include "vcard.h" +#endif + extern abook_field_list *fields_list; extern int fields_count; @@ -293,6 +297,18 @@ import_file(char filtname[FILTNAME_LEN], char *filename) if(i < 0) return -1; +#ifdef VFORMAT + // this is a special case for + // libvformat whose API expects a filename + if(!strcmp(filtname, "vcard")) { + if(!strcmp(filename, "-")) + ret = vcard_parse_file_libvformat("/dev/stdin"); + else + ret = vcard_parse_file_libvformat(filename); + } + else +#endif + if(!strcmp(filename, "-")) { struct stat s; if((fstat(fileno(stdin), &s)) == -1 || S_ISDIR(s.st_mode))