diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-19 19:21:11 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-20 02:21:58 +0000 |
commit | 347a19ae9629ad06ab597a176672c9098c9af64a (patch) | |
tree | 859f885bc1280b9e920033562a87b251e84ecf56 /rawshark.c | |
parent | 9e8bc9fee87c99944bfe52e27498d759e7235701 (diff) |
Add common routines for command-line libwiretap error reporting.
These are similar to the routines added to ui/alert_box.c for dialog-box
libwiretap error reporting.
This centralizes the knowledge about what to say for various libwiretap
errors, removing some duplicate code, and giving more details in some
programs.
Change-Id: I737405c4edaa0e6c27840f78a8c587a8b3ee120b
Reviewed-on: https://code.wireshark.org/review/21234
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'rawshark.c')
-rw-r--r-- | rawshark.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/rawshark.c b/rawshark.c index 0476223095..bcb2f8ca5d 100644 --- a/rawshark.c +++ b/rawshark.c @@ -82,6 +82,7 @@ #endif #include "ui/util.h" #include "ui/dissect_opts.h" +#include "ui/failure_message.h" #include "register.h" #include "conditions.h" #include "capture_stop_conditions.h" @@ -983,39 +984,7 @@ load_cap_file(capture_file *cf) g_free(pd); if (err != 0) { /* Print a message noting that the read failed somewhere along the line. */ - switch (err) { - - case WTAP_ERR_UNSUPPORTED: - cmdarg_err("The file \"%s\" contains record data that Rawshark doesn't support.\n(%s)", - cf->filename, - err_info != NULL ? err_info : "no information supplied"); - g_free(err_info); - break; - - case WTAP_ERR_SHORT_READ: - cmdarg_err("The file \"%s\" appears to have been cut short in the middle of a packet.", - cf->filename); - break; - - case WTAP_ERR_BAD_FILE: - cmdarg_err("The file \"%s\" appears to be damaged or corrupt.\n(%s)", - cf->filename, - err_info != NULL ? err_info : "no information supplied"); - g_free(err_info); - break; - - case WTAP_ERR_DECOMPRESS: - cmdarg_err("The compressed file \"%s\" appears to be damaged or corrupt.\n(%s)", - cf->filename, - err_info != NULL ? err_info : "no information supplied"); - g_free(err_info); - break; - - default: - cmdarg_err("An error occurred while reading the file \"%s\": %s.", - cf->filename, wtap_strerror(err)); - break; - } + cfile_read_failure_message("Rawshark", cf->filename, err, err_info); return FALSE; } |