dont put field name summary into summary field

This commit is contained in:
bjt-user 2024-01-20 21:00:18 +01:00
parent 7a5b3bc97a
commit ff20bb92f7
2 changed files with 8 additions and 7 deletions

View File

@ -52,7 +52,7 @@ void print_upcoming(struct event *head, char current_start_date[], int show_all_
if (strcmp(head->start_date, current_start_date) >= 0) { if (strcmp(head->start_date, current_start_date) >= 0) {
pretty_print_date_time(head->start_date); pretty_print_date_time(head->start_date);
print_end_date(head->end_date, head->start_date); print_end_date(head->end_date, head->start_date);
printf("\n%s\n", head->summary); printf("\nSUMMARY: %s\n", head->summary);
if (!show_all_events) { if (!show_all_events) {
i++; i++;

View File

@ -9,13 +9,14 @@
void parse_event(char event_string[], struct event **head) void parse_event(char event_string[], struct event **head)
{ {
char *start_date = strstr(event_string, "\nDTSTART"); char* start_date = strstr(event_string, "\nDTSTART");
char *end_date = strstr(event_string, "\nDTEND"); char* end_date = strstr(event_string, "\nDTEND");
char *summary = strstr(event_string, "\nSUMMARY"); char* summary = strstr(event_string, "\nSUMMARY");
summary = strchr(summary, ':') + 1;
char *start_date_str = malloc(256); char* start_date_str = malloc(256);
char *end_date_str = malloc(256); char* end_date_str = malloc(256);
char *summary_str = malloc(512); char* summary_str = malloc(512);
memset(start_date_str, '\0', 256); memset(start_date_str, '\0', 256);
memset(end_date_str, '\0', 256); memset(end_date_str, '\0', 256);