Cleanups to make all logging functions use stdlog instead of stdout.

The new --logfile (-L) commandline option sets a file to log to.
The new --debug (-D) forces output to stderr if no logfile is given.
This commit is contained in:
waltje
2017-11-24 02:23:00 -05:00
parent d287293a75
commit ce1bab2967
20 changed files with 1547 additions and 1571 deletions

View File

@@ -9,7 +9,7 @@
* Implementation of the IDE emulation for hard disks and ATAPI
* CD-ROM devices.
*
* Version: @(#)hdc_ide.c 1.0.19 2017/11/04
* Version: @(#)hdc_ide.c 1.0.20 2017/11/24
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -109,22 +109,25 @@ int cur_ide[5];
int ide_do_log = ENABLE_IDE_LOG;
#endif
static void ide_log(const char *format, ...)
{
#ifdef ENABLE_IDE_LOG
if (ide_do_log)
{
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
fflush(stdout);
va_list ap;
va_start(ap, format);
vfprintf(stdlog, format, ap);
va_end(ap);
fflush(stdlog);
}
#endif
}
uint8_t getstat(IDE *ide) { return ide->atastat; }
int ide_drive_is_cdrom(IDE *ide)
{
if (ide->channel >= 8)

View File

@@ -8,7 +8,7 @@
*
* Handling of hard disk image files.
*
* Version: @(#)hdd_image.c 1.0.7 2017/11/01
* Version: @(#)hdd_image.c 1.0.8 2017/11/24
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -53,16 +53,18 @@ static char *empty_sector_1mb;
int hdd_image_do_log = ENABLE_HDD_LOG;
#endif
void hdd_image_log(const char *format, ...)
static void
hdd_image_log(const char *format, ...)
{
#ifdef ENABLE_HDD_LOG
if (hdd_image_do_log)
{
va_list ap;
va_start(ap, format);
vprintf(format, ap);
vfprintf(stdlog, format, ap);
va_end(ap);
fflush(stdout);
fflush(stdlog);
}
#endif
}