diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2017-12-19 16:27:02 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2017-12-19 16:27:02 +0100 |
commit | 81f3c49c3fc55d05e748ccc376e33eae11003b98 (patch) | |
tree | 1dd750a046ed34d556afdbc7d9638dbf35e7afb6 | |
parent | 252ab35c2e9944d87e750afc3852a487f596cbbd (diff) |
ptunnel-ng:
* option parsing fixes (usage, optional arguments, manpage)
-rw-r--r-- | src/options.c | 9 | ||||
-rw-r--r-- | src/ptunnel-ng.8 | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/options.c b/src/options.c index 89fcde8..4c749af 100644 --- a/src/options.c +++ b/src/options.c @@ -44,8 +44,8 @@ static const struct option_usage usage[] = { /** --proxy */ {"address", 1, OPT_STR, {.str = NULL}, "Set address of peer running packet forwarder. This causes\n" - "ptunnel to operate in forwarding mode - the absence of this\n" - "option causes ptunnel to operate in proxy mode.\n" + "ptunnel to operate in forwarding mode (Client) - the absence of this\n" + "option causes ptunnel to operate in proxy mode (Server).\n" }, /** --listen */ {"port", 1, OPT_DEC32, {.unum = 2222}, @@ -144,7 +144,7 @@ static const struct option_usage usage[] = { "To combine with --chroot you will have to `mount --bind /proc /chrootdir/proc`\n" }, /** --help */ - {"help", 0, OPT_STR, {.str = NULL}, "this\n"}, + {NULL, 0, OPT_STR, {.str = NULL}, "this\n"}, {NULL,0,OPT_BOOL,{.unum=0},NULL} }; @@ -287,6 +287,7 @@ static void print_long_help(unsigned index, int required_state) { static void print_short_help(unsigned index, int required_state) { const char *ob = (required_state == 0 ? "[" : ""); const char *cb = (required_state == 0 ? "]" : ""); + const char *ov = (long_options[index].has_arg != optional_argument ? " " : ""); if (usage[index].required != required_state) return; @@ -300,7 +301,7 @@ static void print_short_help(unsigned index, int required_state) { printf(" %s--%s%s", ob, long_options[index].name, cb); } else if (isalpha(long_options[index].val)) { - printf(" %s-%c <%s>%s", ob, long_options[index].val, usage[index].short_help, cb); + printf(" %s-%c%s<%s>%s", ob, long_options[index].val, ov, usage[index].short_help, cb); } else { printf(" %s--%s <%s>%s", ob, long_options[index].name, usage[index].short_help, cb); diff --git a/src/ptunnel-ng.8 b/src/ptunnel-ng.8 index 5388cfd..e7bf7d3 100644 --- a/src/ptunnel-ng.8 +++ b/src/ptunnel-ng.8 @@ -4,7 +4,7 @@ ptunnel-ng \- tunnel TCP connections over ICMP echo request/reply packets. .SH SYNOPSIS .na .B ptunnel-ng -\-p <address> \-l <port> \-r<address> \-R<port> [\-m <magic>] [\-c <connections>] [\-v <level>] [\-L <interface>] [\-o<file>] [\-s] [\-P <password>] [\-\-udp] [\-\-unprivileged] [\-d<pidfile>] [\-S] [\-u<user>] [\-g<group>] [\-C<directory>] [\-e<context>] [\-h <help>] +\-p <address> \-l <port> \-r<address> \-R<port> [\-m <magic>] [\-c <connections>] [\-v <level>] [\-L <interface>] [\-o<file>] [\-s] [\-P <password>] [\-\-udp] [\-\-unprivileged] [\-d<pidfile>] [\-S] [\-u<user>] [\-g<group>] [\-C<directory>] [\-e<context>] [\-h] .SH DESCRIPTION PingTunnel-NG is a fork from the famous PingTunnel with the aim of an improved and refactored code base and some additional features. .PP |