changeset 187:cf081a98dccd

Improve error output.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Jul 2018 08:12:40 +0300
parents 2f129ea15405
children 489eb428cf65
files sidinfo.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sidinfo.c	Mon Jul 09 08:10:50 2018 +0300
+++ b/sidinfo.c	Mon Jul 09 08:12:40 2018 +0300
@@ -962,7 +962,15 @@
 }
 
 
-BOOL argHandleFile(char *filename)
+void siError(th_ioctx *fh, const int err, const char *msg)
+{
+    (void) fh;
+    (void) err;
+    fprintf(stderr, "%s", msg);
+}
+
+
+BOOL argHandleFile(const char *filename)
 {
     PSIDHeader *psid = NULL;
     th_ioctx *inFile = NULL;
@@ -980,12 +988,11 @@
         goto error;
     }
 
+    th_io_set_handlers(inFile, siError, NULL);
+
     // Read PSID data
     if (!si_read_sid_file(inFile, &psid, setSLDBNewFormat))
-    {
-        THERR("Error reading %s\n", filename);
         goto error;
-    }
 
     // Get songlength information, if any
     if (sidSLDB != NULL)