Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Macros | Functions
help.c File Reference

Provides a simple file-based command line help utility. More...

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "macros.h"
#include "WindIO.h"
#include "parse.h"
#include "help.h"
#include "general.h"

Go to the source code of this file.

Macros

#define BUFFLEN   240 /* Buffer for reading from file */
 
#define HELPENV
 

Functions

void blHelp (char *string, char *HelpFile)
 
void blDoHelp (char *string, char *HelpFile)
 

Detailed Description

Provides a simple file-based command line help utility.

Version
V1.4
Date
07.07.14
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.

The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.

The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.

Description:

A pair of routines for handling a help facility. All screen/keyboard I/O is via screen() and GetKybdString() routines.

Usage:

blDoHelp(string,helpfilename)

This is the normal entry point and should be supplied with the complete command including the word `help'. If this is the only word given, the routine will prompt with Help> and give help on each word typed until return is hit to exit help. If help followed by a keyword is given, help only on that topic will be supplied.

blHelp(string,helpfilename)

Generates help from helpfilename on the topic named by string. If this is `help' or `?', available topics will be listed.

blHelp(NULL,"CLOSE")

Used to close the help file

Under Unix, the environment variable, HELPDIR should be set to specify the directory in which help files are stored. Under operating systems such as VAX/VMS and AmigaDOS which support the assign command, the HELPDIR: assign should be set up for the help directory.

Revision History:

Definition in file help.c.

Macro Definition Documentation

#define BUFFLEN   240 /* Buffer for reading from file */

Definition at line 124 of file help.c.

#define HELPENV
Value:
"HELPDIR" /* The help directory (variable) for unix or
assign name for VMS/AmigaDOS */

Definition at line 125 of file help.c.

Function Documentation

void blDoHelp ( char *  string,
char *  HelpFile 
)
Parameters
[in]*stringString on which to give help, must include the word "help". If given on its own, sits in a loop prompting for help.
[in]*HelpFileThe help file to search

Handles help facility. This is the normal entry point and should be supplied with the complete command including the word `help'.

e.g. DoHelp("help","foo.hlp"); or DoHelp("help bar","foo.hlp");

If help is the only word given, the routine will prompt with Help> and give help on each word typed until return is hit to exit help. If help followed by a keyword is given, help only on that topic will be supplied.

  • 25.09.92 Original
  • 28.09.92 Changed to call Help("Help")
  • 02.10.92 Added GetKybdString() rather than gets()
  • 04.01.94 Changed to fix problem with compilers which don't let you write to strings defined in double inverted commas and never assigned to a variable
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 317 of file help.c.

void blHelp ( char *  string,
char *  HelpFile 
)
Parameters
[in]*stringTopic on which to provide help. If "help" or "?" then list all topics
[in]*HelpFileName of help file, or "CLOSE" to close the help file

Generates help from a help file on the topic named by string. If this is `help' or `?', available topics will be listed.

Only one help file may be open at a time. Once a file is open, no check is made on the HelpFile string to check that you still require the same help file. You must first close the file before changing to a new file.

Calling: Help(NULL,"CLOSE") will close the help file.

The directory specified by the environment variable or assign specified by the #define HELPENV (normally HELPDIR) will be searched for the help file if not found in the local directory.

  • 25.09.92 Original
  • 28.09.92 Added HELP
  • 29.09.92 Changed to file-based version
  • 07.10.92 Added paging support
  • 12.08.93 Correctly returns if help file not found
  • 05.01.94 Handles getenv() call for Unix
  • 11.03.94 Resets FirstCall to TRUE when file is closed
  • 18.01.95 Calls OpenFile() rather than handling alternative directory internally. Consequently assign or envvar is called HELPDIR.
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 172 of file help.c.