Print a nicer index - sacc - sacc(omys), simple console gopher client (HTM) git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/ (DIR) Log (DIR) Files (DIR) Refs (DIR) Tags (DIR) LICENSE --- (DIR) commit 7c51190b04aa8df983283f7b50edb70faa893d7a (DIR) parent 4691af5361b43138f257b19b23c89199cff210dc (HTM) Author: Quentin Rameau <quinq@fifth.space> Date: Fri, 23 Jun 2017 20:39:30 +0200 Print a nicer index Diffstat: M sacc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- (DIR) diff --git a/sacc.c b/sacc.c @@ -178,11 +178,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; }