|
|
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:
1.1.1.2 ! root 21:
! 22: /*-----------------------------------------------------------------------*/
1.1 root 23: /*
24: Create error log file
25: */
26: void ErrLog_OpenFile(void)
27: {
28: #ifdef USEERRLOG
29: char szString[MAX_FILENAME_LENGTH];
30:
31: sprintf(szString,"%s/errlog.txt",szWorkingDir);
32: errlog = fopen(szString, "w");
33: #endif
34: }
35:
1.1.1.2 ! root 36:
! 37: /*-----------------------------------------------------------------------*/
1.1 root 38: /*
39: Close error log file
40: */
41: void ErrLog_CloseFile(void)
42: {
43: #ifdef USEERRLOG
44: fclose(errlog);
45: #endif
46: }
47:
1.1.1.2 ! root 48:
! 49: /*-----------------------------------------------------------------------*/
1.1 root 50: /*
51: Output string to error log file
52: */
53: void ErrLog_File(char *format, ...)
54: {
55: #ifdef USEERRLOG
56: char szBuffer[1024];
57: va_list argptr;
58:
59: va_start(argptr, format);
60: vsprintf(szBuffer, format, argptr);
61: va_end(argptr);
62:
63: fwrite(szBuffer, sizeof(char), strlen(szBuffer), errlog);
64: #endif
65: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.