tAdd a help function - sacc - sacc (saccomys): simple gopher client.
Log
Files
Refs
LICENSE
---
commit c3d1dcbde30176170fc9597ca04591d1d2d5d452
parent 71302cd77ae2eb37e2b1281b9e8d6215e5d70e15
Author: Quentin Rameau 
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
t@@ -80,6 +80,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)
 {
t@@ -319,7 +329,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');
t@@ -329,6 +339,10 @@ delve(Item *hole)
                                 return;
 
                         itm = -1;
+                        if (!strcmp(buf, "h\n")) {
+                                help();
+                                continue;
+                        }
                         if (*buf < '0' || *buf > '9')
                                 continue;