summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
496 list = xs_list_new(); 496 list = xs_list_new();
497 497
498 while (n < max && fgets(line, sizeof(line), f) != NULL) { 498 while (n < max && fgets(line, sizeof(line), f) != NULL) {
499 line[32] = '\0'; 499 if (line[0] != '-') {
500 list = xs_list_append(list, line); 500 line[32] = '\0';
501 n++; 501 list = xs_list_append(list, line);
502 n++;
503 }
502 } 504 }
503 505
504 fclose(f); 506 fclose(f);
@@ -524,9 +526,11 @@ xs_list *index_list_desc(const char *fn, int skip, int show)
524 /* move to the end minus one entry (or more, if skipping entries) */ 526 /* move to the end minus one entry (or more, if skipping entries) */
525 if (!fseek(f, 0, SEEK_END) && !fseek(f, (skip + 1) * -33, SEEK_CUR)) { 527 if (!fseek(f, 0, SEEK_END) && !fseek(f, (skip + 1) * -33, SEEK_CUR)) {
526 while (n < show && fgets(line, sizeof(line), f) != NULL) { 528 while (n < show && fgets(line, sizeof(line), f) != NULL) {
527 line[32] = '\0'; 529 if (line[0] != '-') {
528 list = xs_list_append(list, line); 530 line[32] = '\0';
529 n++; 531 list = xs_list_append(list, line);
532 n++;
533 }
530 534
531 /* move backwards 2 entries */ 535 /* move backwards 2 entries */
532 if (fseek(f, -66, SEEK_CUR) == -1) 536 if (fseek(f, -66, SEEK_CUR) == -1)