man3rmt/reqpar_processor2

Table of Contents

Name

reqpar_processor2 - process parameter file and request parameter values from database

Description

reqpar_processor2 reads from a file descriptor to obtain strins containing label/refname pairs. Each time the function is called one string file is read and parsed and a parameter value request is formulated and sent to dbman.

The application using this function may define a list of keywords. When reqpar_processor2 sees one of the keywords it calls a callback function to process it.

The file should be opened before calling this function and closed when finished.

This function is part of librmt.

Syntax

int reqpar_processor2(
FILE *in,

int DBsock,

int *Line,

char *tlist[],

int tlist_cnt,

int (*tlist_callback)(

char *token[],

int tcnt,

int Line,

char *terminator

),

char *terminator,

int verbosity

);

Arguments

in

The pathname of the file to read from.

DBsock

The file descriptor for the connection to dbman.

Line

a variable containing the current line number of the file being processed. This should be initialized to zero before calling this function the first time.

This is more or less useless since this function usually won’t be reading from a file.

tlist

A list of keyword strings. When a match is found in this list tlist_callback() is called to process the line.

tlist_cnt

The number of items in the tlist array.

tlist_callback

This function is called when a match is found in the tlist.
token

The input string is broken into tokens. This is the token array.
tcnt

The number of tokens in the token array.
Line

The line number. This is more or less useless since this function usually won’t be reading from a file.
terminator

The terminator parameter from the function call is passed here. The callback should be written to behave in the same way as the function.

terminator


A pointer to a string to use as a line terminator. If the pointer is NULL a LF is used as the terminator, otherwise the contents of the string is used as the terminator.

verbosity

Defines the amount of messages to print. This value is passed on to SendRec. A value of 0 produces no messages. See the SendRec manpage for full details on available values.

Return Values

-1 - error, end of input, bad db connection
0 - no record processed
   comment and empty lines return this

1 - record processed

Notes

This function was written for use with inet_reqpar(1) . One has to wonder if it’s too specialized to be in the library. 12-7-04rlk

See Also

librmt(3rmt)

Manual page revision

$Id: reqpar_processor2.3,v 1.2 2008/08/22 16:22:16 mcnamer Exp $


Table of Contents