diff options
author | Dario Lombardo <lomato@gmail.com> | 2016-08-24 15:10:51 +0200 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2016-08-25 12:29:49 +0000 |
commit | f597234785f8e4ddf1cf9f7c5d6f5fbacd9631bf (patch) | |
tree | 7bc2c9390e864ed598d7a86224dd4b0fef2a77bb | |
parent | c661da414d5ddb506e0c23d3169cff45b6211398 (diff) |
extcap: add binary name and version to help message.
Change-Id: I8f8083c817065cf66fd006a1caeb309d26209509
Reviewed-on: https://code.wireshark.org/review/17305
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
-rw-r--r-- | extcap/androiddump.c | 3 | ||||
-rw-r--r-- | extcap/ciscodump.c | 3 | ||||
-rw-r--r-- | extcap/extcap-base.c | 8 | ||||
-rw-r--r-- | extcap/extcap-base.h | 3 | ||||
-rw-r--r-- | extcap/randpktdump.c | 3 | ||||
-rw-r--r-- | extcap/sshdump.c | 3 |
6 files changed, 16 insertions, 7 deletions
diff --git a/extcap/androiddump.c b/extcap/androiddump.c index 9bf753d7cf..823603264c 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -2520,7 +2520,8 @@ int main(int argc, char **argv) { extcap_conf = g_new0(extcap_parameters, 1); - extcap_base_set_util_info(extcap_conf, ANDROIDDUMP_VERSION_MAJOR, ANDROIDDUMP_VERSION_MINOR, ANDROIDDUMP_VERSION_RELEASE, NULL); + extcap_base_set_util_info(extcap_conf, argv[0], ANDROIDDUMP_VERSION_MAJOR, ANDROIDDUMP_VERSION_MINOR, + ANDROIDDUMP_VERSION_RELEASE, NULL); help_header = g_strdup_printf( " %s --extcap-interfaces [--adb-server-ip=<arg>] [--adb-server-tcp-port=<arg>]\n" diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c index 6a5ab8adcc..3d5676cac1 100644 --- a/extcap/ciscodump.c +++ b/extcap/ciscodump.c @@ -537,7 +537,8 @@ int main(int argc, char **argv) attach_parent_console(); #endif /* _WIN32 */ - extcap_base_set_util_info(extcap_conf, CISCODUMP_VERSION_MAJOR, CISCODUMP_VERSION_MINOR, CISCODUMP_VERSION_RELEASE, NULL); + extcap_base_set_util_info(extcap_conf, argv[0], CISCODUMP_VERSION_MAJOR, CISCODUMP_VERSION_MINOR, + CISCODUMP_VERSION_RELEASE, NULL); extcap_base_register_interface(extcap_conf, CISCODUMP_EXTCAP_INTERFACE, "Cisco remote capture", 147, "Remote capture dependent DLT"); help_header = g_strdup_printf( diff --git a/extcap/extcap-base.c b/extcap/extcap-base.c index 3e690fec1d..ecfd8f58e6 100644 --- a/extcap/extcap-base.c +++ b/extcap/extcap-base.c @@ -129,8 +129,10 @@ void extcap_base_register_interface_ext(extcap_parameters * extcap, extcap->interfaces = g_list_append(extcap->interfaces, (gpointer) iface); } -void extcap_base_set_util_info(extcap_parameters * extcap, const char * major, const char * minor, const char * release, const char * helppage) +void extcap_base_set_util_info(extcap_parameters * extcap, const char * exename, const char * major, const char * minor, const char * release, const char * helppage) { + extcap->exename = g_path_get_basename(exename); + g_assert(major); if (!minor) g_assert(!release); @@ -277,6 +279,7 @@ void extcap_base_cleanup(extcap_parameters ** extcap) /* g_list_free_full() only exists since 2.28. g_list_free_full((*extcap)->interfaces, extcap_iface_free);*/ g_list_foreach((*extcap)->interfaces, (GFunc)extcap_iface_free, NULL); g_list_free((*extcap)->interfaces); + g_free((*extcap)->exename); g_free((*extcap)->fifo); g_free((*extcap)->interface); g_free((*extcap)->version); @@ -296,7 +299,8 @@ static void extcap_print_option(gpointer option) void extcap_help_print(extcap_parameters * extcap) { - printf("\nHelp\n\nUsage:\n"); + printf("\nWireshark - %s v%s\n\n", extcap->exename, extcap->version); + printf("Usage:\n"); printf("%s", extcap->help_header); printf("\n"); printf("Options:\n"); diff --git a/extcap/extcap-base.h b/extcap/extcap-base.h index 90aa19c1c1..fecfb4cdd8 100644 --- a/extcap/extcap-base.h +++ b/extcap/extcap-base.h @@ -101,6 +101,7 @@ typedef struct _extcap_parameters { + char * exename; char * fifo; char * interface; char * capture_filter; @@ -123,7 +124,7 @@ typedef struct _extcap_parameters void extcap_base_register_interface(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltdescription ); void extcap_base_register_interface_ext(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltname, const char * dltdescription ); -void extcap_base_set_util_info(extcap_parameters * extcap, const char * major, const char * minor, const char * release, const char * helppage); +void extcap_base_set_util_info(extcap_parameters * extcap, const char * exename, const char * major, const char * minor, const char * release, const char * helppage); uint8_t extcap_base_parse_options(extcap_parameters * extcap, int result, char * optargument); uint8_t extcap_base_handle_interface(extcap_parameters * extcap); void extcap_base_cleanup(extcap_parameters ** extcap); diff --git a/extcap/randpktdump.c b/extcap/randpktdump.c index 420caa45d6..67214395f2 100644 --- a/extcap/randpktdump.c +++ b/extcap/randpktdump.c @@ -144,7 +144,8 @@ int main(int argc, char *argv[]) extcap_parameters * extcap_conf = g_new0(extcap_parameters, 1); char* help_header = NULL; - extcap_base_set_util_info(extcap_conf, RANDPKTDUMP_VERSION_MAJOR, RANDPKTDUMP_VERSION_MINOR, RANDPKTDUMP_VERSION_RELEASE, NULL); + extcap_base_set_util_info(extcap_conf, argv[0], RANDPKTDUMP_VERSION_MAJOR, RANDPKTDUMP_VERSION_MINOR, + RANDPKTDUMP_VERSION_RELEASE, NULL); extcap_base_register_interface(extcap_conf, RANDPKT_EXTCAP_INTERFACE, "Random packet generator", 147, "Generator dependent DLT"); help_header = g_strdup_printf( diff --git a/extcap/sshdump.c b/extcap/sshdump.c index e3385c6b6d..dc4454a486 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -326,7 +326,8 @@ int main(int argc, char **argv) attach_parent_console(); #endif /* _WIN32 */ - extcap_base_set_util_info(extcap_conf, SSHDUMP_VERSION_MAJOR, SSHDUMP_VERSION_MINOR, SSHDUMP_VERSION_RELEASE, NULL); + extcap_base_set_util_info(extcap_conf, argv[0], SSHDUMP_VERSION_MAJOR, SSHDUMP_VERSION_MINOR, + SSHDUMP_VERSION_RELEASE, NULL); extcap_base_register_interface(extcap_conf, SSH_EXTCAP_INTERFACE, "SSH remote capture", 147, "Remote capture dependent DLT"); help_header = g_strdup_printf( |