aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/event.c')
-rw-r--r--src/event.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/event.c b/src/event.c
index c16ca4e..7c371e4 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -149,7 +149,7 @@ void event_write(struct event *o, FILE * f)
}
/* Load the events from file */
-struct event *event_scan(FILE * f, struct tm start, int id, char *note,
+char *event_scan(FILE * f, struct tm start, int id, char *note,
struct item_filter *filter)
{
char buf[BUFSIZ], *nl;
@@ -157,13 +157,13 @@ struct event *event_scan(FILE * f, struct tm start, int id, char *note,
struct event *ev = NULL;
int cond;
- EXIT_IF(!check_date(start.tm_year, start.tm_mon, start.tm_mday) ||
- !check_time(start.tm_hour, start.tm_min),
- _("date error in event"));
+ if (!check_date(start.tm_year, start.tm_mon, start.tm_mday) ||
+ !check_time(start.tm_hour, start.tm_min))
+ return _("illegal date in event");
/* Read the event description */
if (!fgets(buf, sizeof buf, f))
- return NULL;
+ return _("error in appointment description");
nl = strchr(buf, '\n');
if (nl) {
@@ -177,8 +177,9 @@ struct event *event_scan(FILE * f, struct tm start, int id, char *note,
start.tm_mon--;
tstart = mktime(&start);
- EXIT_IF(tstart == -1, _("date error in the event\n"));
- tend = tstart + DAYINSEC - 1;
+ if (tstart == -1)
+ return _("date error in event\n");
+ tend = ENDOFDAY(tstart);
/* Filter item. */
if (filter) {
@@ -205,8 +206,7 @@ struct event *event_scan(FILE * f, struct tm start, int id, char *note,
}
if (!ev)
ev = event_new(buf, note, tstart, id);
-
- return ev;
+ return NULL;
}
/* Delete an event from the list. */