--- freem/src/fma_journals.c 2025/04/13 04:22:43 1.5 +++ freem/src/fma_journals.c 2025/04/17 14:34:27 1.6 @@ -1,5 +1,5 @@ /* - * $Id: fma_journals.c,v 1.5 2025/04/13 04:22:43 snw Exp $ + * $Id: fma_journals.c,v 1.6 2025/04/17 14:34:27 snw Exp $ * Journal utilities for fmadm * * @@ -24,6 +24,9 @@ * along with FreeM. If not, see . * * $Log: fma_journals.c,v $ + * Revision 1.6 2025/04/17 14:34:27 snw + * Further logging improvements + * * Revision 1.5 2025/04/13 04:22:43 snw * Fix snprintf calls * @@ -52,6 +55,7 @@ #include "fmadm.h" #include "jnldefs.h" +#include "log.h" void cvt_key (char *buf, char *key); extern short ierr; @@ -74,15 +78,11 @@ int fma_journals_examine (int optc, char jnl_ent_t ent; if ((fd = open (fma_journal_path, O_RDONLY)) == -1) { - fprintf (stderr, "fmadm: error %d opening journal file %s (%s)\n", errno, fma_journal_path, strerror (errno)); - - exit (2); + logprintf (FM_LOG_FATAL, "fmadm: error opening journal file %s (error code %ld [%s])",fma_journal_path, errno, strerror (errno)); } if (read (fd, &hdr, sizeof (jnl_hdr_t)) == -1) { - fprintf (stderr, "fmadm: error %d reading header from journal file %s (%s)\n", errno, fma_journal_path, strerror (errno)); - - exit (3); + logprintf (FM_LOG_FATAL, "fmadm: error reading header from journal file %s (error code %ld [%s])", errno, fma_journal_path, strerror (errno)); } printf ("\nFreeM Journal Dump\n"); @@ -170,17 +170,13 @@ int fma_journals_restore (int optc, char jnl_hdr_t hdr; jnl_ent_t ent; - + if ((fd = open (fma_journal_path, O_RDONLY)) == -1) { - fprintf (stderr, "error: error %d opening journal file %s\n", errno, fma_journal_path); - - exit (2); + logprintf (FM_LOG_FATAL, "fmadm: error opening journal file %s (error code %ld [%s])",fma_journal_path, errno, strerror (errno)); } if (read (fd, &hdr, sizeof (jnl_hdr_t)) == -1) { - fprintf (stderr, "error: error %d reading header from journal file %s\n", errno, fma_journal_path); - - exit (3); + logprintf (FM_LOG_FATAL, "fmadm: error reading header from journal file %s (error code %ld [%s])", errno, fma_journal_path, strerror (errno)); } printf ("\nFreeM Journal Playback\n");