get home env var and evolution path for ics file
This commit is contained in:
parent
6cd264d467
commit
7d66bc7b72
16
README.md
16
README.md
@ -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
|
||||
|
8
makefile
8
makefile
@ -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
|
||||
|
12
src/main.c
12
src/main.c
@ -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] = "";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user