aboutsummaryrefslogtreecommitdiffstats
path: root/agenda_entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'agenda_entry.c')
-rw-r--r--agenda_entry.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/agenda_entry.c b/agenda_entry.c
index fa933c6..91a23b9 100644
--- a/agenda_entry.c
+++ b/agenda_entry.c
@@ -1,3 +1,4 @@
+#include "utils.h"
#include "agenda_entry.h"
char *next_word(char *str) { return strstr(str, " ")+1; }
@@ -24,7 +25,7 @@ entry read_agenda_entry(char *agenda) {
//find out if there is a tag, and extract it
lookahead = strstr(cursor, ":\n");
if (lookahead && (lookahead < nextentry)) {
- tmp = strstr(cursor, ":");
+ tmp = rstrchr(cursor, lookahead-1, ':');
agenda_entry.tag = (char *)malloc(lookahead - tmp);
strncpy(agenda_entry.tag, tmp+1, lookahead - tmp - 1);
agenda_entry.tag[lookahead - tmp - 1] = '\0'; // here we're actually modifying lookahead-tmp cause the array is zero indexed