From 31c284414c6effcd85add7a7b19d4464ee0e3625 Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Sat, 26 Aug 2006 18:17:14 +0000 Subject: [PATCH] * clean up ISO 8601 string generation * atoi() -> safe_atoi() --- TODO | 3 --- edit.c | 13 ++++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index e04c561..c13e549 100644 --- 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 a08fdc9..ef956ef 100644 --- 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 -- 2.39.2