- Changed strncpy to strlcpy, strncat to strlcat

- Added strlcpy and strlcat to SICS
- Added a driver for the POLDI power supplies


SKIPPED:
	psi/A1931.c
	psi/autowin.c
	psi/bruker.c
	psi/docho.c
	psi/dornier2.c
	psi/dspcode.c
	psi/ease.c
	psi/ecb.c
	psi/ecbcounter.c
	psi/ecbdriv.c
	psi/el734dc.c
	psi/el734driv.c
	psi/el734hp.c
	psi/el737driv.c
	psi/el737hpdriv.c
	psi/el737hpdrivsps.c
	psi/el737hpv2driv.c
	psi/el755driv.c
	psi/eurodriv.c
	psi/haakedriv.c
	psi/itc4driv.c
	psi/julcho.c
	psi/linadriv.c
	psi/lmd200.c
	psi/lscsupport.c
	psi/ltc11.c
	psi/make_gen
	psi/oicom.c
	psi/oxinst.c
	psi/pimotor.c
	psi/pipiezo.c
	psi/polterwrite.c
	psi/psi.c
	psi/sanscook.c
	psi/sanslirebin.c
	psi/sanswave.c
	psi/sinqhmdriv.c
	psi/sinqhttp.c
	psi/slsecho.c
	psi/slsmagnet.c
	psi/slsvme.c
	psi/sps.c
	psi/swmotor.c
	psi/swmotor2.c
	psi/tabledrive.c
	psi/tasscan.c
	psi/tdchm.c
	psi/velodorn.c
	psi/velodornier.c
This commit is contained in:
koennecke
2010-04-13 15:08:38 +00:00
parent d19e3e5ca9
commit b26b8fc735
83 changed files with 555 additions and 316 deletions

View File

@ -74,7 +74,7 @@ static int GetTclPos(void *self, float *fPos)
}
if (status != TCL_OK) {
pDriv->errorCode = TCLERROR;
strncpy(pDriv->tclError, result, 1023);
strlcpy(pDriv->tclError, result, 1023);
return HWFault;
}
sscanf(result, "%f", fPos);
@ -99,7 +99,7 @@ static int TclRun(void *self, float fVal)
return HWFault;
}
snprintf(num, 79, "%f", fVal);
strncat(tclCommand, num, 1023 - strlen(tclCommand));
strlcat(tclCommand, num, 1023 - strlen(tclCommand));
status = Tcl_Eval(pServ->pSics->pTcl, tclCommand);
result = Tcl_GetStringResult(pServ->pSics->pTcl);
@ -109,7 +109,7 @@ static int TclRun(void *self, float fVal)
}
if (status != TCL_OK) {
pDriv->errorCode = TCLERROR;
strncpy(pDriv->tclError, result, 1023);
strlcpy(pDriv->tclError, result, 1023);
return HWFault;
}
sscanf(result, "%d", &status);
@ -122,18 +122,18 @@ static int evaluateInternalErrors(TCLDriv * pDriv, int *iCode,
{
switch (pDriv->errorCode) {
case FUNCNOTFOUND:
strncpy(error, "Config Error: Tcl function for driver not found",
strlcpy(error, "Config Error: Tcl function for driver not found",
iErrLen);
*iCode = pDriv->errorCode;
return 1;
break;
case TCLERROR:
strncpy(error, pDriv->tclError, iErrLen);
strlcpy(error, pDriv->tclError, iErrLen);
*iCode = pDriv->errorCode;
return 1;
break;
case NOTCLRESULT:
strncpy(error, "Tcl function did not return result", iErrLen);
strlcpy(error, "Tcl function did not return result", iErrLen);
*iCode = pDriv->errorCode;
return 1;
break;
@ -172,14 +172,14 @@ static void TclError(void *self, int *iCode, char *error, int iErrLen)
}
if (status != TCL_OK && result != NULL) {
pDriv->errorCode = TCLERROR;
strncpy(pDriv->tclError, result, 1023);
strlcpy(pDriv->tclError, result, 1023);
}
}
if (evaluateInternalErrors(pDriv, iCode, error, iErrLen) == 1) {
return;
}
strncpy(error, result, iErrLen);
strlcpy(error, result, iErrLen);
}
/*---------------------------------------------------------------------------*/
@ -199,7 +199,7 @@ static int TclFix(void *self, int iError, float fNew)
return HWFault;
}
snprintf(num, 79, "%d %f", pDriv->errorCode, fNew);
strncat(tclCommand, num, 1023 - strlen(tclCommand));
strlcat(tclCommand, num, 1023 - strlen(tclCommand));
status = Tcl_Eval(pServ->pSics->pTcl, tclCommand);
result = Tcl_GetStringResult(pServ->pSics->pTcl);
@ -209,7 +209,7 @@ static int TclFix(void *self, int iError, float fNew)
}
if (status != TCL_OK) {
pDriv->errorCode = TCLERROR;
strncpy(pDriv->tclError, result, 1023);
strlcpy(pDriv->tclError, result, 1023);
return HWFault;
}
sscanf(result, "%d", &status);
@ -241,7 +241,7 @@ static int TclHalt(void *self)
}
if (status != TCL_OK) {
pDriv->errorCode = TCLERROR;
strncpy(pDriv->tclError, result, 1023);
strlcpy(pDriv->tclError, result, 1023);
return HWFault;
}
return OKOK;
@ -272,7 +272,7 @@ static int TclStat(void *self)
}
if (status != TCL_OK) {
pDriv->errorCode = TCLERROR;
strncpy(pDriv->tclError, result, 1023);
strlcpy(pDriv->tclError, result, 1023);
return HWFault;
}
sscanf(result, "%d", &status);
@ -393,7 +393,7 @@ MotorDriver *CreateTclMotDriv(SConnection * pCon, int argc, char *argv[])
}
pDriv->name = strdup("Tcl-Driver");
strncpy(pDriv->motName, argv[1], 131);
strlcpy(pDriv->motName, argv[1], 131);
pDriv->GetPosition = GetTclPos;
pDriv->RunTo = TclRun;
pDriv->GetStatus = TclStat;