aboutsummaryrefslogtreecommitdiff
path: root/calendar.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-08 21:13:08 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-08 21:23:31 +0100
commit8e2d4025fc02e07866869a33ccc686f87389cb36 (patch)
tree2af14e4713d88024597add14106d565055317cb4 /calendar.c
parentMade root of graphviz output gray. (diff)
downloadcalp-8e2d4025fc02e07866869a33ccc686f87389cb36.tar.gz
calp-8e2d4025fc02e07866869a33ccc686f87389cb36.tar.xz
V{calendar,event} merged into vcomponent, making it symmetic.
Diffstat (limited to 'calendar.c')
-rw-r--r--calendar.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/calendar.c b/calendar.c
index 8fc4199b..477de492 100644
--- a/calendar.c
+++ b/calendar.c
@@ -17,6 +17,9 @@
/*
* Returns 0 if file has no extersion
+ *
+ * TODO this looks from the first point, it should look from the last
+ * point.
*/
int get_extension(const char* filename, char* ext, ssize_t max_len) {
int ext_idx = -1;
@@ -41,7 +44,7 @@ int get_extension(const char* filename, char* ext, ssize_t max_len) {
* TODO merge the code for files and dirs.
*/
-int parse_dir(vcalendar* cal, char* path) {
+int parse_dir(vcomponent* cal, char* path) {
DIR* dir = opendir(path);
struct dirent* d;
while ((d = readdir(dir)) != NULL) {
@@ -81,7 +84,7 @@ int parse_dir(vcalendar* cal, char* path) {
return 0;
}
-int read_vcalendar(vcalendar* cal, char* path) {
+int read_vcalendar(vcomponent* cal, char* path) {
struct stat statbuf;
if (stat (path, &statbuf) != 0) {
@@ -101,7 +104,7 @@ int read_vcalendar(vcalendar* cal, char* path) {
char ext[10];
int has_ext = get_extension(path, ext, 9);
if (! has_ext || strcmp(ext, "ics") != 0) {
- fprintf(stderr, "File doesn't have .ics extension.\n");
+ fprintf(stderr, "File doesn't have .ics extension. [%s]\n", ext);
exit(1);
}