H2Lib  3.0
Functions
parameters

Ask for parameters. More...

Functions

int askforint (const char *question, const char *envname, int deflt)
 Ask for an integer. More...
 
char askforchar (const char *question, const char *envname, const char *allowed, char deflt)
 Ask for a character. More...
 
real askforreal (const char *question, const char *envname, real deflt)
 Ask for a real number. More...
 
char * askforstring (const char *question, const char *envname, const char *deflt, char *buffer, uint bufsize)
 Ask for a string. More...
 

Detailed Description

Ask for parameters.

This module provides functions that accept parameters either interactively from the user or from environment variables. The idea is to avoid asking too many questions by setting a couple of environment variables and only asking for those parameters that change during a series of experiments.

Function Documentation

char askforchar ( const char *  question,
const char *  envname,
const char *  allowed,
char  deflt 
)

Ask for a character.

Parameters
questionQuestion to be asked.
envnameIf an environment variable of this name exists, the question is not asked and the contents of the variable are used.
allowedString containing characters that will be accepted.
defltDefault value, will be used if the user answers the question by pressing Enter.
Returns
Character taken from environment, user, or default.
int askforint ( const char *  question,
const char *  envname,
int  deflt 
)

Ask for an integer.

Parameters
questionQuestion to be asked.
envnameIf an environment variable of this name exists, the question is not asked and the contents of the variable are used.
defltDefault value, will be used if the user answers the question by pressing Enter.
Returns
Integer taken from environment, user, or default.
real askforreal ( const char *  question,
const char *  envname,
real  deflt 
)

Ask for a real number.

Parameters
questionQuestion to be asked.
envnameIf an environment variable of this name exists, the question is not asked and the contents of the variable are used.
defltDefault value, will be used if the user answers the question by pressing Enter.
Returns
Real number taken from environment, user, or default.
char* askforstring ( const char *  question,
const char *  envname,
const char *  deflt,
char *  buffer,
uint  bufsize 
)

Ask for a string.

Parameters
questionQuestion to be asked.
envnameIf an environment variable of this name exists, the question is not asked and the contents of the variable are used.
defltDefault value, will be used if the user answers the question by pressing Enter.
bufferInput buffer for the string.
bufsizeSize of the input buffer.
Returns
Pointer to buffer.