sgl
view src/log.c @ 30:6242b03e7191
merged with win32 branch
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 28 Jun 2011 13:52:02 +0300 |
parents | 648f8604d2b2 |
children | 124195562f7e |
line source
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdarg.h>
4 #include "log.h"
6 void sgl_log(const char *fmt, ...)
7 {
8 va_list ap;
9 const char *logfile;
10 FILE *fp;
12 if(!(logfile = getenv("SGL_LOG")) || !(fp = fopen(logfile, "a"))) {
13 fp = stderr;
14 }
16 va_start(ap, fmt);
17 vfprintf(fp, fmt, ap);
18 va_end(ap);
20 if(fp != stderr) {
21 fclose(fp);
22 }
23 }