Routines to get and set EPICS environment parameters.
- Author
- Roger A. Cole
This file defines environment parameters used by EPICS and the routines used to get and set those parameter values.
The ENV_PARAM's declared here are defined in the generated file envData.c by the bldEnvData.pl Perl script, which parses this file and the build system's CONFIG_ENV and CONFIG_SITE_ENV files. User programs can define their own environment parameters for their own use–the only caveat is that such parameters aren't automatically setup by EPICS.
- Note
- bldEnvData.pl looks for "LIBCOM_API extern const ENV_PARAM <name>;"
Definition in file envDefs.h.
LIBCOM_API long epicsStdCall envGetBoolConfigParam |
( |
const ENV_PARAM * |
pParam, |
|
|
int * |
pBool |
|
) |
| |
Get value of a boolean configuration parameter.
Gets the value of a configuration parameter, and puts the value 0 or 1 into the caller's buffer depending on the value. If the configuration parameter isn't found in the environment, the default value for the parameter is used instead.
A value is treated as True (1) if it compares equal to the string "yes" with a case-independent string comparison. All other strings are treated as False (0).
If no parameter is found and there is no default, then -1 is returned and the callers buffer is unmodified.
- Parameters
-
pParam | Pointer to config param structure. |
pBool | Pointer to place to store value. |
- Returns
- 0, or -1 if an error is encountered
Definition at line 325 of file envSubr.c.
int epicsStrCaseCmp(const char *s1, const char *s2)
char *epicsStdCall envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf)
Get value of a configuration parameter.
LIBCOM_API long epicsStdCall envGetDoubleConfigParam |
( |
const ENV_PARAM * |
pParam, |
|
|
double * |
pDouble |
|
) |
| |
Get value of a double configuration parameter.
Gets the value of a configuration parameter, converts it into a double
value and copies that into the caller's buffer. If the configuration parameter isn't found in the environment, the default value for the parameter is used instead.
If no parameter is found and there is no default, then -1 is returned and the callers buffer is unmodified.
- Parameters
-
pParam | Pointer to config param structure. |
pDouble | Pointer to place to store value. |
- Returns
- 0, or -1 if an error is encountered
Definition at line 191 of file envSubr.c.
206 (void)fprintf(
stderr,
"Unable to find a real number in %s=%s\n",
char * name
Name of the parameter.
#define epicsScanDouble(str, to)
char *epicsStdCall envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf)
Get value of a configuration parameter.
LIBCOM_API long epicsStdCall envGetInetAddrConfigParam |
( |
const ENV_PARAM * |
pParam, |
|
|
struct in_addr * |
pAddr |
|
) |
| |
Get value of an inet addr config parameter.
Gets the value of a configuration parameter and copies it into the caller's (struct in_addr) buffer. If the configuration parameter isn't found in the environment, the default value for that parameter will be used. The resulting string is converted from a dotted-quad format or looked up using the DNS and copied into the inet structure.
If no parameter is found and there is no default, then -1 is returned and the callers buffer is unmodified.
- Parameters
-
pParam | Pointer to config param structure. |
pAddr | Pointer to struct to receive inet addr. |
- Returns
- 0, or -1 if an error is encountered
Definition at line 246 of file envSubr.c.
254 struct sockaddr_in sin;
260 *pAddr = sin.sin_addr;
263 (void)fprintf(
stderr,
"Unable to find an IP address or valid host name in %s=%s\n",
LIBCOM_API int epicsStdCall aToIPAddr(const char *pAddrString, unsigned short defaultPort, struct sockaddr_in *pIP)
char * name
Name of the parameter.
char *epicsStdCall envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf)
Get value of a configuration parameter.
LIBCOM_API long epicsStdCall envGetLongConfigParam |
( |
const ENV_PARAM * |
pParam, |
|
|
long * |
pLong |
|
) |
| |
Get value of a long configuration parameter.
Gets the value of a configuration parameter, converts it into a long
value and copies that into the caller's buffer. If the configuration parameter isn't found in the environment, the default value for the parameter is used instead.
If no parameter is found and there is no default, then -1 is returned and the callers buffer is unmodified.
- Parameters
-
pParam | Pointer to config param structure. |
pLong | Pointer to place to store value. |
- Returns
- 0, or -1 if an error is encountered
Definition at line 303 of file envSubr.c.
314 count = sscanf(text,
"%ld", pLong);
317 (void)fprintf(
stderr,
"Unable to find an integer in %s=%s\n",
char * name
Name of the parameter.
char *epicsStdCall envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf)
Get value of a configuration parameter.