Re: [Freedos-kernel] config.c: bug?
Hi! 22-Апр-2004 11:11 Arkady V.Belousov wrote to [EMAIL PROTECTED]: AVB> I may suggest next patch: Sorry, forget about undocumented "COMMAND": __O\_/_\_/O__ diff -ruNp old/config.c new/config.c --- old/config.c2004-04-14 16:04:04.0 + +++ new/config.c2004-04-22 11:16:16.0 + @@ -125,6 +125,9 @@ static UBYTE ErrorAlreadyPrinted[128] BS char master_env[128] BSS_INIT({0}); static char *envp = master_env; +static char init[NAMEMAX] = "command.com"; +static char inittail[NAMEMAX] = " /P /E:256\r\n"; + struct config Config = { 0, NUMBUFF, @@ -132,8 +135,8 @@ struct config Config = { 0, NFCBS, 0, - "command.com", - " /P /E:256\r\n", + init, + inittail, NLAST, 0, NSTACKS, @@ -267,7 +270,6 @@ STATIC struct table commands[] = { {"BREAK", 1, CfgBreak}, {"BUFFERS", 1, Config_Buffers}, - {"COMMAND", 1, InitPgm}, {"COUNTRY", 1, Country}, {"DOS", 1, Dosmem}, {"DOSDATA", 1, DosData}, @@ -1237,12 +1239,6 @@ STATIC VOID InitPgmHigh(BYTE * pLine) STATIC VOID InitPgm(BYTE * pLine) { - static char init[NAMEMAX]; - static char inittail[NAMEMAX]; - - Config.cfgInit = init; - Config.cfgInitTail = inittail; - /* Get the string argument that represents the new init pgm */ pLine = GetStringArg(pLine, Config.cfgInit); _ O/~\ /~\O --- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
[Freedos-kernel] config.c: bug?
Hi! __O\_/_\_/O__ struct config Config = { 0, NUMBUFF, NFILES, 0, NFCBS, 0, "command.com", " /P /E:256\r\n", [...] STATIC struct table commands[] = { {"COMMAND", 1, InitPgm}, {"SHELL", 1, InitPgm}, [...] STATIC VOID InitPgm(BYTE * pLine) { static char init[NAMEMAX]; static char inittail[NAMEMAX]; Config.cfgInit = init; Config.cfgInitTail = inittail; _ O/~\ /~\O - InitPgm() used both for (undocumented) command "COMMAND" and for "SHELL". This is valid only if "COMMAND" is duplication for "SHELL", but then this statement is useless. - init[] and inittail[] used without BSS_INIT(). Bug? I may suggest next patch: __O\_/_\_/O__ diff -ruNp old/config.c new/config.c --- old/config.c2004-04-14 16:04:04.0 + +++ new/config.c2004-04-22 11:01:06.0 + @@ -125,6 +125,9 @@ static UBYTE ErrorAlreadyPrinted[128] BS char master_env[128] BSS_INIT({0}); static char *envp = master_env; +static char init[NAMEMAX] = "command.com"; +static char inittail[NAMEMAX] = " /P /E:256\r\n"; + struct config Config = { 0, NUMBUFF, @@ -132,8 +135,8 @@ struct config Config = { 0, NFCBS, 0, - "command.com", - " /P /E:256\r\n", + init, + inittail, NLAST, 0, NSTACKS, @@ -1237,12 +1240,6 @@ STATIC VOID InitPgmHigh(BYTE * pLine) STATIC VOID InitPgm(BYTE * pLine) { - static char init[NAMEMAX]; - static char inittail[NAMEMAX]; - - Config.cfgInit = init; - Config.cfgInitTail = inittail; - /* Get the string argument that represents the new init pgm */ pLine = GetStringArg(pLine, Config.cfgInit); _ O/~\ /~\O But I don't understand why from 2033 cfgInit and cfgInitTail was converted from arrays to pointers. I see only only one reason: cfgInit used as pointer to Cmd.ctBuffer in main.c:kernel(). But who prevents to declare cfgInit as array of [NAMEMAX*2] and remove completely Cmd and .cfgInitTail? PS: Bart, if you wish, I may remove cfgInitTail for you. PPS: Bart, you don't answer, why you not move VDISK_BOOT_SECTOR from inithma.c:InstallVDISK() into kernel.asm and not remove InstallVDISK()? --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel