summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-07-04 16:33:54 +0200
committerdefault <nobody@localhost>2023-07-04 16:33:54 +0200
commit9c7cc7b710f48d8ca1105200c0a7ef935d251d25 (patch)
tree28c2413fe898c687289070edc6dafe1e7d4c7b25 /data.c
parent9bf872d6030f1d4fb4bad42e4931111eac769806 (diff)
index_list() and index_list_desc() don't return deleted entries.
Diffstat (limited to 'data.c')
-rw-r--r--data.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/data.c b/data.c
index b3fd8b3..c466598 100644
--- a/data.c
+++ b/data.c
@@ -496,9 +496,11 @@ xs_list *index_list(const char *fn, int max)
list = xs_list_new();
while (n < max && fgets(line, sizeof(line), f) != NULL) {
- line[32] = '\0';
- list = xs_list_append(list, line);
- n++;
+ if (line[0] != '-') {
+ line[32] = '\0';
+ list = xs_list_append(list, line);
+ n++;
+ }
}
fclose(f);
@@ -524,9 +526,11 @@ xs_list *index_list_desc(const char *fn, int skip, int show)
/* move to the end minus one entry (or more, if skipping entries) */
if (!fseek(f, 0, SEEK_END) && !fseek(f, (skip + 1) * -33, SEEK_CUR)) {
while (n < show && fgets(line, sizeof(line), f) != NULL) {
- line[32] = '\0';
- list = xs_list_append(list, line);
- n++;
+ if (line[0] != '-') {
+ line[32] = '\0';
+ list = xs_list_append(list, line);
+ n++;
+ }
/* move backwards 2 entries */
if (fseek(f, -66, SEEK_CUR) == -1)