summaryrefslogtreecommitdiff
path: root/extcap/ciscodump.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-08-02 15:13:13 +0200
committerRoland Knall <rknall@gmail.com>2016-08-04 14:13:53 +0000
commita671bab3373101ce593c78ee1af476719f357028 (patch)
tree0c743bb3f79740d9b5bdd6d5f8889e87ca2721f7 /extcap/ciscodump.c
parent7e08f158851910954cbd9d038912a6e46b633cbe (diff)
downloadwireshark-a671bab3373101ce593c78ee1af476719f357028.tar.gz
extcap: restyle the help function.
Change-Id: Ia742dffb1fd4cd5780b8ba44f7064d1874e473da Reviewed-on: https://code.wireshark.org/review/16842 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'extcap/ciscodump.c')
-rw-r--r--extcap/ciscodump.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c
index e360795c8c..d8aba54190 100644
--- a/extcap/ciscodump.c
+++ b/extcap/ciscodump.c
@@ -469,37 +469,6 @@ cleanup:
return ret;
}
-static void help(const char* binname)
-{
- printf("Help\n");
- printf(" Usage:\n");
- printf(" %s --extcap-interfaces\n", binname);
- printf(" %s --extcap-interface=INTERFACE --extcap-dlts\n", binname);
- printf(" %s --extcap-interface=INTERFACE --extcap-config\n", binname);
- printf(" %s --extcap-interface=INTERFACE --remote-host myhost --remote-port 22222 "
- "--remote-username myuser --remote-interface gigabit0/0 "
- "--fifo=FILENAME --capture\n", binname);
- printf("\n\n");
- printf(" --help: print this help\n");
- printf(" --version: print the version\n");
- printf(" --verbose: print more messages\n");
- printf(" --extcap-interfaces: list the interfaces\n");
- printf(" --extcap-interface <iface>: specify the interface\n");
- printf(" --extcap-dlts: list the DTLs for an interface\n");
- printf(" --extcap-config: list the additional configuration for an interface\n");
- printf(" --extcap-capture-filter <filter>: the capture filter\n");
- printf(" --capture: run the capture\n");
- printf(" --fifo <file>: dump data to file or fifo\n");
- printf(" --remote-host <host>: the remote SSH host\n");
- printf(" --remote-port <port>: the remote SSH port (default: 22)\n");
- printf(" --remote-username <username>: the remote SSH username (default: the current user)\n");
- printf(" --remote-password <password>: the remote SSH password. If not specified, ssh-agent and ssh-key are used\n");
- printf(" --sshkey <public key path>: the path of the ssh key\n");
- printf(" --sshkey-passphrase <public key passphrase>: the passphrase to unlock public ssh\n");
- printf(" --remote-interface <iface>: the remote capture interface\n");
- printf(" --remote-filter <filter>: a filter for remote capture (default: don't capture data for local interfaces IPs)\n");
-}
-
static int list_config(char *interface, unsigned int remote_port)
{
unsigned inc = 0;
@@ -568,6 +537,7 @@ int main(int argc, char **argv)
unsigned long int count = 0;
int ret = EXIT_FAILURE;
extcap_parameters * extcap_conf = g_new0(extcap_parameters, 1);
+ char* help_header = NULL;
#ifdef _WIN32
WSADATA wsaData;
@@ -578,11 +548,35 @@ int main(int argc, char **argv)
extcap_base_set_util_info(extcap_conf, 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(
+ " %s --extcap-interfaces\n"
+ " %s --extcap-interface=INTERFACE --extcap-dlts\n"
+ " %s --extcap-interface=INTERFACE --extcap-config\n"
+ " %s --extcap-interface=INTERFACE --remote-host myhost --remote-port 22222 "
+ "--remote-username myuser --remote-interface gigabit0/0 "
+ "--fifo=FILENAME --capture\n", argv[0], argv[0], argv[0], argv[0]);
+ extcap_help_add_header(extcap_conf, help_header);
+ g_free(help_header);
+
+ extcap_help_add_option(extcap_conf, "--help", "print this help");
+ extcap_help_add_option(extcap_conf, "--version", "print the version");
+ extcap_help_add_option(extcap_conf, "--verbose", "print more messages");
+ extcap_help_add_option(extcap_conf, "--remote-host <host>", "the remote SSH host");
+ extcap_help_add_option(extcap_conf, "--remote-port <port>", "the remote SSH port (default: 22)");
+ extcap_help_add_option(extcap_conf, "--remote-username <username>", "the remote SSH username (default: the current user)");
+ extcap_help_add_option(extcap_conf, "--remote-password <password>", "the remote SSH password. "
+ "If not specified, ssh-agent and ssh-key are used");
+ extcap_help_add_option(extcap_conf, "--sshkey <public key path>", "the path of the ssh key");
+ extcap_help_add_option(extcap_conf, "--sshkey-passphrase <public key passphrase>", "the passphrase to unlock public ssh");
+ extcap_help_add_option(extcap_conf, "--remote-interface <iface>", "the remote capture interface");
+ extcap_help_add_option(extcap_conf, "--remote-filter <filter>", "a filter for remote capture "
+ "(default: don't capture data for lal interfaces IPs)");
+
opterr = 0;
optind = 0;
if (argc == 1) {
- help(argv[0]);
+ extcap_help_print(extcap_conf);
goto end;
}
@@ -594,7 +588,7 @@ int main(int argc, char **argv)
switch (result) {
case OPT_HELP:
- help(argv[0]);
+ extcap_help_print(extcap_conf);
ret = EXIT_SUCCESS;
goto end;