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

Toby Thain toby at smartgames.ca
Thu Aug 30 15:36:57 EDT 2007


On 30-Aug-07, at 4:24 PM, Peter Lund wrote:

> 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);
>     ...

Amen.

--Toby

>
> 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...)
>
> -Peter
>
>
> _______________________________________________
> Simh mailing list
> Simh at trailing-edge.com
> http://mailman.trailing-edge.com/mailman/listinfo/simh




More information about the Simh mailing list