home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume8 / gnuplot1.10A / part07 / help / main.c < prev    next >
C/C++ Source or Header  |  1989-09-09  |  1KB  |  71 lines

  1. /*
  2.  * Program    : help
  3.  * Module    : main.c
  4.  * Programmer    : R. Stolfa
  5.  *
  6.  * Purpose :    To support a VMS-like help facility
  7.  *
  8.  * Modification History:
  9.  *   08/26/87    Created
  10.  *   07/13/88    Fixed end-of-program detection to work correctly
  11.  */
  12.  
  13. #define        MAIN
  14. #include    "global.h"
  15.  
  16. main (argc, argv)
  17. int    argc;
  18. char    *argv[];
  19. {
  20.     int    done;
  21.     char *helpdir, *getenv();
  22.  
  23.         --argc; ++argv;
  24.  
  25.         if ((helpdir = getenv ("HELPDIR")) == NULL)
  26.            strcpy(Root_Dir, ROOTDIR);
  27.         else
  28.            strcpy (Root_Dir, helpdir);
  29.  
  30.         if (argc >= 2 && strcmp(*argv,"-r") == 0) {    /* Absolute directory */
  31.            strcpy(Root_Dir, *++argv);
  32.            ++argv;
  33.            argc += 2;
  34.         }
  35.                 
  36.         while (argc--) {        /* Construct relative root directory */
  37.            strcat(Root_Dir,"/");
  38.            strcat(Root_Dir, *argv);
  39.            ++argv;
  40.         }
  41.  
  42.     initialize();
  43.     done = FALSE;
  44.  
  45.     while (done != TRUE) {
  46.         /*
  47.          * Free memory to keep user memory from growing
  48.          */
  49.         free_list (PRINT);
  50.         free_list (ACRON);
  51.         free_list (TOPIC);
  52.  
  53.         /*
  54.          * If we are recursing out of the help tree,
  55.          * do not print the help stuff...
  56.          */
  57.         lines = 0;
  58.         if (done != UP)
  59.             help();
  60.         scan_topics ();
  61.         if (done != UP)
  62.             format_help ();
  63.         done = input_choice ();
  64.  
  65.         if ((done == UP) && (strcmp (Path, Root_Dir) == 0))
  66.             done = TRUE;
  67.     }
  68.     printf ("\n");
  69. exit(0);
  70. }
  71.