|
|
1.1 ! root 1: /* ! 2: Hatari ! 3: ! 4: Error Log file ! 5: ! 6: When Hatari runs, it outputs text to the error log file to show if the system initialised ! 7: correctly. Using this file output we can also list which video modes are present under ! 8: DirectDraw and such like. ! 9: */ ! 10: ! 11: #include <stdio.h> ! 12: #include <stdarg.h> ! 13: ! 14: #include "main.h" ! 15: #include "debug.h" ! 16: ! 17: /*#define USEERRLOG*/ ! 18: ! 19: static FILE *errlog; ! 20: ! 21: //----------------------------------------------------------------------- ! 22: /* ! 23: Create error log file ! 24: */ ! 25: void ErrLog_OpenFile(void) ! 26: { ! 27: #ifdef USEERRLOG ! 28: char szString[MAX_FILENAME_LENGTH]; ! 29: ! 30: sprintf(szString,"%s/errlog.txt",szWorkingDir); ! 31: errlog = fopen(szString, "w"); ! 32: #endif ! 33: } ! 34: ! 35: //----------------------------------------------------------------------- ! 36: /* ! 37: Close error log file ! 38: */ ! 39: void ErrLog_CloseFile(void) ! 40: { ! 41: #ifdef USEERRLOG ! 42: fclose(errlog); ! 43: #endif ! 44: } ! 45: ! 46: //----------------------------------------------------------------------- ! 47: /* ! 48: Output string to error log file ! 49: */ ! 50: void ErrLog_File(char *format, ...) ! 51: { ! 52: #ifdef USEERRLOG ! 53: char szBuffer[1024]; ! 54: va_list argptr; ! 55: ! 56: va_start(argptr, format); ! 57: vsprintf(szBuffer, format, argptr); ! 58: va_end(argptr); ! 59: ! 60: fwrite(szBuffer, sizeof(char), strlen(szBuffer), errlog); ! 61: #endif ! 62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.