added cli parsing functions
This commit is contained in:
17
src/main.c
17
src/main.c
@ -1,3 +1,4 @@
|
||||
#include "cli_arg_parsing.h"
|
||||
#include "date_time_handling.h"
|
||||
#include "list_handling.h"
|
||||
#include "cut_string.h"
|
||||
@ -12,21 +13,13 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
int main() {
|
||||
//const char ICS_PATH[] = "tests/calendar.ics";
|
||||
char *ICS_PATH;
|
||||
char *HOME = getenv("HOME");
|
||||
|
||||
if (HOME != NULL) {
|
||||
ICS_PATH = strcat(HOME, "/.local/share/evolution/calendar/system/calendar.ics");
|
||||
} else {
|
||||
printf ("Environment variable HOME is not set.\n");
|
||||
return 1;
|
||||
}
|
||||
int main(int argc, char **argv) {
|
||||
char *ics_path = "";
|
||||
get_cli_args(argc, argv, &ics_path);
|
||||
|
||||
char my_line[4096] = "";
|
||||
|
||||
int myfd = open(ICS_PATH, O_RDONLY);
|
||||
int myfd = open(ics_path, O_RDONLY);
|
||||
if (myfd == -1) {
|
||||
perror ("Error opening file");
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user