agendafs

A filesystem for your calendar.

git clone git://mccd.space/agendafs
commit 9723ca9f6310bf9353ec7985328e8a84b9100462
parent 40b6d31c3829c492a7cea96c89dc70b84ef9535b
Author: Marc Coquand <marc@coquand.email>
Date:   Sun,  1 Jun 2025 21:11:36 +0100

comments and stuff

Diffstat:
MREADME.md | 2+-
Mmain.c | 16++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
@@ -69,7 +69,7 @@ POC stage, still very early alpha.
 
 Planned features:
 - [ ] VJOURNAL - Now the first true journaling filesystem!
-	- [ ] Create
+	- [x] Create
 	- [ ] Delete
 	- [x] Read
 	- [x] Rename
diff --git a/main.c b/main.c
@@ -266,7 +266,7 @@ get_entry_from_fuse_path(const char *path)
 		return NULL;
 	}
 
-	const char *key = path + 1; // Strip leading '/'
+	const char *key = path + 1;
 	if (strlen(key) == 0) {
 		LOG("empty key for path '%s'\n", path);
 		return NULL;
@@ -296,7 +296,7 @@ parse_ics_file(const char *file_path, journal_entry *entry)
 	char *file_content = calloc(file_size + 1, sizeof(char));
 
 	fread(file_content, 1, file_size, file);
-	file_content[file_size] = '\0'; // Null-terminate the string
+	file_content[file_size] = '\0';
 	fclose(file);
 
 	regmatch_t matches_dtstamp[2], matches_lastmod[2];
@@ -523,7 +523,7 @@ write_entry_content(char *buf, journal_entry *entry)
 	    asprintf(&buf, "%s\n---\n%s", entry->summary, entry->description);
 	if (size == -1) {
 		LOG("Out of memory");
-		exit(1); // Handle out of memory by terminating the program
+		exit(1);
 	}
 	return size;
 }
@@ -637,7 +637,7 @@ journal_read(const char *path, char *buf, size_t size, off_t offset,
 				     entry->summary, entry->description);
 	if (needed_len == -1) {
 		LOG("Out of memory");
-		exit(1); // Handle out of memory by terminating the program
+		exit(1);
 	}
 
 	if (offset >= needed_len) {
@@ -697,7 +697,7 @@ journal_entry_to_ical(const journal_entry *entry)
 	return ical;
 }
 
-int
+size_t
 parse_entry_content(journal_entry *entry, const char *buf, size_t size)
 {
 	char *copy = strndup(buf, size);
@@ -738,7 +738,7 @@ parse_entry_content(journal_entry *entry, const char *buf, size_t size)
 	return 0;
 }
 
-int
+size_t
 write_entry_to_ical_file(const journal_entry *entry, const char *filepath)
 {
 	char *ical_str = journal_entry_to_ical(entry);
@@ -915,7 +915,7 @@ journal_rename(const char *old, const char *new, unsigned int flags)
 	return res;
 }
 
-//  uuid-app.ics
+//  uuid-caldavfs
 char *
 create_new_unique_ics_uid()
 {
@@ -1117,5 +1117,5 @@ main(int argc, char *argv[])
 	regfree(&regex_lastmod);
 	regfree(&regex_fuse_file);
 	LOG("Regexp freed");
-	return ret;
+	exit(ret);
 }