forked from osmocom/wireshark
extcap: add command line debug function to extcap-base.
This function is helpful to debug the interaction between the calling UI and the extcap itself. All extcaps have been changed accordingly. Change-Id: I358caf4c50797501672bf77fdd91f7276897078c Reviewed-on: https://code.wireshark.org/review/22806 Reviewed-by: Roland Knall <rknall@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
This commit is contained in:
parent
f86f54eb90
commit
963707ab3c
|
@ -2753,6 +2753,8 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
extcap_cmdline_debug(argv, argc);
|
||||
|
||||
if (extcap_conf->do_list_interfaces)
|
||||
register_interfaces(extcap_conf, adb_server_ip, adb_server_tcp_port);
|
||||
|
||||
|
|
|
@ -521,7 +521,6 @@ int main(int argc, char **argv)
|
|||
{
|
||||
int result;
|
||||
int option_idx = 0;
|
||||
int i;
|
||||
char* remote_host = NULL;
|
||||
guint16 remote_port = 22;
|
||||
char* remote_username = NULL;
|
||||
|
@ -580,9 +579,6 @@ int main(int argc, char **argv)
|
|||
goto end;
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
g_debug("%s ", argv[i]);
|
||||
|
||||
while ((result = getopt_long(argc, argv, ":", longopts, &option_idx)) != -1) {
|
||||
|
||||
switch (result) {
|
||||
|
@ -660,6 +656,8 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
extcap_cmdline_debug(argv, argc);
|
||||
|
||||
if (optind != argc) {
|
||||
g_warning("Unexpected extra option: %s", argv[optind]);
|
||||
goto end;
|
||||
|
|
|
@ -332,6 +332,16 @@ void extcap_help_add_header(extcap_parameters * extcap, char * help_header)
|
|||
extcap_help_add_option(extcap, "--debug", "print additional messages");
|
||||
}
|
||||
|
||||
void extcap_cmdline_debug(char** ar, const unsigned n)
|
||||
{
|
||||
GString* cmdline = g_string_new("cmdline: ");
|
||||
unsigned i;
|
||||
for (i = 0; i < n; i++)
|
||||
g_string_append_printf(cmdline, "%s ", ar[i]);
|
||||
g_debug("%s", cmdline->str);
|
||||
g_string_free(cmdline, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -105,7 +105,7 @@ void extcap_base_cleanup(extcap_parameters ** extcap);
|
|||
void extcap_help_add_header(extcap_parameters * extcap, char * help_header);
|
||||
void extcap_help_add_option(extcap_parameters * extcap, const char * help_option_name, const char * help_optionn_desc);
|
||||
void extcap_help_print(extcap_parameters * extcap);
|
||||
|
||||
void extcap_cmdline_debug(char** ar, const unsigned n);
|
||||
void extcap_base_help(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -136,7 +136,6 @@ int main(int argc, char *argv[])
|
|||
int produce_type = -1;
|
||||
randpkt_example *example;
|
||||
wtap_dumper* savedump;
|
||||
int i;
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -180,9 +179,6 @@ int main(int argc, char *argv[])
|
|||
attach_parent_console();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
g_debug("%s ", argv[i]);
|
||||
|
||||
while ((result = getopt_long(argc, argv, ":", longopts, &option_idx)) != -1) {
|
||||
switch (result) {
|
||||
case OPT_VERSION:
|
||||
|
@ -242,6 +238,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
extcap_cmdline_debug(argv, argc);
|
||||
|
||||
if (optind != argc) {
|
||||
g_warning("Invalid option: %s", argv[optind]);
|
||||
goto end;
|
||||
|
|
|
@ -330,7 +330,6 @@ int main(int argc, char **argv)
|
|||
{
|
||||
int result;
|
||||
int option_idx = 0;
|
||||
int i;
|
||||
char* remote_host = NULL;
|
||||
guint16 remote_port = 22;
|
||||
char* remote_username = NULL;
|
||||
|
@ -479,8 +478,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
g_debug("%s", argv[i]);
|
||||
extcap_cmdline_debug(argv, argc);
|
||||
|
||||
if (optind != argc) {
|
||||
g_warning("Unexpected extra option: %s", argv[optind]);
|
||||
|
|
|
@ -441,6 +441,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
extcap_cmdline_debug(argv, argc);
|
||||
|
||||
if (optind != argc) {
|
||||
g_warning("Unexpected extra option: %s", argv[optind]);
|
||||
goto end;
|
||||
|
|
Loading…
Reference in New Issue