From 6a914ed14df9e9bca28eaca566ed7894f5491894 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Droz?= Date: Thu, 8 Nov 2012 00:04:01 +0100 Subject: [PATCH] vformat: make use of libvformat to parse vcard input --- filter.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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)) -- 2.39.2