diff options
-rw-r--r-- | src/args.c | 4 | ||||
-rw-r--r-- | src/calcurse.h | 1 | ||||
-rw-r--r-- | src/utils.c | 31 |
3 files changed, 33 insertions, 3 deletions
@@ -409,9 +409,7 @@ app_arg (int add_line, struct date *day, long date, int print_note, arg_print_date (today); print_date = 0; } - fputs (" * ", stdout); - fputs (ev->mesg, stdout); - fputs ("\n", stdout); + print_event (" * %m\n", today, ev); if (print_note && ev->note) print_notefile (stdout, ev->note, 2); } diff --git a/src/calcurse.h b/src/calcurse.h index e4acab2..57260d4 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -923,6 +923,7 @@ int shell_exec (int *, int *, char *); 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 *); /* vars.c */ extern int col, row; 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); + } +} |