memdisk support spaces between line markers }{ and treat initrd and/or BOOT_IMAGE options as eol and eof indicator

This commit is contained in:
Kenneth J. Davis 2012-11-05 23:37:36 -05:00
parent 0053674575
commit 9c7e161526

View File

@ -647,7 +647,7 @@ VOID DoConfig(int nPass)
if (mdsk != NULL) if (mdsk != NULL)
{ {
printf("MEMDISK version %u.%02u (%lu sectors)\n", mdsk->version, mdsk->version_minor, mdsk->size); printf("MEMDISK version %u.%02u (%lu sectors)\n", mdsk->version, mdsk->version_minor, mdsk->size);
DebugPrintf(("MEMDISK args:{%S} bootdrive=[%0Xh]\n", mdsk->cmdline, (unsigned int)drv)); DebugPrintf(("MEMDISK args:{%S}\n", mdsk->cmdline));
} }
#endif #endif
} }
@ -671,10 +671,6 @@ VOID DoConfig(int nPass)
if (*mdsk_cfg != '=') continue; if (*mdsk_cfg != '=') continue;
++mdsk_cfg; ++mdsk_cfg;
/* skip past any extra spaces between = and ( */
while (*mdsk_cfg == ' ')
++mdsk_cfg;
/* assume found extra config options */ /* assume found extra config options */
break; break;
} }
@ -768,13 +764,18 @@ VOID DoConfig(int nPass)
else if (mdsk_cfg != NULL) else if (mdsk_cfg != NULL)
{ {
pLine = szLine; pLine = szLine;
/* copy data to near buffer skipping { and } */
/* skip past any extra spaces before ( */
while (*mdsk_cfg == ' ')
++mdsk_cfg;
if (*mdsk_cfg != '{') /* if not at start of line */ if (*mdsk_cfg != '{') /* if not at start of line */
{ {
mdsk_cfg = NULL; /* no longer need data, so set to NULL to flag done */ mdsk_cfg = NULL; /* no longer need data, so set to NULL to flag done */
} }
else else
{ {
/* copy data to near buffer skipping { and } */
for (pLine = szLine, mdsk_cfg++; *mdsk_cfg; mdsk_cfg++, pLine++) for (pLine = szLine, mdsk_cfg++; *mdsk_cfg; mdsk_cfg++, pLine++)
{ {
/* copy character to near buffer */ /* copy character to near buffer */
@ -788,6 +789,19 @@ VOID DoConfig(int nPass)
break; break;
} }
/* if initrd=IMAGEFILE or BOOT_IMAGE=memdisk is found, treat same as end of line & end of file */
/* we backtrack to enable use of near pointers in memcmp */
if ((*pLine == '=') && ((pLine - szLine) >= 7))
{
if ((memcmp(pLine-6, "initrd=", 7) == 0) || (memcmp(pLine-10, "BOOT_IMAGE=", 11) == 0))
{
pLine -= 6; /* backup */
if (*pLine == '_') pLine -= 4;
mdsk_cfg = NULL;
break;
}
}
/* if end of this simulated line is found, skip over EOL marker then proceed to process line */ /* if end of this simulated line is found, skip over EOL marker then proceed to process line */
if (*pLine == '}') if (*pLine == '}')
{ {