Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/insert_event.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
#include "date_time_handling.h"
#include "insert_event.h"
#include "string_handling.h"
#include "date_time_handling.h"
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <uuid/uuid.h>

// Prompts a user to insert data for one event and saves it in
// the iCalendar file at "file_name".
// Exits the program afterwards.
void insert_event(char *file_name) {
int myfd = open(file_name, O_RDWR);
if (myfd == -1) {
fprintf(stderr, "Error opening file \"%s\".\n", file_name);
fprintf(stderr, "%s.\n", strerror(errno));
exit(1);
}

bool all_day_event = false;
char summary_buf[256] = "SUMMARY:";
char *input_buffer = &summary_buf[8];
Expand Down
12 changes: 7 additions & 5 deletions src/parse_ics.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "string_handling.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -72,17 +73,18 @@ void unfolding_string(char *folded_string, char *unfolded_string) {
}
}

/* this function takes the head of an empty initialized event list
* and the path to the ics file
* it will "fill" the list
*/
// Takes the head of an empty initialized event list
// and the path to the ics file.
// "Fills" the linked list.
// Exits the program on error.
void parse_ics_file(char *file_path, struct event **head) {
char my_event[8192] = "";
char unfolded_event[8192] = "";

int myfd = open(file_path, O_RDONLY);
if (myfd == -1) {
perror ("Error opening file");
fprintf(stderr, "Error opening file \"%s\".\n", file_path);
fprintf(stderr, "%s.\n", strerror(errno));
exit(1);
}

Expand Down