get home env var and evolution path for ics file

This commit is contained in:
bjoernf 2023-08-15 21:17:24 +02:00
parent 6cd264d467
commit 7d66bc7b72
3 changed files with 33 additions and 3 deletions

View File

@ -1,9 +1,11 @@
Show upcoming events of an .ics file.
Set the path to your .ics file in `src/main.c`:
At the moment the standard path to the ics file used by the email client `evolution` is used.\
You can set the path to your .ics file in `src/main.c`:
```
const char ICS_PATH[] = "tests/calendar.ics";
```
(uncomment some lines after that)
```
@ -20,4 +22,14 @@ make
sudo make install
```
#### TODO: improve Makefile
#### uninstall
```
sudo make uninstall
```
#### TODO
- option -f to choose ics file
- improve makefile
- tests

View File

@ -14,3 +14,11 @@ run:
.PHONY: install
install: a.out
cp a.out /usr/local/bin/ics_analyzer
.PHONY: clean
clean:
rm a.out
.PHONY: uninstall
uninstall:
rm /usr/local/bin/ics_analyzer

View File

@ -7,12 +7,22 @@
#include "seek_string_a.h"
#include "remove_whitespace.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <limits.h>
int main() {
const char ICS_PATH[] = "tests/calendar.ics";
//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;
}
char my_line[4096] = "";