fdhwlib  2.0.25
SimpleShell User Guide

Contents:

Introduction

The library libakshell.lib contains the package SimpleShell that provides a extendable command line shell.

This document contains information about the Usage and the Directory Structure. A detailed description of the commands can be found in the Reference Manual.

Usage

The available commands are collected in groups according called instruction sets. The basic input/output handling is done by the shell itself (Input / Output Redirection). The first instruction set of every shell application should be the class StdCmds. It provides basic functions independand from any application (std).

Programming

The class shell provides the mangement of the input and output streams. The specific commands can be added to the shell via several instructions set derived from the class cmds. Each of these classes needs to redefine the function cmds::interprete for the desired purpose. The standard commands StdCmds can serve as an example for a new instruction set.

List of classes for SimpleShell

Example:

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <akshell/shell.h>
#include <akshell/StdCmds.h>

main() {
  cmds *instrSet[1];
  shell *sh;

  // Define the instruction set of the shell
  instrSet[0] = new StdCmds();
  sh = new shell(instrSet,1);
  printf("MyShell Version %s, using SimpleShell %s",
            VERSION,sh->version());

  // Start the shell
  if (argc >= 2) sh->run(argv[1]);
  else sh->run();

  delete sh;
  exit(0);
}

Directory Structure

The main directory feshell contains project files for Kdevelop / Linux and MS Visual C++/ MS Windows. Both projects use the same source files placed in simpleshell/simpleshell.

The documentation is included in the source files (mainly the header files) using the JavaDoc style. To generate the documentation execute the script makeAPIdoc (only Linux). The results produced by doyxgen can be found in simpleshell/simpleshell/doxygen while the Kdoc output is located simpleshell/simpleshell/api.

The description for each class is devided in two parts: The first part decribes the usages of the commands. The second part contains more detailed information about the implemented commands. While the later are automatically included in the reference manual, you have to provide a link to the user guide pages manually. A good place for the main page of the user guide will normally be the file where the main()-function is defined. In ervery header of your instruction set to block comment with JavaDoc style documentation is required. The first block has to start with

@page label title
  Text describing the usage of the functions in
  this instruction set...

Where label has to be a non-ambiguous expression. The rest of the line is interpretated as the title of the page. Make a reference to this page in the main page by using the label of the page like this

@ref label

Input / Output Redirection

Synatax for input/output redirection:

  • To send the output of one command to a file the ">" sign is used.
  • To get input from a file use the "<" sign. This can be useful to invoke script files or to input data from a file.

Examples:

  • help > help.txt -- Sends the help pages to the file "help.txt".
  • < init.bat -- Execute the commands in the file "init.bat"
  • wrpat < testpat.dat -- Executes the command "wrpat" The data is found in the file "testpat.dat".