Add a help function - sacc - sacc (saccomys): simple gopher client. (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit 3e5d7a06080f752926f31e1b44bceae6fabb8fb5 (DIR) parent 5035e8a5d53fe0003422fdf550fc4b94addf95bc (HTM) 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(-) --- (DIR) 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 * ttypedisplay(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;