Main Page | Data Structures | File List | Data Fields | Globals

loadconfig.c File Reference

Load/Parse ISIS client's runtime configuration file. More...

#include "client.h"

Defines

#define MAXCFGLINE   80
 Maximum mumber of characters/line in the runtime config file.


Functions

int LoadConfig (char *cfgfile)
 Load/Parse ISIS client's runtime configuration file.


Detailed Description

Load/Parse ISIS client's runtime configuration file.

ISIS-style runtime configuration files (e.g., named myclient.ini, .myclientrc, whatever) contain simple Keyword-Value pairs that are parsed into global-scope variables for the client and its various subroutines to use.

The # is used as a comment character, making a comment line when it appears as the first character in a line by itself. Inline comments are not supported by this simple parser, but are generally ignored since it assumes (again for simplicity) that value arguments are numbers or strings without spaces. Fancier parsers can be implemented as needed. Blank lines are ignored by the parser. We adopt the convention that keywords and values are case insensitive, to remove any ambiguity.

This template provides a good example of common client initialiation file parameters and syntax. The idea is to make the runtime config files for all ISIS clients look pretty much the same in terms of having a common syntax as appearance. The utility function GetArg() used here is from isisutils.c, with the prototype defined in the isisclient.h header.

A typical runtime config file has the following structure:

# # myclient runtime configuration file # # Modified 2003 June 21 by R. Pogge, OSU Astronomy Dept. # for the fauxMODS spectrograph system echoclient. # ID echo Port 7890 LogFile /data/Logs/myclient Verbose # ServerID isis1 ServerHost mods1.lbto.org ServerPort 6789

Here we are telling myclient that it is a client of an ISIS server named "isis1" running on host mods1.lbto.org and listening to network socket port 6789. We are to be an ISIS client node named "echo" listing to network socket port 7890 on the localhost. All runtime logging will be recorded to a file named /data/Logs/myclient.log, and both logging and screen output will be Verbose for debugging purposes.

As this example shows, the goal is that runtime configuration files are easily read and created by humans. A common syntax makes maintenance of many clients easier.

This version is custom for the barcode interactive agent.

Author:
R. Pogge, OSU Astronomy Dept. (pogge@astronomy.ohio-state.edu)
Date:
2003 September 14 (original version based on the ISIS server ParseIniFile())

2004 May 24 (modified for the barcode reader testbed app)


Define Documentation

#define MAXCFGLINE   80
 

Maximum mumber of characters/line in the runtime config file.


Function Documentation

int LoadConfig char *  cfgfile  ) 
 

Load/Parse ISIS client's runtime configuration file.

Parameters:
cfgfile Path/name of the client runtime configuration file
Returns:
0 if success, <0 if failure. All error message are printed to the client's console.
The precise actions of LoadConfig() are tailored to the client application.


Generated on Thu Jul 22 20:10:48 2004 for Barcode Reader Agent by doxygen 1.3.7