aboutsummaryrefslogtreecommitdiffstats
path: root/src/day.c
diff options
context:
space:
mode:
authorWilliam Pettersson <william.pettersson@gmail.com>2013-07-16 19:34:29 +1000
committerLukas Fleischer <calcurse@cryptocrack.de>2013-07-16 11:44:55 +0200
commitfb61744f33a47899f94a1701d3d554b0a582a79b (patch)
tree60fc6184bd90c24cde0f1cf179c1f0f1c9a818d6 /src/day.c
parent906c2fa02731af0a02338b57096947f5b993759d (diff)
downloadcalcurse-fb61744f33a47899f94a1701d3d554b0a582a79b.tar.gz
calcurse-fb61744f33a47899f94a1701d3d554b0a582a79b.zip
Add -l/--limit option
Adds the -l/--limit command line option. Limits the number of appointments and/or ToDo items displayed. Signed-off-by: William Pettersson <william.pettersson@gmail.com> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/day.c')
-rw-r--r--src/day.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/day.c b/src/day.c
index c57d983..0a1a700 100644
--- a/src/day.c
+++ b/src/day.c
@@ -507,11 +507,13 @@ 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)
+ const char *fmt_ev, const char *fmt_rev, int *limit)
{
llist_item_t *i;
LLIST_FOREACH(&day_items, i) {
+ if (*limit == 0)
+ break;
struct day_item *day = LLIST_TS_GET_DATA(i);
switch (day->type) {
@@ -532,6 +534,7 @@ void day_write_stdout(long date, const char *fmt_apt, const char *fmt_rapt,
EXIT(_("unknown item type"));
/* NOTREACHED */
}
+ (*limit)--;
}
}