From fb7e6c173cb9c121ed6af6df0a78321122d1b5b9 Mon Sep 17 00:00:00 2001 From: Ross Wilson Date: Sun, 18 Oct 2015 15:34:35 +0700 Subject: [PATCH] Initial commit --- vimlac/log.c | 33 +++++++++++++++++++++++++++++++++ vimlac/log.h | 11 +++++++++++ 2 files changed, 44 insertions(+) create mode 100644 vimlac/log.c create mode 100644 vimlac/log.h diff --git a/vimlac/log.c b/vimlac/log.c new file mode 100644 index 0000000..938dfda --- /dev/null +++ b/vimlac/log.c @@ -0,0 +1,33 @@ +/* + * Log routines for the imlac simulator. + */ + +#include +#include +#include + + +char *LogFile = "vimlac.log"; +char *LogPrefix = ""; + + +/****************************************************************************** +Description : printf()-style log routine. + Parameters : like printf() + Returns : + Comments : + ******************************************************************************/ +void +vlog(char *fmt, ...) +{ + va_list ap; + char buff[1024]; + FILE *fd; + + va_start(ap, fmt); + vsprintf(buff, fmt, ap); + fd = fopen(LogFile, "a"); + fprintf(fd, "%s: %s\n", LogPrefix, buff); + fclose(fd); + va_end(ap); +} diff --git a/vimlac/log.h b/vimlac/log.h new file mode 100644 index 0000000..5926039 --- /dev/null +++ b/vimlac/log.h @@ -0,0 +1,11 @@ +/* + * Log routines for the imlac simulation. + */ + +#ifndef LOG_H +#define LOG_H + +void vlog(char *fmt, ...); +extern char *LogPrefix; + +#endif