config: pass searchvar result to deletevar

This commit is contained in:
C. Masloch 2023-08-30 11:05:11 +02:00 committed by Kenneth J Davis
parent 24d19cd05c
commit 6101fb2aed

View File

@ -2751,9 +2751,8 @@ STATIC BYTE far * searchvar(const BYTE * name, int length)
return NULL; return NULL;
} }
STATIC void deletevar(const BYTE * name, int length) { STATIC void deletevar(BYTE far * pp) {
int variablelength; int variablelength;
BYTE far * pp = searchvar(name, length);
if (NULL == pp) if (NULL == pp)
return; return;
variablelength = fstrlen(pp) + 1; variablelength = fstrlen(pp) + 1;
@ -2770,10 +2769,12 @@ STATIC VOID CmdSet(BYTE *pLine)
if (*pLine == '=') /* equal sign is required */ if (*pLine == '=') /* equal sign is required */
{ {
int size, namesize; int size, namesize;
BYTE far * pp;
strupr(szBuf); /* all environment variables must be uppercase */ strupr(szBuf); /* all environment variables must be uppercase */
namesize = strlen(szBuf); namesize = strlen(szBuf);
strcat(szBuf, "="); strcat(szBuf, "=");
deletevar(szBuf, namesize); pp = searchvar(szBuf, namesize);
deletevar(pp);
pLine = skipwh(++pLine); pLine = skipwh(++pLine);
strcat(szBuf, pLine); /* append the variable value (may include spaces) */ strcat(szBuf, pLine); /* append the variable value (may include spaces) */
size = strlen(szBuf); size = strlen(szBuf);