]> git.deb.at Git - pkg/abook.git/blobdiff - database.c
Imported Upstream version 0.6.0~pre1
[pkg/abook.git] / database.c
index 086ed77633b86388e9723462d42a062156561d49..49fa042f0f017ec5242e3664ef179a7d0ad423d2 100644 (file)
@@ -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 <jheinonen@users.sourceforge.net>
  *
@@ -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);