Hi Darrell,

As it turns out, ALL the commands which are recognized that don't have help 
string in the command table are all actually convenient aliases for other 
commands.  In the case you encountered, GET is an alias for RESTORE.

I've changed the help command's response for the future versions of simh to  1) 
not cause an exception and 2) to indicate that the command you are seeking help 
for is an alias and then provide the help string for the aliased command and 
finally 3) if no alias help is available, then report that no help is available.

Thanks for this bug report.

The latest source code is available at: 
https://github.com/simh/simh/archive/master.zip


-        Mark Pizzolato

From: [email protected] [mailto:[email protected]] On 
Behalf Of Darrell Pittman
Sent: Thursday, December 20, 2012 8:16 PM
To: [email protected]
Subject: [Simh] SIMH 3.9 problem report

Dear Mr. Supnik:

I stumbled across a small problem in the scp.c module for SIMH. I entered the 
command "help get". The help_cmd() function did a lookup for the "GET" command 
in cmd_table[], which it found, but the structure member help (a char pointer) 
for the "GET" command was a NULL pointer, which was in turn passed into 
fputs(), which tried to dereference the NULL pointer and caused an exception.

I took the liberty of patching help_cmd() to supply a default string if help 
text is unavailable in cmd_table[]. My version of help_cmd() now reads as 
follows:

t_stat help_cmd (int32 flag, char *cptr)
{
char gbuf[CBUFSIZE];
CTAB *cmdp;

GET_SWITCHES (cptr);
if (*cptr) {
    cptr = get_glyph (cptr, gbuf, 0);
    if (*cptr)
        return SCPE_2MARG;
    if (cmdp = find_cmd (gbuf)) {
        const char* helptxt = cmdp->help ? cmdp->help : "No help available\n";  
  // <-- insert line
        fputs (helptxt, stdout);                                                
  // <-- change line
        if (sim_log)
            fputs (helptxt, sim_log);                                           
  // <-- change line
        }
    else return SCPE_ARG;
    }
else {
    fprint_help (stdout);
    if (sim_log)
        fprint_help (sim_log);
    }
return SCPE_OK;
}

Thank you for this wonderful SIMH system!

Best regards,

Darrell
_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh

Reply via email to