X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=database.c;h=632ad563f6e86dcde07935a5b6f8edd03706d869;hb=20ea61a5f77f0f8c1354dc326a74f9a6c8362d6a;hp=a9e77b55ad15f9d344d9bdae93e052896b50b88e;hpb=e731ab4b326a1e7f9ca6d81963b57cf314e97953;p=pkg%2Fabook.git diff --git a/database.c b/database.c index a9e77b5..632ad56 100644 --- a/database.c +++ b/database.c @@ -57,7 +57,7 @@ abook_field standard_fields[] = { {"nick", N_("Nickname/Alias"), FIELD_STRING}, /* NICK */ {"url", N_("URL"), FIELD_STRING}, /* URL */ {"notes", N_("Notes"), FIELD_STRING}, /* NOTES */ - {"anniversary", N_("Anniversary day"), FIELD_DAY}, /* ANNIVERSARY */ + {"anniversary", N_("Anniversary day"), FIELD_DATE}, /* ANNIVERSARY */ {0} /* ITEM_FIELDS */ }; @@ -177,8 +177,8 @@ declare_new_field(char *key, char *name, char *type, int accept_standard) f->type = FIELD_EMAILS; else if(0 == strcasecmp("list", type)) f->type = FIELD_LIST; - else if(0 == strcasecmp("day", type)) - f->type = FIELD_DAY; + else if(0 == strcasecmp("date", type)) + f->type = FIELD_DATE; else return _("unknown type"); @@ -358,18 +358,13 @@ save_database() goto out; } - if(list_is_empty()) { - fclose(out); - unlink(datafile); - ret = 1; - goto out; - } + if(!list_is_empty()) + /* + * Possibly should check if write_database failed. + * Currently it returns always zero. + */ + write_database(out, e); - /* - * Possibly should check if write_database failed. - * Currently it returns always zero. - */ - write_database(out, e); fclose(out); if(access(datafile, F_OK) == 0 && @@ -433,7 +428,7 @@ validate_item(list_item item) case FIELD_STRING: max_field_len = MAX_FIELD_LEN; break; - case FIELD_DAY: + case FIELD_DATE: break; default: assert(0);