home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / GNU / LES177AS.ZIP / HELP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-12  |  1.5 KB  |  64 lines

  1. /*
  2.  * Display some help.
  3.  * Just invoke another "less" to display the help file.
  4.  *
  5.  * {{ This makes this function very simple, and makes changing the
  6.  *    help file very easy, but it may present difficulties on
  7.  *    (non-Unix) systems which do not supply the "system()" function. }}
  8.  */
  9.  
  10. #include  "less.h"
  11.  
  12. #if __MSDOS__
  13. #include <io.h>
  14. #include <dir.h>
  15. #include <string.h>
  16. #include <stdlib.h>
  17. #ifndef TURBOC
  18. extern int output_mode;
  19. #endif
  20. #endif
  21.  
  22. extern char *progname;
  23.  
  24.     public void
  25. help()
  26. {
  27.     char *helpfile;
  28.     char *cmd;
  29.  
  30.     helpfile = find_helpfile();
  31.     if (helpfile == NULL)
  32.     {
  33.         error("Cannot find help file", NULL_PARG);
  34.         return;
  35.     }
  36. #if __MSDOS__
  37.     putenv("LESS=-+v -+E -+s -mHPmHELP -- ?eEND -- Press g to see "
  38.         "it again:Press RETURN for more., or q when done ");
  39.     cmd = (char *) ecalloc(strlen(helpfile) + strlen(progname) + 50,
  40.                 sizeof(char));
  41. #ifdef TURBOC
  42.     if (directvideo)
  43.         sprintf(cmd, "-%s %s", progname, helpfile);
  44.     else
  45.         sprintf(cmd, "-%s -v %s", progname, helpfile);
  46. #else
  47.     if (output_mode == 0)
  48.         sprintf(cmd, "-%s %s", progname, helpfile);
  49.     else
  50.         sprintf(cmd, "-%s -qVW4,4,76,23,Help %s", progname, helpfile);
  51. #endif    /* TURBOC */
  52. #else
  53.     cmd = (char *) ecalloc(strlen(helpfile) + strlen(progname) + 150,
  54.                 sizeof(char));
  55.     sprintf(cmd, 
  56.      "-%s -m -H -+E -+s '-PmHELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done ' %s",
  57.         progname, helpfile);
  58.     free(helpfile);
  59. #endif
  60.     lsystem(cmd);
  61.     error("End of help", NULL_PARG);
  62.     free(cmd);
  63. }
  64.