sacc

sacc(omys), simple console gopher client (mirror)
git clone https://git.parazyd.org/sacc
Log | Files | Refs | LICENSE

commit 5605a35bd79b0d03c637f729c0fd32c813c74e00
parent 9cc56dc59541a6a7d71faab023000516b74bf994
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat,  8 Jul 2017 00:08:36 +0200

Move all type display info to typedisplay()

Diffstat:
Msacc.c | 36++++++++++++++++++------------------
Mui_ti.c | 4+---
Mui_txt.c | 8++------
3 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/sacc.c b/sacc.c @@ -95,41 +95,41 @@ typedisplay(char t) { switch (t) { case '0': - return "Text"; + return "Text+"; case '1': - return "Dir"; + return "Dir +"; case '2': - return "CSO"; + return "CSO |"; case '3': - return "Err"; + return "Err |"; case '4': - return "Macf"; + return "Macf|"; case '5': - return "DOSf"; + return "DOSf|"; case '6': - return "UUEf"; + return "UUEf|"; case '7': - return "Find"; + return "Find|"; case '8': - return "Tlnt"; + return "Tlnt|"; case '9': - return "Binf"; + return "Binf|"; case '+': - return "Mirr"; + return "Mirr|"; case 'T': - return "IBMt"; + return "IBMt|"; case 'g': - return "GIF"; + return "GIF |"; case 'I': - return "Img"; + return "Img |"; case 'h': - return "HTML"; + return "HTML|"; case 'i': - return "Info"; + return " |"; case 's': - return "Snd"; + return "Snd |"; default: - return "WRNG"; + return "! |"; } } diff --git a/ui_ti.c b/ui_ti.c @@ -47,9 +47,7 @@ uicleanup(void) static void printitem(Item *item) { - printf("%-4s%c %s\r", - item->type != 'i' ? typedisplay(item->type) : "", - item->type > '1' ? '|' : '+', item->username); + printf("%s %s\r", typedisplay(item->type), item->username); } static void diff --git a/ui_txt.c b/ui_txt.c @@ -80,12 +80,8 @@ display(Item *entry) nd = ndigits(nitems); for (i = entry->printoff; i < nitems && i < lines; ++i) { - item = items[i]; - printf("%*zu %-4s%c %s\n", nd, i+1, - item->type != 'i' ? - typedisplay(item->type) : "", - item->type > '1' ? '|' : '+', - item->username); + printf("%*zu %s %s\n", + nd, i+1, typedisplay(items[i]->type), items[i]->username); } fflush(stdout);