home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / SRC / less.v177.lzh / less / help.c < prev    next >
Text File  |  1991-07-16  |  1KB  |  55 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. extern int output_mode;
  18. #endif
  19.  
  20. extern char *progname;
  21.  
  22.     public void
  23. help()
  24. {
  25.     char *helpfile;
  26.     char *cmd;
  27.  
  28.     helpfile = find_helpfile();
  29.     if (helpfile == NULL)
  30.     {
  31.         error("Cannot find help file", NULL_PARG);
  32.         return;
  33.     }
  34. #if __MSDOS__
  35.     putenv("LESS=-+v -+E -+s -mHPmHELP -- ?eEND -- Press g to see "
  36.         "it again:Press RETURN for more., or q when done ");
  37.     cmd = (char *) ecalloc(strlen(helpfile) + strlen(progname) + 50,
  38.                 sizeof(char));
  39.     if (output_mode == 0)
  40.         sprintf(cmd, "-%s %s", progname, helpfile);
  41.     else
  42.         sprintf(cmd, "-%s -qVW4,4,76,23,Help %s", progname, helpfile);
  43. #else
  44.     cmd = (char *) ecalloc(strlen(helpfile) + strlen(progname) + 150,
  45.                 sizeof(char));
  46.     sprintf(cmd, 
  47.      "-%s -m -H -+E -+s '-PmHELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done ' %s",
  48.         progname, helpfile);
  49. #endif
  50.     free(helpfile);
  51.     lsystem(cmd);
  52.     error("End of help", NULL_PARG);
  53.     free(cmd);
  54. }
  55.