]> git.deb.at Git - pkg/abook.git/commitdiff
* clean up ISO 8601 string generation
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Sat, 26 Aug 2006 18:17:14 +0000 (18:17 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Sat, 26 Aug 2006 18:17:14 +0000 (18:17 +0000)
* atoi() -> safe_atoi()

TODO
edit.c

diff --git a/TODO b/TODO
index e04c561c939108bb957ffb3d538cd957ee55e38d..c13e549aab70d53d7478903e11e543aaf4ed3cc9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,3 @@
-0.6
- - input for day type should be implemented
-
 generic:
  - grouping
  - new file format (xml?)
diff --git a/edit.c b/edit.c
index a08fdc9599cee2fb87aefb22ff439684a20f488c..ef956ef80c364ae4813842ec49335422f8cc3093 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -251,9 +251,12 @@ editor_print_data(int tab, int item)
                                strncpy(buf, str, sizeof(buf));
 
                        if(str && parse_date_string(buf, &day, &month, &year)) {
-                               str = strdup_printf(year ? " %04d-%02d-%02d" :
-                                       "%c%02d-%02d", year ? year : ' ',
-                                       month, day);
+                               if(year)
+                                       str = strdup_printf("%04d-%02d-%02d",
+                                               year, month, day);
+                               else
+                                       str = strdup_printf("--%02d-%02d",
+                                               month, day);
                                mvwaddnstr(editw, y, TAB_COLON_POS + 2, str,
                                        bytes2width(str, FIELD_MAX_WIDTH));
                                free(str);
@@ -440,8 +443,8 @@ parse_date_string(char *s, int *day, int *month, int *year)
                                return FALSE;
                        *s++ = '\0';
                        switch(i) {
-                               case 1: *year = atoi(p); break;
-                               case 2: *month = atoi(p); break;
+                               case 1: *year = safe_atoi(p); break;
+                               case 2: *month = safe_atoi(p); break;
                        }
                        p = s;
                } else