sacc

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

commit 3e5d7a06080f752926f31e1b44bceae6fabb8fb5
parent 5035e8a5d53fe0003422fdf550fc4b94addf95bc
Author: Quentin Rameau <quinq@fifth.space>
Date:   Wed, 21 Jun 2017 21:13:54 +0200

Add a help function

Diffstat:
sacc.c | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/sacc.c b/sacc.c @@ -83,6 +83,16 @@ usage(void) die("usage: sacc URL"); } +void +help(void) +{ + puts("Commands:\n" + "N = [1-9]...: browse item N.\n" + "0: browse previous item.\n" + "^D, q: quit.\n" + "h: this help."); +} + const char * typedisplay(char t) { @@ -324,7 +334,7 @@ delve(Item *hole) } do { - printf("%d items, visit (0: back, ^D or q: quit): ", n); + printf("%d items (h for help): ", n); if (!fgets(buf, sizeof(buf), stdin)) { putchar('\n'); @@ -334,6 +344,10 @@ delve(Item *hole) return; itm = -1; + if (!strcmp(buf, "h\n")) { + help(); + continue; + } if (*buf < '0' || *buf > '9') continue;