VOGONS


First post, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Executing DOS commands generates a debug log message such as "EXEC:Parsing command line: blah". When a program shells out to COMMAND.COM to execute a command, a blank line is sometimes displayed in the debugger output view instead of the message; however, the message is always written to the log file if one is active. The blank line is displayed when a trailing carriage return is copied from the command line of COMMAND.COM into a message buffer. The trailing CR isn't always used by DOS programs, but for those cases where it is used, replacing it with a terminator in debug_gui.cpp corrects the problem:

void LOG::operator() (char const* format, ...){
char buf[512];
va_list msg;
va_start(msg,format);
vsprintf(buf,format,msg);
va_end(msg);

+ /* Remove carriage return if present */
+ Bitu len=strlen(buf);
+ if (buf[len-1]=='\r') buf[len-1]='\0';

if (d_type>=LOG_MAX) return;
if ((d_severity!=LOG_ERROR) && (!loggrp[d_type].enabled)) return;
DEBUG_ShowMsg("%10u: %s:%s\n",cycle_count,loggrp[d_type].front,buf);
}

Reply 1 of 1, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Looked into what trim() does, and logging the command string after it's been cleaned up seems more targetted to the source of the problem:

void DOS_Shell::ParseLine(char * line) {
- LOG(LOG_EXEC,LOG_ERROR)("Parsing command line: %s",line);
/* Check for a leading @ */
if (line[0] == '@') line[0] = ' ';
line = trim(line);
+ LOG(LOG_EXEC,LOG_ERROR)("Parsing command line: %s",line);

/* Do redirection and pipe checks */