[Simh] [PATCH 01 of 14] Provide sim_printf_log() to write to stdout + sim_log
Peter Lund
firefly at vax64.dk
Mon Sep 10 17:09:35 EDT 2007
2 files changed, 23 insertions(+)
sim_console.c | 17 +++++++++++++++++
sim_console.h | 6 ++++++
# HG changeset patch
# User Peter Lund <firefly at vax64.dk>
# Date 1189306403 -7200
# Node ID f8cf640ba8d125df32b4bf141bece456e3545c3a
# Parent 1ff2f5942ca319cc5deee656508f0cb4fcfbade2
Provide sim_printf_log() to write to stdout + sim_log
diff -r 1ff2f5942ca3 -r f8cf640ba8d1 sim_console.c
--- a/sim_console.c Sat Sep 08 21:34:22 2007 +0200
+++ b/sim_console.c Sun Sep 09 04:53:23 2007 +0200
@@ -1092,3 +1092,20 @@ return SCPE_OK;
}
#endif
+#include <stdarg.h>
+
+void sim_printf_log(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+
+ if (sim_log) {
+ va_start(ap, fmt);
+ vfprintf(sim_log, fmt, ap);
+ va_end(ap);
+ }
+}
+
diff -r 1ff2f5942ca3 -r f8cf640ba8d1 sim_console.h
--- a/sim_console.h Sat Sep 08 21:34:22 2007 +0200
+++ b/sim_console.h Sun Sep 09 04:53:23 2007 +0200
@@ -77,5 +77,11 @@ t_stat sim_os_putchar (int32 out);
t_stat sim_os_putchar (int32 out);
int32 sim_tt_inpcvt (int32 c, uint32 mode);
int32 sim_tt_outcvt (int32 c, uint32 mode);
+
+void sim_printf_log(const char *fmt, ...)
+#ifdef __GNUC__
+ __attribute__((format (printf, 1, 2)))
+#endif
+;
#endif
More information about the Simh
mailing list