summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosias <me@josias.dev>2021-06-27 20:33:58 -0700
committerJosias <me@josias.dev>2021-06-27 20:33:58 -0700
commit782cb6cd857205dcbb32d84b66bcb22cb7051dfd (patch)
tree4cf7ee04bf45ddb4648f37e7bfa1c27d5d2f61f8
parent43024fd3167770b063a5eca23521c3391b0110cd (diff)
search: ignore lines in post.txt that contain "#"
-rw-r--r--search.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/search.c b/search.c
index 8f1e0e2..193b323 100644
--- a/search.c
+++ b/search.c
@@ -27,7 +27,8 @@ struct result *search(struct notebook notebook, const char query[100], size_t *r
return NULL;
while (fgets(path, 512, cache_file)) {
path[strlen(path) - 1] = '\0'; // remove \n
- if (strcmp(path, "") == 0)
+ // skip blank lines and those starting with "#"
+ if (strcmp(path, "") == 0 || strncmp(path, "#", 1) == 0)
continue;
char filepath[512];