aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/args.c10
-rw-r--r--src/calcurse.h3
-rw-r--r--src/utils.c27
3 files changed, 33 insertions, 7 deletions
diff --git a/src/args.c b/src/args.c
index d27a575..a944513 100644
--- a/src/args.c
+++ b/src/args.c
@@ -385,9 +385,7 @@ app_arg (int add_line, struct date *day, long date, int print_note,
arg_print_date (today);
print_date = 0;
}
- fputs (" * ", stdout);
- fputs (re->mesg, stdout);
- fputs ("\n", stdout);
+ print_recur_event (" * %m\n", today, re);
if (print_note && re->note)
print_notefile (stdout, re->note, 2);
}
@@ -482,10 +480,8 @@ app_arg (int add_line, struct date *day, long date, int print_note,
arg_print_date (today);
print_date = 0;
}
- apt = apoint_recur_s2apoint_s (ra);
- print_apoint (" - %S -> %E\n\t%m\n", today, apt);
- mem_free (apt->mesg);
- mem_free (apt);
+ recur_apoint_find_occurrence (ra, today, &occurrence);
+ print_recur_apoint (" - %S -> %E\n\t%m\n", today, occurrence, ra);
if (print_note && ra->note)
print_notefile (stdout, ra->note, 2);
apt = NULL;
diff --git a/src/calcurse.h b/src/calcurse.h
index 57260d4..9094df8 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -924,6 +924,9 @@ int child_wait (int *, int *, int);
void press_any_key (void);
void print_apoint (const char *, long, struct apoint *);
void print_event (const char *, long, struct event *);
+void print_recur_apoint (const char *, long, unsigned,
+ struct recur_apoint *);
+void print_recur_event (const char *, long, struct recur_event *);
/* vars.c */
extern int col, row;
diff --git a/src/utils.c b/src/utils.c
index 6b4fa1d..e94c7fa 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1033,3 +1033,30 @@ print_event (const char *format, long day, struct event *ev)
putchar (*p);
}
}
+
+/* Print a formatted recurrent appointment to stdout. */
+void
+print_recur_apoint (const char *format, long day, unsigned occurrence,
+ struct recur_apoint *rapt)
+{
+ struct apoint apt;
+
+ apt.start = occurrence;
+ apt.dur = rapt->dur;
+ apt.mesg = rapt->mesg;
+ apt.note = rapt->note;
+
+ print_apoint (format, day, &apt);
+}
+
+/* Print a formatted recurrent event to stdout. */
+void
+print_recur_event (const char *format, long day, struct recur_event *rev)
+{
+ struct event ev;
+
+ ev.mesg = rev->mesg;
+ ev.note = rev->note;
+
+ print_event (format, day, &ev);
+}