summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 4628798..6b4fa1d 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1002,3 +1002,34 @@ print_apoint (const char *format, long day, struct apoint *apt)
putchar (*p);
}
}
+
+/* Print a formatted event to stdout. */
+void
+print_event (const char *format, long day, struct event *ev)
+{
+ const char *p;
+
+ for (p = format; *p; p++)
+ {
+ if (*p == '%') {
+ p++;
+ switch (*p)
+ {
+ case 'm':
+ printf ("%s", ev->mesg);
+ break;
+ case 'n':
+ printf ("%s", ev->note);
+ break;
+ case '\0':
+ return;
+ break;
+ default:
+ putchar ('?');
+ break;
+ }
+ }
+ else
+ putchar (*p);
+ }
+}