Files
sics/site_ansto/anstoutil.c
Ferdi Franceschini 667c505bf7 Removed ref to dmc motor controller in the getParam error message.
r1043 | ffr | 2006-08-04 12:20:57 +1000 (Fri, 04 Aug 2006) | 2 lines
2012-11-15 12:45:36 +11:00

26 lines
862 B
C

#include <stdlib.h>
#include <sics.h>
#include "anstoutil.h"
/** \brief Get configuration parameter
* \param *pCon (r) connection object.
* \param *pTcl (r) Tcl interpreter
* \param *params Tcl array of configuration parameters
* \param *parName name of parameter to get from the array
* \param mustHave indicates optional or mandatory parameters\n
* possible values
* - _REQUIRED
* - _OPTIONAL
* \return (r) a reference to a string representation of the parameter value
*/
char *getParam(SConnection *pCon, Tcl_Interp *pTcl, char *params, char *parName, int mustHave ) {
char *pPtr=NULL;
char pError[ERRLEN];
pPtr = Tcl_GetVar2(pTcl,params,parName,TCL_GLOBAL_ONLY);
if((mustHave == _REQUIRED) && !pPtr){
snprintf(pError, ERRLEN,"ERROR: You must supply an '%s' parameter", parName);
SCWrite(pCon,pError, eError);
}
return pPtr;
}