home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / flistfrontend / src / help.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-21  |  2.1 KB  |  76 lines

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: help.c,v 1.6 1995/10/21 18:55:13 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    help.c
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    20 Mar 1985
  9.  * Last update:
  10.  *        03 Jun 1995, prototyped
  11.  *
  12.  * Function:    This code is an interface between a C-program and the
  13.  *        help-library manager.  The librarian-routine acts almost
  14.  *        the same as VMS-HELP, save that it does no paging, and
  15.  *        that it does not respond to single-character input (until
  16.  *        a carriage-return is given).
  17.  *
  18.  *        We intend that this routine will be called to get specific
  19.  *        help on the caller-program.  If the user types a return,
  20.  *        then the librarian-routine will drop down by a level to
  21.  *        display the index of the library-file.  Thus, he may explore
  22.  *        the help-library before exiting.
  23.  *
  24.  * Arguments:    lib    => the HELP-library to use.  If null, we default to
  25.  *               the system-help library.
  26.  *        prg    => the name of the program to request help on.  This
  27.  *               is only the *initial* entry to the help-dialog.
  28.  *        maxcol    =  the number of columns-wide that the screen may use.
  29.  *               This value is used in the librarian-routine to
  30.  *               format the index listing (default: 0 => 80).
  31.  */
  32.  
  33. #include    <string.h>
  34.  
  35. #include    <lib$routines.h>
  36. #include    <descrip.h>
  37.  
  38. #include    "lbrdef.h"
  39.  
  40. #if UNUSED
  41. extern    unsigned lib$get_input(void/*FIXME*/);
  42. extern    unsigned lib$put_output(void/*FIXME*/);
  43. #endif
  44. extern    unsigned lbr$output_help(
  45.     unsigned (*output)(void),
  46.     unsigned *width,
  47.     struct dsc$descriptor_s *program,
  48.     struct dsc$descriptor_s *libname,
  49.     unsigned flags,
  50.     unsigned (*input)(void));
  51.  
  52. #define    DSC(f)    static    $DESCRIPTOR(f," ")
  53. #define    LBR(f)    status = f
  54. #define    describe(f,arg)    if (arg)\
  55.             {f.dsc$a_pointer = arg; f.dsc$w_length = strlen(arg);}
  56. #define    USE(d,s)    ((s != 0) ? &d : 0)
  57.  
  58. void
  59. help (char *lib, char *prg, int maxcol)
  60. {
  61.     unsigned status,
  62.         help_index,
  63.         func_read = LBR$C_READ,
  64.         type_help = LBR$C_TYP_HLP,
  65.         width = maxcol;    /* default: 80 columns */
  66.     DSC(DSC_libname);
  67.     DSC(DSC_program);
  68.  
  69.     if (!lib)    lib = "SYS$HELP:HELPLIB.HLB";
  70.     describe(DSC_libname,lib);
  71.     describe(DSC_program,prg);
  72.  
  73.     LBR(lbr$output_help (lib$put_output, &width, &DSC_program,
  74.         &DSC_libname, 0, lib$get_input));
  75. }
  76.