In file prompts.h:

int msg_token

(int msgnum, char* toklst, ...)

Extract a token from a configuration prompt.

Documentation

Extract a token from a configuration prompt.

Retrieves and parses the requested prompt, trying to match it against a user-supplied list of tokens. This function is used to extract multiple-choice configuration options from prompt.

The list of tokens is represented by one or more string arguments to the function. As this is perhaps the most complex of the parsing functions, here is an example that includes error recovery:

    int value=tokopt(COLOUR,"DARKBLUE","DARKGREEN","DARKCYAN","DARKRED",
		"DARKMAGENTA","BROWN","GREY","DARKGREY","BLUE","GREEN",
		"CYAN","RED","MAGENTA","YELLOW","WHITE");
    if(value<1) error_fatal("Option COLOUR has unacceptable value.");
    

Parameters:
num - The prompt index. You will want to use the symbolic name here.
toklst - An arbitrary number of one or more string pointers. The last one must be NULL.
Returns:
Zero if the token didn't match any in the file. A value i greater than zero denoting a match against the i-th token supplied as an argument.

Alphabetic index



This page was generated with the help of DOC++.