From: Raphaƫl Droz Date: Fri, 19 Apr 2013 15:32:39 +0000 (+0200) Subject: csv export: "allcsv" output changed X-Git-Tag: upstream/0.6.1~2^2~16 X-Git-Url: https://git.deb.at/?p=pkg%2Fabook.git;a=commitdiff_plain;h=413f19f049d680fb45485de4c2c5a4b2589f319d;hp=2367d83337f5b8cf1f4b910f10efd4eb30f6721d csv export: "allcsv" output changed - fields name in the header are now lowercase - "MOBILEPHONE" changed to "mobile" --- diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 32e5309..412bc20 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -27,6 +27,8 @@ Git: - It depends on the --enable-vformat ./configure switch - It's only used as an input filter, especially useful to deal with multi-valued fields and encoded characters. + * allcsv output's header changed to lowercase + and "MOBILEPHONE" changed to "mobile" (consistent w.r.t. standard_fields) 0.6.0pre2 (2010-07-22): * Added anniversary as a default field diff --git a/filter.c b/filter.c index 20c8973..0447a3c 100644 --- a/filter.c +++ b/filter.c @@ -35,6 +35,8 @@ extern abook_field_list *fields_list; extern int fields_count; +// see also enum field_types @database.h +extern abook_field standard_fields[]; /* * function declarations @@ -1868,7 +1870,7 @@ allcsv_export_database(FILE *out, struct db_enumerator e) PHONE, WORKPHONE, FAX, - MOBILEPHONE, + MOBILEPHONE, // spelled "mobile" in standard_fields NICK, URL, NOTES, @@ -1878,23 +1880,11 @@ allcsv_export_database(FILE *out, struct db_enumerator e) }; fprintf(out, "#"); - fprintf(out, "\"NAME\","); - fprintf(out, "\"EMAIL\","); - fprintf(out, "\"ADDRESS\","); - fprintf(out, "\"ADDRESS2\","); - fprintf(out, "\"CITY\","); - fprintf(out, "\"STATE\","); - fprintf(out, "\"ZIP\","); - fprintf(out, "\"COUNTRY\","); - fprintf(out, "\"PHONE\","); - fprintf(out, "\"WORKPHONE\","); - fprintf(out, "\"FAX\","); - fprintf(out, "\"MOBILEPHONE\","); - fprintf(out, "\"NICK\","); - fprintf(out, "\"URL\","); - fprintf(out, "\"NOTES\","); - fprintf(out, "\"ANNIVERSARY\","); - fprintf(out, "\"GROUPS\"\n"); + int i = 0; + while(allcsv_export_fields[i+1] != CSV_LAST) { + fprintf(out, "\"%s\",", standard_fields[i++].key); + } + fprintf(out, "\"%s\"\n", standard_fields[i].key); csv_export_common(out, e, allcsv_export_fields, NULL); @@ -2478,8 +2468,6 @@ bsdcal_export_database(FILE *out, struct db_enumerator e) return 0; } -// see also enum field_types @database.h -extern abook_field standard_fields[]; static int find_field_enum(char *s) { int i = -1;