Ask for parameters.
More...
|
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...
|
|
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.
char askforchar |
( |
const char * |
question, |
|
|
const char * |
envname, |
|
|
const char * |
allowed, |
|
|
char |
deflt |
|
) |
| |
Ask for a character.
- Parameters
-
question | Question to be asked. |
envname | If an environment variable of this name exists, the question is not asked and the contents of the variable are used. |
allowed | String containing characters that will be accepted. |
deflt | Default 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
-
question | Question to be asked. |
envname | If an environment variable of this name exists, the question is not asked and the contents of the variable are used. |
deflt | Default 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
-
question | Question to be asked. |
envname | If an environment variable of this name exists, the question is not asked and the contents of the variable are used. |
deflt | Default 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
-
question | Question to be asked. |
envname | If an environment variable of this name exists, the question is not asked and the contents of the variable are used. |
deflt | Default value, will be used if the user answers the question by pressing Enter. |
buffer | Input buffer for the string. |
bufsize | Size of the input buffer. |
- Returns
- Pointer to
buffer
.