--- psiconv/trunk/lib/psiconv/error.c 2003/11/27 11:43:51 173 +++ psiconv/trunk/lib/psiconv/error.c 2004/02/04 12:19:09 196 @@ -1,6 +1,6 @@ /* error.c - Part of psiconv, a PSION 5 file formats converter - Copyright (c) 1999, 2000 Frodo Looijaard + Copyright (c) 1999-2004 Frodo Looijaard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,6 @@ #include #include "error.h" -#include "config.h" #ifdef DMALLOC #include @@ -60,6 +59,28 @@ exit(1); } +void psiconv_error(psiconv_config config, int level, psiconv_u32 off, + const char *format,...) +{ + char buffer[MAX_MESSAGE]; + va_list ap; + size_t curlen; + + va_start(ap,format); + + if (config->verbosity >= PSICONV_VERB_ERROR) { + snprintf(buffer,MAX_MESSAGE,"ERROR (offset %08x): ",off); + curlen = strlen(buffer); + + vsnprintf(buffer+curlen,MAX_MESSAGE-curlen,format,ap); + if (config->error_handler) + config->error_handler(PSICONV_VERB_ERROR,off,buffer); + else + psiconv_default_error_handler(PSICONV_VERB_ERROR,off,buffer); + } + va_end(ap); +} + void psiconv_warn(psiconv_config config, int level, psiconv_u32 off, const char *format,...) {