From 450767fb930e30c29edf521b24ac315cdbe02aa4 Mon Sep 17 00:00:00 2001 From: Luis Ontanon Date: Tue, 28 Aug 2007 19:07:39 +0000 Subject: [PATCH] Report loading failures to the user svn path=/trunk/; revision=22712 --- epan/oids.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/epan/oids.c b/epan/oids.c index 7e3de7fccd..8e90813321 100644 --- a/epan/oids.c +++ b/epan/oids.c @@ -191,8 +191,19 @@ static smi_module_t* smi_modules = NULL; static guint num_smi_modules = 0; static uat_t* smi_modules_uat = NULL; +static GString* smi_errors; + UAT_CSTRING_CB_DEF(smi_mod,name,smi_module_t) +static void smi_error_handler(char *path, int line, int severity, char *msg, char *tag) { + g_string_sprintfa(smi_errors,"%s:%d %d %s %s\n", + path ? path : "-", + line, severity, + tag ? tag : "-", + msg ? msg : ""); +} + + static void* smi_mod_copy_cb(void* dest, const void* orig, unsigned len _U_) { const smi_module_t* m = orig; smi_module_t* d = dest; @@ -522,8 +533,11 @@ void register_mibs(void) { smiSetPath(path_str->str); - g_string_free(path_str,TRUE); + + smi_errors = g_string_new(""); + smiSetErrorHandler(smi_error_handler); + for(i=0;ilen) { + report_failure("The following errors were found while loading the MIBS:\n%s\n\n" + "The Current Path is: %s\n" , smi_errors->str , path_str->str ); + D(1,("Errors while loading:\n%s\n",smi_errors->str)); + } + + g_string_free(path_str,TRUE); + g_string_free(smi_errors,TRUE); + for (smiModule = smiGetFirstModule(); smiModule; smiModule = smiGetNextModule(smiModule)) {