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