Moved the remaining help files for the text client out of the server and into the...
[citadel.git] / textclient / src / commands.c
index 4fe088316685f4eaeb22d26bda1542a82ab13253..1af9e8f68caa22643e40b18051f6564041f43f55 100644 (file)
@@ -2,7 +2,7 @@
  * This file contains functions which implement parts of the
  * text-mode user interface.
  *
- * Copyright (c) 1987-2012 by the citadel.org team
+ * Copyright (c) 1987-2017 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -51,7 +51,6 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <libcitadel.h>
-///#include "citadel.h"
 #include "citadel_ipc.h"
 #include "commands.h"
 #include "messages.h"
 #include "routines2.h"
 #include "rooms.h"
 #include "client_chat.h"
-////#include "citadel_dirs.h"
+#include "help.h"
 #include "tuiconfig.h"
-//#ifndef HAVE_SNPRINTF
-//#include "snprintf.h"
-///#endif
 #include "screen.h"
 #include "ecrash.h"
 
@@ -312,9 +308,11 @@ static void really_do_keepalive(void) {
        }
 }
 
-/* threaded nonblocking keepalive stuff starts here. I'm going for a simple
-   encapsulated interface; in theory there should be no need to touch these
-   globals outside of the async_ka_* functions. */
+/*
+ * threaded nonblocking keepalive stuff starts here. I'm going for a simple
+ * encapsulated interface; in theory there should be no need to touch these
+ * globals outside of the async_ka_* functions.
+ */
 
 #ifdef THREADED_CLIENT
 static pthread_t ka_thr_handle;
@@ -356,9 +354,9 @@ static void async_ka_exec(void)
 #endif /* THREADED_CLIENT */
 
 /* I changed this from static to not because I need to call it from
  screen.c, either that or make something in screen.c not static.
-   Fix it how you like. Why all the staticness? stu */
-   
* screen.c, either that or make something in screen.c not static.
+ * Fix it how you like. Why all the staticness? stu
+ */
 void do_keepalive(void)
 {
        time_t now;
@@ -381,11 +379,13 @@ void do_keepalive(void)
 
 
 /* Now the actual async-keepalve API that we expose to higher levels:
-   async_ka_start() and async_ka_end(). These do nothing when we don't have
-   threading enabled, so we avoid sprinkling ifdef's throughout the code. */
+ * async_ka_start() and async_ka_end(). These do nothing when we don't have
+ * threading enabled, so we avoid sprinkling ifdef's throughout the code.
+ */
 
 /* wait for a background keepalive to complete. this must be done before
-   attempting any further server requests! */
+ * attempting any further server requests!
+ */
 void async_ka_end(void)
 {
 #ifdef THREADED_CLIENT
@@ -979,7 +979,20 @@ int getcmd(CtdlIPC *ipc, char *argbuf)
                        enable_color = 0;
        }
        /* if we're running in idiot mode, display a cute little menu */
-       IFNEXPERT formout(ipc, "mainmenu");
+
+       IFNEXPERT {
+               scr_printf("-----------------------------------------------------------------------\n");
+               scr_printf("Room cmds:    <K>nown rooms, <G>oto next room, <.G>oto a specific room,\n");
+               scr_printf("              <S>kip this room, <A>bandon this room, <Z>ap this room,\n");
+               scr_printf("              <U>ngoto (move back)\n");
+               scr_printf("Message cmds: <N>ew msgs, <F>orward read, <R>everse read, <O>ld msgs,\n");
+               scr_printf("              <L>ast five msgs, <E>nter a message\n");
+               scr_printf("General cmds: <?> help, <T>erminate, <C>hat, <W>ho is online\n");
+               scr_printf("Misc:         <X> toggle eXpert mode, <D>irectory\n");
+               scr_printf("\n");
+               scr_printf(" (Type .Help SUMMARY for extended commands, <X> to hide this menu)\n");
+               scr_printf("-----------------------------------------------------------------------\n");
+       }
 
        print_instant();
        strcpy(argbuf, "");
@@ -1192,11 +1205,24 @@ void stty_ctdl(int cmd)
 
 
 /*
- * display_help()  -  help file viewer
+ * display_help()  -  help text viewer
  */
 void display_help(CtdlIPC *ipc, char *name)
 {
-       formout(ipc, name);
+       int i;
+       int num_helps = sizeof(helpnames) / sizeof(char *) ;
+
+       for (i=0; i<num_helps; ++i) {
+               if (!strcasecmp(name, helpnames[i])) {
+                       fmout(screenwidth, NULL, helptexts[i], NULL, 0);
+                       return;
+               }
+       }
+
+       scr_printf("'%s' not found.  Enter one of:\n", name);
+       for (i=0; i<num_helps; ++i) {
+               scr_printf("  %s\n", helpnames[i]);
+       }
 }