config: delete existing variable before writing new contents
This commit is contained in:
parent
132a0a9f94
commit
3dafa54e8b
@ -327,7 +327,6 @@ strcpy_loop:
|
|||||||
jmp short pascal_return
|
jmp short pascal_return
|
||||||
|
|
||||||
;******************************************************************
|
;******************************************************************
|
||||||
%ifndef _INIT
|
|
||||||
global FSTRLEN
|
global FSTRLEN
|
||||||
FSTRLEN:
|
FSTRLEN:
|
||||||
call pascal_setup
|
call pascal_setup
|
||||||
@ -337,7 +336,6 @@ FSTRLEN:
|
|||||||
mov bl,4
|
mov bl,4
|
||||||
|
|
||||||
jmp short dostrlen
|
jmp short dostrlen
|
||||||
%endif
|
|
||||||
|
|
||||||
;**********************************************
|
;**********************************************
|
||||||
global STRLEN
|
global STRLEN
|
||||||
|
@ -2739,6 +2739,30 @@ VOID DoInstall(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC BYTE far * searchvar(const BYTE * name, int length)
|
||||||
|
{
|
||||||
|
BYTE far * pp = master_env;
|
||||||
|
do {
|
||||||
|
if (!fmemcmp(name, pp, length + 1)) {
|
||||||
|
return pp;
|
||||||
|
}
|
||||||
|
pp += fstrlen(pp) + 1;
|
||||||
|
} while (*pp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC void deletevar(const BYTE * name, int length) {
|
||||||
|
int variablelength;
|
||||||
|
BYTE far * pp = searchvar(name, length);
|
||||||
|
if (NULL == pp)
|
||||||
|
return;
|
||||||
|
variablelength = fstrlen(pp) + 1;
|
||||||
|
fmemcpy(pp, pp + variablelength, envp + 3 - (pp + variablelength));
|
||||||
|
/* our fmemcpy always copies forwards */
|
||||||
|
envp -= variablelength;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC VOID CmdSet(BYTE *pLine)
|
STATIC VOID CmdSet(BYTE *pLine)
|
||||||
{
|
{
|
||||||
pLine = GetStringArg(pLine, szBuf);
|
pLine = GetStringArg(pLine, szBuf);
|
||||||
@ -2747,7 +2771,9 @@ STATIC VOID CmdSet(BYTE *pLine)
|
|||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
strupr(szBuf); /* all environment variables must be uppercase */
|
strupr(szBuf); /* all environment variables must be uppercase */
|
||||||
|
size = strlen(szBuf);
|
||||||
strcat(szBuf, "=");
|
strcat(szBuf, "=");
|
||||||
|
deletevar(szBuf, size);
|
||||||
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);
|
||||||
|
@ -150,6 +150,7 @@ SECTIONS
|
|||||||
_init_strcpy = INIT_STRCPY;
|
_init_strcpy = INIT_STRCPY;
|
||||||
_init_fstrcpy = INIT_FSTRCPY;
|
_init_fstrcpy = INIT_FSTRCPY;
|
||||||
_init_strlen = INIT_STRLEN;
|
_init_strlen = INIT_STRLEN;
|
||||||
|
_init_fstrlen = INIT_FSTRLEN;
|
||||||
_init_strchr = INIT_STRCHR;
|
_init_strchr = INIT_STRCHR;
|
||||||
_UMB_get_largest = UMB_GET_LARGEST;
|
_UMB_get_largest = UMB_GET_LARGEST;
|
||||||
_init_call_intr = INIT_CALL_INTR;
|
_init_call_intr = INIT_CALL_INTR;
|
||||||
|
Loading…
Reference in New Issue
Block a user