[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
xhelp - command line interface to help viewer.
The help viewer has a simple command line interface which
may be invoked by the user or by other programs. The interface
should provide the following functionality:
1. Open a specific help file.
2. Open to an initial help screen.
3. Open a specific topic.
Currently only the first command line funtion exists, although the
second is simple and should be completed shortly (once an initial
page is made).
The methods of execution are:
xhelp [-f file | topic]
where xhelp alone will bring up the base help page.
The existing code for this section is very rudimentary so far,
and is attached.
There are known weaknesses in the complete implementation, which will
be expounded on at a later date.
Ken Duck
twoducks@globalserve.net
/*
* xhelp.c
*
* This program provides the command line access to the help system.
*
* As the abilities of the help system are increased, so shall the
* functionality of this program. The arguments which are currently
* provided are:
*
* -f filename
*/
#include <stdio.h>
#include <dlfcn.h>
#include <string.h>
#define HELPLIB "helplib.so.1"
main(int argc, char *argv[])
{
void *plugin;
void (*loadFile)(char *);
if(argc < 2)
{
fprintf(stderr, "Usage: xhelp ?topic? ?-f filename?\n");
exit(-1);
}
if(argc == 2)
{
fprintf(stderr, "Error: Open topic not implemented\n");
exit(-1);
}
if(strcmp(argv[1], "-f") != 0)
{
fprintf(stderr, "Error: %s unknown switch\n", argv[1]);
exit(-1);
}
if(plugin=dlopen(HELPLIB, RTLD_LAZY))
{
loadFile=dlsym(plugin, "loadFile");
if(loadFile == NULL)
{
fprintf(stderr, "Library error: cannot find loadFile\n");
}
else
{
(*loadFile)(argv[2]);
}
}
else
{
fprintf(stderr, "Could not find %s\n", HELPLIB);
}
}