diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2007-05-25 17:22:32 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2007-05-25 17:22:32 +0000 |
commit | 11f06217ced22efb25ff4157216622ea24da7cab (patch) | |
tree | 2ff6203726b046cb044b2ba9f79980fd79fea61d /capinfos.c | |
parent | c22f70ec1be27d319953eaa4e37e73fec6810d42 (diff) | |
download | wireshark-11f06217ced22efb25ff4157216622ea24da7cab.tar.gz wireshark-11f06217ced22efb25ff4157216622ea24da7cab.tar.bz2 wireshark-11f06217ced22efb25ff4157216622ea24da7cab.zip |
Have editcap and capinfos loading the wiretap plugins.
epan/filesystem.c
have get_plugin_dir() calling init_plugin_dir() if necessary
epan/epan.c and epan/report_err.c
move the report_failure family into the new report_err.c file, have epan_init() calling the initializer
epan/plugins.h and epan/proto.c
do not have init_plugins() calling the proto_reg functions instead do it in init_proto()
gtk/main.c and tshark.c
init_plugin_dir() has become suprefluous
capinfos.c and editcap.c
load the wiretap plugins
Makefiles
do what's needed to build withe the above changes.
svn path=/trunk/; revision=21935
Diffstat (limited to 'capinfos.c')
-rw-r--r-- | capinfos.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/capinfos.c b/capinfos.c index 1b6ff6a6bb..bda6ea6faa 100644 --- a/capinfos.c +++ b/capinfos.c @@ -31,6 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdarg.h> #include <errno.h> #ifdef HAVE_UNISTD_H @@ -44,6 +45,9 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/filesystem.h> +#include <epan/plugins.h> +#include <epan/report_err.h> #include "wtap.h" #ifdef NEED_GETOPT_H @@ -247,6 +251,18 @@ static void usage(gboolean is_error) fprintf(output, "If no options are given, default is to display all infos\n"); } +/* + * Errors are reported with a console message. + */ +static void +failure_message(const char *msg_format, va_list ap) +{ + fprintf(stderr, "capinos: "); + vfprintf(stderr, msg_format, ap); + fprintf(stderr, "\n"); +} + + int main(int argc, char *argv[]) { wtap *wth; @@ -256,8 +272,20 @@ int main(int argc, char *argv[]) extern int optind; int opt; int status = 0; - - /* Process the options first */ + char* init_progfile_dir_error; + + /* Register wiretap plugins */ + + if ((init_progfile_dir_error = init_progfile_dir(argv[0]))) { + g_warning("capinfos: init_progfile_dir(): %s", init_progfile_dir_error); + g_free(init_progfile_dir_error); + } else { + init_report_err(failure_message,NULL,NULL); + init_plugins(); + register_all_wiretap_modules(); + } + + /* Process the options */ while ((opt = getopt(argc, argv, "tcsduaeyizvh")) !=-1) { |