Fix status current url in text UI - sacc - sacc(omys), simple console gopher cl… | |
git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65… | |
Log | |
Files | |
Refs | |
Tags | |
LICENSE | |
--- | |
commit 723df46be763ef55707fd3c63c8f70b0920ff17b | |
parent df00adaaab6055bb54114462d6b219dbefc34e9f | |
Author: Quentin Rameau <[email protected]> | |
Date: Sun, 1 Oct 2017 12:41:55 +0200 | |
Fix status current url in text UI | |
Diffstat: | |
M ui_txt.c | 8 +++++--- | |
1 file changed, 5 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/ui_txt.c b/ui_txt.c | |
@@ -76,13 +76,15 @@ static void | |
printstatus(Item *item, char c) | |
{ | |
Dir *dir = item->dat; | |
+ char *fmt; | |
size_t nitems = dir ? dir->nitems : 0; | |
unsigned long long printoff = dir ? dir->printoff : 0; | |
- printf("%3lld%%%*c %s:%s%s [%c]: ", | |
- (printoff + lines >= nitems) ? 100 : | |
+ fmt = (strcmp(item->port, "70") && strcmp(item->port, "gopher")) ? | |
+ "%3lld%%%*c %s:%7$s/%c%s [%c]" : "%3lld%%%*c %s/%c%s [%c]"; | |
+ printf(fmt, (printoff + lines-1 >= nitems) ? 100 : | |
(printoff + lines) * 100 / nitems, ndigits(nitems)+2, '|', | |
- item->host, item->port, item->selector, c); | |
+ item->host, item->type, item->selector, c, item->port); | |
} | |
char * |