home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / monitors / rsys / source.lha / src / RSysHelp.c < prev    next >
C/C++ Source or Header  |  1995-01-09  |  2KB  |  91 lines

  1. /*
  2. ***************************************************************************
  3. *
  4. * Datei:
  5. *    RSysHelp.c
  6. *
  7. * Inhalt:
  8. *    void Help(void);
  9. *
  10. * Bemerkungen:
  11. *    Prozeduren zur Verwaltung der Hilfefunktion von RSys.
  12. *
  13. * Erstellungsdatum:
  14. *    07-Jul-93    Rolf Böhme
  15. *
  16. * Änderungen:
  17. *    07-Jul-93    Rolf Böhme    Erstellung
  18. *
  19. ***************************************************************************
  20. */
  21.  
  22. #include "RSysDebug.h"
  23. #include "RSysFunc.h"
  24.  
  25.    /*
  26.     * Help() liest eine Datei aus, deren Name in der ENV-Variablen
  27.     * SYSHELP enthalten ist. Diese Datei wird dann im
  28.     * Hauptfenster-Listview angezeigt
  29.     */
  30. void
  31. Help(void)
  32. {
  33.    BPTR  helpfile;
  34.    UBYTE line[HELPLINESIZE + 1];
  35.    int   i = 0,
  36.          len;
  37.    UBYTE helpfilename[MAXFULLNAME+1],
  38.         *buf;
  39.    int   SaveID = LastID;
  40.  
  41.    DPOS;
  42.  
  43.    if (GetVar((UBYTE *) "RSYSHELP", helpfilename, MAXFULLNAME, GVF_GLOBAL_ONLY) > 0)
  44.       if (helpfile = Open(helpfilename, MODE_OLDFILE))
  45.       {
  46.          PrintHeader(HELP, NULL);
  47.  
  48.          EmptyListView();
  49.  
  50.          LastID = SaveID;
  51.  
  52.          FGets(helpfile, line, HELPLINESIZE);
  53.          countentries = atoi((char *)line);
  54.  
  55.          if (!NoEntries())
  56.          {
  57.             Entries = AllocScrollEntries(countentries);
  58.  
  59.             FGets(helpfile, line, HELPLINESIZE);
  60.  
  61.             do
  62.             {
  63.                len = strlen((char *)line) - 1;
  64.                line[len] = STRINGEND;
  65.  
  66.                if (len > 0)
  67.                   strncpy(Entries[i].se_Entry, (char *)line, len);
  68.                else
  69.                   strcpy(Entries[i].se_Entry, field[BLANK_FIELD]);
  70.  
  71.                i++;
  72.  
  73.                buf = FGets(helpfile, line, HELPLINESIZE);
  74.             }
  75.             while (buf && (i < countentries));
  76.  
  77.             CreateEntryList(NO_SORT);
  78.  
  79.             PrintStatistics();
  80.          }
  81.  
  82.          Close(helpfile);
  83.       }
  84.       else
  85.          ErrorHandle(FILE_ERR, FIND_FAIL, NO_KILL);
  86.    else
  87.       ErrorHandle(ENV_ERR, FIND_FAIL, NO_KILL);
  88.  
  89.    return;
  90. }
  91.