- 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:
68
SCinter.c
68
SCinter.c
@ -128,7 +128,7 @@ int AddCommandWithFlag(SicsInterp * pInterp, char *pName, ObjectFunc pFunc,
|
||||
assert(pFunc);
|
||||
assert(pInterp);
|
||||
|
||||
strncpy(pBueffel, pName,511);
|
||||
strlcpy(pBueffel, pName,511);
|
||||
strtolower(pBueffel);
|
||||
RemoveAlias(&pInterp->AList, pBueffel); /* M.Z. */
|
||||
if (FindCommand(pInterp, pBueffel) != NULL) {
|
||||
@ -206,7 +206,7 @@ int RemoveCommand(SicsInterp * pInterp, char *pName)
|
||||
assert(pInterp);
|
||||
assert(pName);
|
||||
|
||||
strncpy(pBueffel, pName,255);
|
||||
strlcpy(pBueffel, pName,255);
|
||||
strtolower(pBueffel);
|
||||
|
||||
if (pInterp->iDeleting) {
|
||||
@ -390,7 +390,7 @@ CommandList *FindCommand(SicsInterp * self, char *pName)
|
||||
}
|
||||
|
||||
memset(pBueffel,0,1024);
|
||||
strncpy(pBueffel, pName,1023);
|
||||
strlcpy(pBueffel, pName,1023);
|
||||
strtolower(pBueffel);
|
||||
|
||||
pCmd = TranslateAlias(&self->AList, pBueffel); /* M.Z. */
|
||||
@ -559,15 +559,15 @@ static void printAll(SicsInterp * pSics, SConnection * pCon)
|
||||
pCurrent = pSics->pCList;
|
||||
while (pCurrent) {
|
||||
if (iNum == 0) {
|
||||
strncpy(pBueffel, pCurrent->pName,255);
|
||||
strlcpy(pBueffel, pCurrent->pName,255);
|
||||
iNum++;
|
||||
} else if (iNum < 4) {
|
||||
strncat(pBueffel, " ",255);
|
||||
strncat(pBueffel, pCurrent->pName,255);
|
||||
strlcat(pBueffel, " ",255);
|
||||
strlcat(pBueffel, pCurrent->pName,255);
|
||||
iNum++;
|
||||
} else {
|
||||
strncat(pBueffel, " ",255);
|
||||
strncat(pBueffel, pCurrent->pName,255);
|
||||
strlcat(pBueffel, " ",255);
|
||||
strlcat(pBueffel, pCurrent->pName,255);
|
||||
strcat(pBueffel, "\r\n");
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
iNum = 0;
|
||||
@ -578,7 +578,7 @@ static void printAll(SicsInterp * pSics, SConnection * pCon)
|
||||
|
||||
/* write final entries */
|
||||
if (strlen(pBueffel) > 2) {
|
||||
strncat(pBueffel, "\r\n",255);
|
||||
strlcat(pBueffel, "\r\n",255);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
}
|
||||
}
|
||||
@ -625,7 +625,7 @@ static void printAllTypes(SicsInterp * pSics, SConnection * pCon,
|
||||
pTest = (pDummy) pCurrent->pData;
|
||||
if (NULL != pTest->pDescriptor) {
|
||||
pType = pTest->pDescriptor->name;
|
||||
strncpy(pType_lc, pType,255);
|
||||
strlcpy(pType_lc, pType,255);
|
||||
strtolower(pType_lc);
|
||||
|
||||
LLDnodePtr2First(typeListID);
|
||||
@ -640,7 +640,7 @@ static void printAllTypes(SicsInterp * pSics, SConnection * pCon,
|
||||
/* NB: First checked node is current node, then search to end of list */
|
||||
|
||||
if (0 != LLDnodeFind(typeListID, compareStringNode, (void *) pType)) { /* empty list or 'typename' not found */
|
||||
strncpy(pName_lc, pCurrent->pName,255);
|
||||
strlcpy(pName_lc, pCurrent->pName,255);
|
||||
strtolower(pName_lc);
|
||||
if ((0 == iFiltered) || ((1 == iFiltered) && (0 != strcmp(pType_lc, pName_lc)))) { /*ie Add if unfiltered or pass filter(name!=typename) */
|
||||
LLDstringAdd(typeListID, pType);
|
||||
@ -675,16 +675,16 @@ static void printInterface(SicsInterp * pSics, SConnection * pCon, int id)
|
||||
if (pObj != NULL) {
|
||||
if (pObj->GetInterface(pObj, id) != NULL) {
|
||||
if (iNum == 0) {
|
||||
strncpy(pBueffel, pCurrent->pName,255);
|
||||
strlcpy(pBueffel, pCurrent->pName,255);
|
||||
iNum++;
|
||||
} else if (iNum < 4) {
|
||||
strncat(pBueffel, " ",255);
|
||||
strncat(pBueffel, pCurrent->pName,255);
|
||||
strlcat(pBueffel, " ",255);
|
||||
strlcat(pBueffel, pCurrent->pName,255);
|
||||
iNum++;
|
||||
} else {
|
||||
strncat(pBueffel, " ",255);
|
||||
strncat(pBueffel, pCurrent->pName,255);
|
||||
strncat(pBueffel, "\r\n",255);
|
||||
strlcat(pBueffel, " ",255);
|
||||
strlcat(pBueffel, pCurrent->pName,255);
|
||||
strlcat(pBueffel, "\r\n",255);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
iNum = 0;
|
||||
pBueffel[0] = '\0';
|
||||
@ -721,16 +721,16 @@ static void printMatch(SicsInterp * pSics, SConnection * pCon, char *mask)
|
||||
if (pObj != NULL) {
|
||||
if (!match(mask, pObj->name)) {
|
||||
if (iNum == 0) {
|
||||
strncpy(pBueffel, pCurrent->pName,255);
|
||||
strlcpy(pBueffel, pCurrent->pName,255);
|
||||
iNum++;
|
||||
} else if (iNum < 4) {
|
||||
strncat(pBueffel, " ",255);
|
||||
strncat(pBueffel, pCurrent->pName,255);
|
||||
strlcat(pBueffel, " ",255);
|
||||
strlcat(pBueffel, pCurrent->pName,255);
|
||||
iNum++;
|
||||
} else {
|
||||
strncat(pBueffel, " ",255);
|
||||
strncat(pBueffel, pCurrent->pName,255);
|
||||
strncat(pBueffel, "\r\n",255);
|
||||
strlcat(pBueffel, " ",255);
|
||||
strlcat(pBueffel, pCurrent->pName,255);
|
||||
strlcat(pBueffel, "\r\n",255);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
pBueffel[0] = '\0';
|
||||
iNum = 0;
|
||||
@ -741,7 +741,7 @@ static void printMatch(SicsInterp * pSics, SConnection * pCon, char *mask)
|
||||
}
|
||||
|
||||
/* write final entries */
|
||||
strncat(pBueffel, "\r\n",255);
|
||||
strlcat(pBueffel, "\r\n",255);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
}
|
||||
|
||||
@ -766,16 +766,16 @@ static void printType(SicsInterp * pSics, SConnection * pCon,
|
||||
if (pCurrent->pData != NULL) {
|
||||
if (iHasType(pCurrent->pData, typeName)) {
|
||||
if (iNum == 0) {
|
||||
strncpy(pBueffel, pCurrent->pName,255);
|
||||
strlcpy(pBueffel, pCurrent->pName,255);
|
||||
iNum++;
|
||||
} else if (iNum < 4) {
|
||||
strncat(pBueffel, " ",255);
|
||||
strncat(pBueffel, pCurrent->pName,255);
|
||||
strlcat(pBueffel, " ",255);
|
||||
strlcat(pBueffel, pCurrent->pName,255);
|
||||
iNum++;
|
||||
} else {
|
||||
strncat(pBueffel, " ",255);
|
||||
strncat(pBueffel, pCurrent->pName,255);
|
||||
strncat(pBueffel, "\r\n",255);
|
||||
strlcat(pBueffel, " ",255);
|
||||
strlcat(pBueffel, pCurrent->pName,255);
|
||||
strlcat(pBueffel, "\r\n",255);
|
||||
Tcl_DStringAppend(&txt, pBueffel, -1);
|
||||
pBueffel[0] = '\0';
|
||||
iNum = 0;
|
||||
@ -786,7 +786,7 @@ static void printType(SicsInterp * pSics, SConnection * pCon,
|
||||
}
|
||||
|
||||
/* write final entries */
|
||||
strncat(pBueffel, "\r\n",255);
|
||||
strlcat(pBueffel, "\r\n",255);
|
||||
SCWrite(pCon, Tcl_DStringValue(&txt), eValue);
|
||||
Tcl_DStringFree(&txt);
|
||||
}
|
||||
@ -869,12 +869,12 @@ int ListObjects(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
printAllTypes(pSics, pCon, 0);
|
||||
return 1;
|
||||
}
|
||||
strncpy(pType, argv[2],255);
|
||||
strlcpy(pType, argv[2],255);
|
||||
/* Cater for multi-word types eg 'Environment Monitor' */
|
||||
if (argc > 3) {
|
||||
for (i = 3; i < argc; i++) {
|
||||
strncat(pType, " ",255);
|
||||
strncat(pType, argv[i],255);
|
||||
strlcat(pType, " ",255);
|
||||
strlcat(pType, argv[i],255);
|
||||
}
|
||||
}
|
||||
printType(pSics, pCon, pType);
|
||||
|
Reference in New Issue
Block a user