Annotation of hatari/src/errlog.c, revision 1.1.1.3

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: 
1.1.1.3 ! root       18: #undef USEERRLOG
        !            19: 
        !            20: 
        !            21: #ifdef USEERRLOG
1.1       root       22: static FILE *errlog;
1.1.1.3 ! root       23: #endif
1.1       root       24: 
1.1.1.2   root       25: 
                     26: /*-----------------------------------------------------------------------*/
1.1       root       27: /*
                     28:   Create error log file
                     29: */
                     30: void ErrLog_OpenFile(void)
                     31: {
                     32: #ifdef USEERRLOG
                     33:   char szString[MAX_FILENAME_LENGTH];
                     34: 
                     35:   sprintf(szString,"%s/errlog.txt",szWorkingDir);
                     36:   errlog = fopen(szString, "w");
                     37: #endif
                     38: }
                     39: 
1.1.1.2   root       40: 
                     41: /*-----------------------------------------------------------------------*/
1.1       root       42: /*
                     43:   Close error log file
                     44: */
                     45: void ErrLog_CloseFile(void)
                     46: {
                     47: #ifdef USEERRLOG
                     48:   fclose(errlog);
                     49: #endif
                     50: }
                     51: 
1.1.1.2   root       52: 
                     53: /*-----------------------------------------------------------------------*/
1.1       root       54: /*
                     55:   Output string to error log file
                     56: */
                     57: void ErrLog_File(char *format, ...)
                     58: {
                     59: #ifdef USEERRLOG
                     60:   char szBuffer[1024];
                     61:   va_list argptr;
                     62: 
                     63:   va_start(argptr, format);
                     64:   vsprintf(szBuffer, format, argptr);
                     65:   va_end(argptr);
                     66: 
                     67:   fwrite(szBuffer, sizeof(char), strlen(szBuffer), errlog);
                     68: #endif
                     69: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.