1
0
Fork 0

Take length in consideration before moving the echo off upwards.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4106
This commit is contained in:
Peter Veenstra 2018-05-24 18:09:21 +00:00
parent 85789a06da
commit 80740117b9

View file

@ -368,11 +368,13 @@ public:
char * extra = const_cast<char*>(section->data.c_str());
if (extra && !secure && !control->cmdline->FindExist("-noautoexec",true)) {
/* detect if "echo off" is the first line */
size_t firstline_length = strcspn(extra,"\r\n");
bool echo_off = !strncasecmp(extra,"echo off",8);
if (echo_off) extra += 8;
if (echo_off && firstline_length == 8) extra += 8;
else {
echo_off = !strncasecmp(extra,"@echo off",9);
if (echo_off) extra += 9;
if (echo_off && firstline_length == 9) extra += 9;
else echo_off = false;
}
/* if "echo off" move it to the front of autoexec.bat */