proper paging
This commit is contained in:
parent
745a306b04
commit
9dc0c0684e
1 changed files with 10 additions and 4 deletions
|
@ -52,10 +52,6 @@ int sort_comp(const void *a, const void *b) {
|
||||||
|
|
||||||
int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
||||||
struct pager *i = usr;
|
struct pager *i = usr;
|
||||||
i->i++;
|
|
||||||
if (i->i < i->page * 10 || i->i >= (i->page + 1) * 10) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
return 0;
|
return 0;
|
||||||
char *key2 = (char *)key;
|
char *key2 = (char *)key;
|
||||||
|
@ -75,6 +71,11 @@ int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i->i++;
|
||||||
|
if (i->i < i->page * 10 || i->i >= (i->page + 1) * 10) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (val2[strlen(val2) - 1] == '\n') {
|
if (val2[strlen(val2) - 1] == '\n') {
|
||||||
printf("- %s suggested %s", key3, val2);
|
printf("- %s suggested %s", key3, val2);
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,6 +86,11 @@ int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i->i++;
|
||||||
|
if (i->i < i->page * 10 || i->i >= (i->page + 1) * 10) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen(key2) > 0 && key2[strlen(key2) - 1] == '\n') {
|
if (strlen(key2) > 0 && key2[strlen(key2) - 1] == '\n') {
|
||||||
printf("- %s", key2);
|
printf("- %s", key2);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue