mirror of https://github.com/FDOS/kernel.git
Added SET support to config.sys + some small cleanups (from Lucho)
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@714 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
ed77e34c55
commit
11e163096d
|
@ -137,6 +137,9 @@ UWORD ram_top = 0; /* How much ram in Kbytes */
|
||||||
static UBYTE ErrorAlreadyPrinted[128];
|
static UBYTE ErrorAlreadyPrinted[128];
|
||||||
|
|
||||||
|
|
||||||
|
char master_env[128] = {"PATH="}; /* some shells panic on empty master env. */
|
||||||
|
static char *envp = master_env + 6; /* point to the second zero */
|
||||||
|
|
||||||
struct config Config = {
|
struct config Config = {
|
||||||
0,
|
0,
|
||||||
NUMBUFF,
|
NUMBUFF,
|
||||||
|
@ -206,6 +209,7 @@ STATIC VOID InitPgm(BYTE * pLine);
|
||||||
STATIC VOID InitPgmHigh(BYTE * pLine);
|
STATIC VOID InitPgmHigh(BYTE * pLine);
|
||||||
STATIC VOID CmdInstall(BYTE * pLine);
|
STATIC VOID CmdInstall(BYTE * pLine);
|
||||||
STATIC VOID CmdInstallHigh(BYTE * pLine);
|
STATIC VOID CmdInstallHigh(BYTE * pLine);
|
||||||
|
STATIC VOID CmdSet(BYTE * pLine);
|
||||||
|
|
||||||
|
|
||||||
STATIC VOID CfgSwitchar(BYTE * pLine);
|
STATIC VOID CfgSwitchar(BYTE * pLine);
|
||||||
|
@ -226,6 +230,7 @@ STATIC char * GetNumber(REG const char *p, int *num);
|
||||||
STATIC COUNT tolower(COUNT c);
|
STATIC COUNT tolower(COUNT c);
|
||||||
#endif
|
#endif
|
||||||
STATIC COUNT toupper(COUNT c);
|
STATIC COUNT toupper(COUNT c);
|
||||||
|
STATIC VOID strupr(char *s);
|
||||||
STATIC VOID mcb_init(UCOUNT seg, UWORD size, BYTE type);
|
STATIC VOID mcb_init(UCOUNT seg, UWORD size, BYTE type);
|
||||||
STATIC VOID mumcb_init(UCOUNT seg, UWORD size);
|
STATIC VOID mumcb_init(UCOUNT seg, UWORD size);
|
||||||
|
|
||||||
|
@ -306,6 +311,7 @@ STATIC struct table commands[] = {
|
||||||
{"DEVICEHIGH", 2, DeviceHigh},
|
{"DEVICEHIGH", 2, DeviceHigh},
|
||||||
{"INSTALL", 2, CmdInstall},
|
{"INSTALL", 2, CmdInstall},
|
||||||
{"INSTALLHIGH", 2, CmdInstallHigh},
|
{"INSTALLHIGH", 2, CmdInstallHigh},
|
||||||
|
{"SET", 2, CmdSet},
|
||||||
|
|
||||||
/* default action */
|
/* default action */
|
||||||
{"", -1, CfgFailure}
|
{"", -1, CfgFailure}
|
||||||
|
@ -1036,8 +1042,7 @@ STATIC VOID Dosmem(BYTE * pLine)
|
||||||
|
|
||||||
pLine = GetStringArg(pLine, szBuf);
|
pLine = GetStringArg(pLine, szBuf);
|
||||||
|
|
||||||
for (pTmp = szBuf; *pTmp != '\0'; pTmp++)
|
strupr(szBuf);
|
||||||
*pTmp = toupper(*pTmp);
|
|
||||||
|
|
||||||
/* printf("DOS called with %s\n", szBuf); */
|
/* printf("DOS called with %s\n", szBuf); */
|
||||||
|
|
||||||
|
@ -1076,12 +1081,8 @@ STATIC VOID Dosmem(BYTE * pLine)
|
||||||
|
|
||||||
STATIC VOID DosData(BYTE * pLine)
|
STATIC VOID DosData(BYTE * pLine)
|
||||||
{
|
{
|
||||||
BYTE *pTmp;
|
|
||||||
|
|
||||||
pLine = GetStringArg(pLine, szBuf);
|
pLine = GetStringArg(pLine, szBuf);
|
||||||
|
strupr(szBuf);
|
||||||
for (pTmp = szBuf; *pTmp != '\0'; pTmp++)
|
|
||||||
*pTmp = toupper(*pTmp);
|
|
||||||
|
|
||||||
if (fmemcmp(szBuf, "UMB", 3) == 0)
|
if (fmemcmp(szBuf, "UMB", 3) == 0)
|
||||||
Config.cfgDosDataUmb = TRUE;
|
Config.cfgDosDataUmb = TRUE;
|
||||||
|
@ -1337,7 +1338,6 @@ STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode)
|
||||||
struct dhdr FAR *next_dhp;
|
struct dhdr FAR *next_dhp;
|
||||||
BOOL result;
|
BOOL result;
|
||||||
seg base, start;
|
seg base, start;
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (mode)
|
if (mode)
|
||||||
{
|
{
|
||||||
|
@ -1373,8 +1373,7 @@ STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode)
|
||||||
|
|
||||||
strcpy(szBuf, pLine);
|
strcpy(szBuf, pLine);
|
||||||
/* uppercase the device driver command */
|
/* uppercase the device driver command */
|
||||||
for (p = szBuf; *p != '\0'; p++)
|
strupr(szBuf);
|
||||||
*p = toupper(*p);
|
|
||||||
|
|
||||||
/* TE this fixes the loading of devices drivers with
|
/* TE this fixes the loading of devices drivers with
|
||||||
multiple devices in it. NUMEGA's SoftIce is such a beast
|
multiple devices in it. NUMEGA's SoftIce is such a beast
|
||||||
|
@ -1663,6 +1662,13 @@ STATIC COUNT toupper(COUNT c)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Convert string s to uppercase */
|
||||||
|
STATIC VOID strupr(char *s)
|
||||||
|
{
|
||||||
|
while (*s)
|
||||||
|
*s++ = toupper(*s);
|
||||||
|
}
|
||||||
|
|
||||||
/* The following code is 8086 dependant */
|
/* The following code is 8086 dependant */
|
||||||
|
|
||||||
#if 1 /* ifdef KERNEL */
|
#if 1 /* ifdef KERNEL */
|
||||||
|
@ -1691,13 +1697,18 @@ STATIC VOID mumcb_init(UCOUNT seg, UWORD size)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static size_t strlen(const char *s)
|
||||||
|
{
|
||||||
|
size_t n = 0;
|
||||||
|
while (*s++)
|
||||||
|
n++;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
char *strcat(register char * d, register const char * s)
|
char *strcat(register char * d, register const char * s)
|
||||||
{
|
{
|
||||||
char *tmp = d;
|
strcpy(d + strlen(d), s);
|
||||||
while (*d != 0)
|
return d;
|
||||||
++d;
|
|
||||||
strcpy(d, s);
|
|
||||||
return tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1995,6 +2006,9 @@ RestartInput:
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
/* export the current selected config menu */
|
||||||
|
sprintf(envp, "CONFIG=%c", MenuSelected+'0');
|
||||||
|
envp += 9;
|
||||||
if (MenuColor != -1)
|
if (MenuColor != -1)
|
||||||
ClearScreen(0x7);
|
ClearScreen(0x7);
|
||||||
}
|
}
|
||||||
|
@ -2660,3 +2674,27 @@ VOID DoInstall(void)
|
||||||
InstallPrintf(("Done with installing commands\n"));
|
InstallPrintf(("Done with installing commands\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC VOID CmdSet(BYTE *pLine)
|
||||||
|
{
|
||||||
|
pLine = GetStringArg(pLine, szBuf);
|
||||||
|
pLine = skipwh(pLine); /* scan() stops at the equal sign or space */
|
||||||
|
if (*pLine == '=') /* equal sign is required */
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
strupr(szBuf); /* all environment variables must be uppercase */
|
||||||
|
strcat(szBuf, "=");
|
||||||
|
pLine = skipwh(++pLine);
|
||||||
|
strcat(szBuf, pLine); /* append the variable value (may include spaces) */
|
||||||
|
size = strlen(szBuf);
|
||||||
|
if (size < master_env + sizeof(master_env) - envp - 1)
|
||||||
|
{ /* must end with two consequtive zeros */
|
||||||
|
strcpy(envp, szBuf);
|
||||||
|
envp += size + 1; /* add next variables starting at the second zero */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("Master environment is full - can't add \"%s\"\n", szBuf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("Invalid SET command: \"%s\"\n", szBuf);
|
||||||
|
}
|
||||||
|
|
|
@ -207,10 +207,9 @@ extern BYTE FAR *lpOldTop;
|
||||||
extern BYTE FAR *lpTop;
|
extern BYTE FAR *lpTop;
|
||||||
extern BYTE ASM _ib_start[], ASM _ib_end[], ASM _init_end[];
|
extern BYTE ASM _ib_start[], ASM _ib_end[], ASM _init_end[];
|
||||||
extern UWORD ram_top; /* How much ram in Kbytes */
|
extern UWORD ram_top; /* How much ram in Kbytes */
|
||||||
extern char MenuSelected;
|
|
||||||
extern unsigned Menus;
|
|
||||||
extern char singleStep;
|
extern char singleStep;
|
||||||
extern char SkipAllConfig;
|
extern char SkipAllConfig;
|
||||||
|
extern char master_env[128];
|
||||||
|
|
||||||
extern struct lol FAR *LoL;
|
extern struct lol FAR *LoL;
|
||||||
|
|
||||||
|
|
|
@ -361,22 +361,6 @@ STATIC void kernel()
|
||||||
CommandTail Cmd;
|
CommandTail Cmd;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
BYTE master_env[32];
|
|
||||||
char *masterenv_ptr = master_env;
|
|
||||||
|
|
||||||
/* build the startup environment */
|
|
||||||
|
|
||||||
memset(master_env,0,sizeof(master_env));
|
|
||||||
|
|
||||||
/* initial path setting. is this useful ?? */
|
|
||||||
masterenv_ptr += sprintf(masterenv_ptr, "PATH=.");
|
|
||||||
|
|
||||||
/* export the current selected config menu */
|
|
||||||
if (Menus)
|
|
||||||
{
|
|
||||||
masterenv_ptr += sprintf(masterenv_ptr, "CONFIG=%c", MenuSelected+'0');
|
|
||||||
}
|
|
||||||
|
|
||||||
exb.exec.env_seg = DOS_PSP + 8;
|
exb.exec.env_seg = DOS_PSP + 8;
|
||||||
fmemcpy(MK_FP(exb.exec.env_seg, 0), master_env, sizeof(master_env));
|
fmemcpy(MK_FP(exb.exec.env_seg, 0), master_env, sizeof(master_env));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue