#include "insert_event.h" #include "cli_arg_parsing.h" #include #include #include #include void usage() { printf ("-h\tprint this help\n"); printf ("-f\tspecify ics file path\n"); exit(0); } void get_cli_args(int argc, char **argv, char **file_name) { int opt = 0; memset(file_name, '\0', strlen(*file_name)); char *home = getenv("HOME"); *file_name = home; if (home != NULL) { strcat(*file_name, "/.local/share/evolution/calendar/system/calendar.ics"); } else { printf ("Environment variable HOME is not set.\n"); exit(1); } while ((opt = getopt(argc, argv, "f:hi")) != -1) { switch(opt) { case 'f': *file_name = optarg; break; case 'h': usage(); break; case 'i': insert_event(*file_name); break; } } }