mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
index_list() and index_list_desc() don't return deleted entries.
This commit is contained in:
parent
9bf872d603
commit
9c7cc7b710
1 changed files with 10 additions and 6 deletions
4
data.c
4
data.c
|
@ -496,10 +496,12 @@ xs_list *index_list(const char *fn, int max)
|
|||
list = xs_list_new();
|
||||
|
||||
while (n < max && fgets(line, sizeof(line), f) != NULL) {
|
||||
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) {
|
||||
if (line[0] != '-') {
|
||||
line[32] = '\0';
|
||||
list = xs_list_append(list, line);
|
||||
n++;
|
||||
}
|
||||
|
||||
/* move backwards 2 entries */
|
||||
if (fseek(f, -66, SEEK_CUR) == -1)
|
||||
|
|
Loading…
Reference in a new issue