X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;ds=sidebyside;f=database.c;h=49fa042f0f017ec5242e3664ef179a7d0ad423d2;hb=23d6687f69d455ff4794199b086817574deea3b8;hp=086ed77633b86388e9723462d42a062156561d49;hpb=7751b3edc145646e6b55e2fda82eb5619fbe0074;p=pkg%2Fabook.git diff --git a/database.c b/database.c index 086ed77..49fa042 100644 --- a/database.c +++ b/database.c @@ -1,6 +1,6 @@ /* - * $Id: database.c,v 1.36 2006/08/09 21:54:56 cduval Exp $ + * $Id: database.c,v 1.38 2006/08/25 22:51:00 cduval Exp $ * * by JH * @@ -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);