[Simh] consolidation of printf(...); if (sim_log) fprintf(sim_log, ...) ?

Peter Lund firefly at vax64.dk
Thu Aug 30 15:24:11 EDT 2007

The SIMH source code is full of places like this, from sim_ether.c:

    msg = "Eth: pcap_compile error: %s\r\n";
    printf(msg, errbuf);
    if (sim_log) fprintf (sim_log, msg, errbuf);

wouldn't it be nice to replace that with:

    sim_printf("Eth: pcap_compile error: %s\r\n", errbuf);

I can make a patch that will work with both C99 and pre-C99 gcc.

(Btw, why on Earth does it contain \r?  The file I/O code and/or the
terminal code in the OS will translate \n into \r\n if necessary.  The
standard in C is to only use \n...)


More information about the Simh mailing list