src/day.c: Add day_write_stdout()
This function allows for writing stored items to stdout in a fashion similar to day_write_pad(). This will be used as a convenience wrapper when switching to day_store_items() in non-interactive mode and also allows for easily implementing a "pipe-day" feature. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
244b6c927d
commit
3763aa1ebf
@ -668,6 +668,8 @@ int day_store_items(long, unsigned *, unsigned *, regex_t *);
|
|||||||
struct day_items_nb *day_process_storage(struct date *, unsigned,
|
struct day_items_nb *day_process_storage(struct date *, unsigned,
|
||||||
struct day_items_nb *);
|
struct day_items_nb *);
|
||||||
void day_write_pad(long, int, int, int);
|
void day_write_pad(long, int, int, int);
|
||||||
|
void day_write_stdout(long, const char *, const char *, const char *,
|
||||||
|
const char *);
|
||||||
void day_popup_item(void);
|
void day_popup_item(void);
|
||||||
int day_check_if_item(struct date);
|
int day_check_if_item(struct date);
|
||||||
unsigned day_chk_busy_slices(struct date, int, int *);
|
unsigned day_chk_busy_slices(struct date, int, int *);
|
||||||
|
29
src/day.c
29
src/day.c
@ -455,6 +455,35 @@ void day_write_pad(long date, int width, int length, int incolor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Write the appointments and events for the selected day to stdout. */
|
||||||
|
void day_write_stdout(long date, const char *fmt_apt, const char *fmt_rapt,
|
||||||
|
const char *fmt_ev, const char *fmt_rev)
|
||||||
|
{
|
||||||
|
llist_item_t *i;
|
||||||
|
|
||||||
|
LLIST_FOREACH(&day_items, i) {
|
||||||
|
struct day_item *day = LLIST_TS_GET_DATA(i);
|
||||||
|
|
||||||
|
switch (day->type) {
|
||||||
|
case APPT:
|
||||||
|
print_apoint(fmt_apt, date, day->item.apt);
|
||||||
|
break;
|
||||||
|
case EVNT:
|
||||||
|
print_event(fmt_ev, date, day->item.ev);
|
||||||
|
break;
|
||||||
|
case RECUR_APPT:
|
||||||
|
print_recur_apoint(fmt_rapt, date, day->start, day->item.rapt);
|
||||||
|
break;
|
||||||
|
case RECUR_EVNT:
|
||||||
|
print_recur_event(fmt_rev, date, day->item.rev);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
EXIT(_("unknown item type"));
|
||||||
|
/* NOTREACHED */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Display an item inside a popup window. */
|
/* Display an item inside a popup window. */
|
||||||
void day_popup_item(void)
|
void day_popup_item(void)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user