sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit 95e8694bc8a23e1e027783b3e2e0db56f8a634f1
parent 3d6d241ad7c59d1a99810bd3193faa6dadd2ecf8
Author: Quentin Rameau <quinq@fifth.space>
Date:   Fri, 23 Jun 2017 20:39:30 +0200

Print a nicer index

Diffstat:
sacc.c | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/sacc.c b/sacc.c @@ -181,11 +181,15 @@ display(Item *item) ndigits = (nitems < 10) ? 1 : (nitems < 100) ? 2 : 3; for (i = item->printoff; i < nitems && i < lines; ++i) { - item = items[i]; - printf("%*d %-4s%c %s\n", ndigits, i+1, - item->type != 'i' ? typedisplay(item->type) : "", - item->type > '1' ? '|' : '+', - items[i]->username); + if (item = items[i]) { + printf("%*d %-4s%c %s\n", ndigits, i+1, + item->type != 'i' ? + typedisplay(item->type) : "", + item->type > '1' ? '|' : '+', + items[i]->username); + } else { + printf("%*d !! |\n", ndigits, i+1); + } } break; }