made commandline fteqcc write to fteqcc.log

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2494 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2007-04-12 02:09:52 +00:00
parent 6a31083ed5
commit 834ed1c3dc

View file

@ -3364,6 +3364,28 @@ void Sys_Error(const char *text, ...)
}
#ifndef USEGUI
#include <stdarg.h>
FILE *logfile;
int logprintf(const char *format, ...)
{
va_list argptr;
static char string[1024];
va_start (argptr, format);
#ifdef _WIN32
_vsnprintf (string,sizeof(string)-1, format,argptr);
#else
vsnprintf (string,sizeof(string), format,argptr);
#endif
va_end (argptr);
puts(string);
if (logfile)
fputs(string, logfile);
return 0;
}
int main (int argc, char **argv)
{
int sucess;
@ -3376,10 +3398,13 @@ int main (int argc, char **argv)
funcs.parms->ReadFile = QCC_ReadFile;
funcs.parms->FileSize = QCC_FileSize;
funcs.parms->WriteFile = QCC_WriteFile;
funcs.parms->printf = printf;
funcs.parms->printf = logprintf;
funcs.parms->Sys_Error = Sys_Error;
logfile = fopen("fteqcc.log", "wt");
sucess = CompileParams(&funcs, true, argc, argv);
qccClearHunk();
if (logfile)
fclose(logfile);
#ifdef _WIN32
// fgetc(stdin); //wait for keypress