diff options
Diffstat (limited to 'src/print.c')
-rw-r--r-- | src/print.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/print.c b/src/print.c index 02f78c6..34c1802 100644 --- a/src/print.c +++ b/src/print.c @@ -195,8 +195,7 @@ void print_script(struct calendar_s *cal) size_t i, j; struct tm t = { 0 }; time_t now = time(NULL), *rttmp; - char cd; - bool first = true; + char cd, lt; struct buf_s *buf = malloc(cal->count * sizeof(*buf)); if (buf == NULL) { @@ -205,6 +204,7 @@ void print_script(struct calendar_s *cal) } cd = opt_col_delim(); + lt = opt_line_term(); /* fill buffer with active events */ for (i = 0, j = 0; i < cal->count; i++) { @@ -223,23 +223,20 @@ void print_script(struct calendar_s *cal) for (i = 0; i < j; i++) { t = *localtime( &(buf[i].rt) ); - if (!first) - printf("%c", opt_line_delim()); - printf( "%d%c%d%c%d%c%d%c%d%c%d%c" /* date */ "%d%c" /* urgent */ "%d%c" /* local */ "%s" /* msg */ + "%c" /* line_end */ , t.tm_year + 1900, cd, t.tm_mon + 1, cd, t.tm_mday, cd, t.tm_hour, cd, t.tm_min, cd, t.tm_sec, cd, cal->entries[i].urgent, cd, cal->entries[i].local, cd, - (cal->entries[i].msg == NULL ? "" : cal->entries[i].msg) + (cal->entries[i].msg == NULL ? "" : cal->entries[i].msg), + lt ); - - first = false; } free(buf); |