]> andersk Git - moira.git/blobdiff - clients/mmoira/help.c
*** empty log message ***
[moira.git] / clients / mmoira / help.c
index fce5a182f016638e3ec67856bad4103aa1d9a4fa..0648820c3808a74f4bfc80f003c022ab72156680 100644 (file)
@@ -9,6 +9,7 @@
 #include       <mit-copyright.h>
 #include       <stdio.h>
 #include       <Xm/Xm.h>
+#include       <moira.h>
 #include       "mmoira.h"
 
 
@@ -16,10 +17,14 @@ help(node)
 char *node;
 {
     FILE *helpfile = NULL;
-    char buf[1024], key[32];
+    char buf[1024], key[32], *msg, helpbuf[10240], *filename;
+    char *realloc(), *getenv();
 
     sprintf(key, "*%s\n", node);
-    helpfile = fopen(HELPFILE, "r");
+    filename = getenv("MOIRAHELPFILE");
+    if (filename == NULL)
+      filename = HELPFILE;
+    helpfile = fopen(filename, "r");
     if (helpfile == NULL) {
        display_error("Sorry, help is currently unavailable.\n");
        return;
@@ -33,12 +38,24 @@ char *node;
        fclose(helpfile);
        return;
     }
+    msg = NULL;
     while (fgets(buf, sizeof(buf), helpfile))
       if (buf[0] == '*')
        break;
-      else
-       fprintf(stderr, buf);
+      else {
+         if (msg) {
+             if (!strcmp(buf, "\n"))
+               strcpy(buf, " \n");
+             msg = realloc(msg, strlen(msg) + strlen(buf));
+             strcat(msg, buf);
+         } else
+           msg = strsave(buf);
+      }
     fclose(helpfile);
+    if (msg) {
+       PopupHelpWindow(msg);
+       free(msg);
+    }
     return;
 }
 
This page took 0.038792 seconds and 4 git commands to generate.