|
|
1.1 root 1: /* 1.1.1.4 ! root 2: Hatari - errlog.c 1.1 root 3: 1.1.1.4 ! root 4: This file is distributed under the GNU Public License, version 2 or at ! 5: your option any later version. Read the file gpl.txt for details. 1.1 root 6: 1.1.1.4 ! root 7: Error Log file. ! 8: ! 9: When Hatari runs, it outputs text to the error log file to show if the system ! 10: initialised correctly and such like. 1.1 root 11: */ 1.1.1.4 ! root 12: char ErrLog_rcsid[] = "Hatari $Id: errlog.c,v 1.5 2004/04/19 08:53:33 thothy Exp $"; 1.1 root 13: 14: #include <stdio.h> 15: #include <stdarg.h> 16: 17: #include "main.h" 18: #include "debug.h" 1.1.1.4 ! root 19: #include "errlog.h" 1.1 root 20: 21: 1.1.1.3 root 22: #undef USEERRLOG 23: 24: 25: #ifdef USEERRLOG 1.1 root 26: static FILE *errlog; 1.1.1.3 root 27: #endif 1.1 root 28: 1.1.1.2 root 29: 30: /*-----------------------------------------------------------------------*/ 1.1 root 31: /* 32: Create error log file 33: */ 34: void ErrLog_OpenFile(void) 35: { 36: #ifdef USEERRLOG 1.1.1.4 ! root 37: char szString[FILENAME_MAX]; 1.1 root 38: 39: sprintf(szString,"%s/errlog.txt",szWorkingDir); 40: errlog = fopen(szString, "w"); 41: #endif 42: } 43: 1.1.1.2 root 44: 45: /*-----------------------------------------------------------------------*/ 1.1 root 46: /* 47: Close error log file 48: */ 49: void ErrLog_CloseFile(void) 50: { 51: #ifdef USEERRLOG 52: fclose(errlog); 53: #endif 54: } 55: 1.1.1.2 root 56: 57: /*-----------------------------------------------------------------------*/ 1.1 root 58: /* 59: Output string to error log file 60: */ 61: void ErrLog_File(char *format, ...) 62: { 63: #ifdef USEERRLOG 64: char szBuffer[1024]; 65: va_list argptr; 66: 67: va_start(argptr, format); 68: vsprintf(szBuffer, format, argptr); 69: va_end(argptr); 70: 71: fwrite(szBuffer, sizeof(char), strlen(szBuffer), errlog); 72: #endif 73: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.