X-Git-Url: https://git.deb.at/?a=blobdiff_plain;ds=sidebyside;f=filter.c;h=0447a3c87081a7a06fc41fbbecef91189d3801e7;hb=413f19f049d680fb45485de4c2c5a4b2589f319d;hp=20c89739623de515398e183a4873d247d0b36f0e;hpb=2367d83337f5b8cf1f4b910f10efd4eb30f6721d;p=pkg%2Fabook.git 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;