- 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:
26
tasscanub.c
26
tasscanub.c
@ -58,7 +58,7 @@ static void strcenter(char *str, char *target, int iLength)
|
||||
catch the error if target is to long
|
||||
*/
|
||||
if (strlen(str) >= iLength) {
|
||||
strncpy(target, str, iLength);
|
||||
strlcpy(target, str, iLength);
|
||||
}
|
||||
|
||||
iPtr = (iLength - strlen(str)) / 2;
|
||||
@ -275,7 +275,7 @@ static int TASUBHeader(pScanData self)
|
||||
DynarGet(self->pScanVar, i, &pPtr);
|
||||
pVar = (pVarEntry) pPtr;
|
||||
if (pVar) {
|
||||
strncpy(pWork2, ScanVarName(pVar), 59);
|
||||
strlcpy(pWork2, ScanVarName(pVar), 59);
|
||||
strtoupper(pWork2);
|
||||
snprintf(pWork,sizeof(pWork)-1, "D%s=%8.4f, ", pWork2, ScanVarStep(pVar));
|
||||
strcat(pBueffel, pWork);
|
||||
@ -399,7 +399,7 @@ static int TASUBHeader(pScanData self)
|
||||
iCount = 0;
|
||||
fprintf(self->fd, "\nVARIA: ");
|
||||
}
|
||||
strncpy(pWork2, pCom->pName,60);
|
||||
strlcpy(pWork2, pCom->pName,60);
|
||||
strtoupper(pWork2);
|
||||
fprintf(self->fd, "%-8s=%8.4f, ", pWork2, fVal);
|
||||
iCount++;
|
||||
@ -430,7 +430,7 @@ static int TASUBHeader(pScanData self)
|
||||
iCount = 0;
|
||||
fprintf(self->fd, "\nZEROS: ");
|
||||
}
|
||||
strncpy(pWork2, pCom->pName,60);
|
||||
strlcpy(pWork2, pCom->pName,60);
|
||||
strtoupper(pWork2);
|
||||
fprintf(self->fd, "%-8s=%8.4f, ", pWork2, fVal);
|
||||
iCount++;
|
||||
@ -485,11 +485,11 @@ static int TASUBHeader(pScanData self)
|
||||
DynarGet(self->pScanVar, i, &pPtr);
|
||||
pVar = (pVarEntry) pPtr;
|
||||
if (pVar) {
|
||||
strncat(pBueffel, "F9.4,1X,",1024);
|
||||
strncpy(pWork2, pVar->Name, 59);
|
||||
strlcat(pBueffel, "F9.4,1X,",1024);
|
||||
strlcpy(pWork2, pVar->Name, 59);
|
||||
strtoupper(pWork2);
|
||||
strcenter(pWork2, pTen, 11);
|
||||
strncat(pHeader, pTen,1024);
|
||||
strlcat(pHeader, pTen,1024);
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -502,16 +502,16 @@ static int TASUBHeader(pScanData self)
|
||||
*/
|
||||
for (i = 0; i < pTAS->addCount; i++) {
|
||||
if (i == pTAS->addCount - 1) {
|
||||
strncat(pBueffel, "F9.4",1024);
|
||||
strlcat(pBueffel, "F9.4",1024);
|
||||
} else {
|
||||
strncat(pBueffel, "F9.4,1X,",1024);
|
||||
strlcat(pBueffel, "F9.4,1X,",1024);
|
||||
}
|
||||
strncpy(pWork2, pTAS->out[i],60);
|
||||
strlcpy(pWork2, pTAS->out[i],60);
|
||||
strtoupper(pWork2);
|
||||
strcenter(pWork2, pTen, 11);
|
||||
strncat(pHeader, pTen,1024);
|
||||
strlcat(pHeader, pTen,1024);
|
||||
}
|
||||
strncat(pBueffel, ")",1024);
|
||||
strlcat(pBueffel, ")",1024);
|
||||
|
||||
/*
|
||||
write the final bit
|
||||
@ -867,7 +867,7 @@ static void ParseOutput(pTASdata pTAS, SConnection * pCon)
|
||||
continue;
|
||||
|
||||
if (FindCommand(pServ->pSics, trim(pToken))) {
|
||||
strncpy(pTAS->out[pTAS->addCount], trim(pToken), 10);
|
||||
strlcpy(pTAS->out[pTAS->addCount], trim(pToken), 10);
|
||||
pTAS->addCount++;
|
||||
} else {
|
||||
strtolower(pToken);
|
||||
|
Reference in New Issue
Block a user