mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-21 22:41:26 +00:00
iodine, iodined: print intentional help to stdout
Like other unix tools: don't print application output, if the user asks intentionally for help. Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
parent
f8f87e3a54
commit
ac6db12ddb
14
src/iodine.c
14
src/iodine.c
|
@ -65,12 +65,12 @@ sighandler(int sig)
|
|||
/* mark as no return to help some compilers to avoid warnings
|
||||
* about use of uninitialized variables */
|
||||
static inline void usage(void) __attribute__((noreturn));
|
||||
static inline void help(bool verbose) __attribute__((noreturn));
|
||||
static inline void help(FILE * stream, bool verbose) __attribute__((noreturn));
|
||||
#endif
|
||||
|
||||
static void
|
||||
help(bool verbose) {
|
||||
fprintf(stderr, "iodine IP over DNS tunneling client\n\n"
|
||||
static void help(FILE *stream, bool verbose)
|
||||
{
|
||||
fprintf(stream, "iodine IP over DNS tunneling client\n\n"
|
||||
"Usage: %s [-46fhrv] [-u user] [-t chrootdir] [-d device] [-P password]\n"
|
||||
" [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec]\n"
|
||||
" [-z context] [-F pidfile] [nameserver] topdomain\n", __progname);
|
||||
|
@ -78,7 +78,7 @@ help(bool verbose) {
|
|||
if (!verbose)
|
||||
exit(2);
|
||||
|
||||
fprintf(stderr, "\nOptions to try if connection doesn't work:\n"
|
||||
fprintf(stream, "\nOptions to try if connection doesn't work:\n"
|
||||
" -4 to connect only to IPv4\n"
|
||||
" -6 to connect only to IPv6\n"
|
||||
" -T force dns type: NULL, PRIVATE, TXT, SRV, MX, CNAME, A (default: autodetect)\n"
|
||||
|
@ -108,7 +108,7 @@ help(bool verbose) {
|
|||
|
||||
static inline void usage(void)
|
||||
{
|
||||
help(false);
|
||||
help(stderr, false);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -208,7 +208,7 @@ main(int argc, char **argv)
|
|||
foreground = 1;
|
||||
break;
|
||||
case 'h':
|
||||
help(true);
|
||||
help(stdout, true);
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
case 'r':
|
||||
|
|
|
@ -2288,26 +2288,26 @@ write_dns(int fd, struct query *q, char *data, int datalen, char downenc)
|
|||
sendto(fd, buf, len, 0, (struct sockaddr*)&q->from, q->fromlen);
|
||||
}
|
||||
|
||||
static void
|
||||
print_usage() {
|
||||
fprintf(stderr, "Usage: %s [-46cDfsv] [-u user] [-t chrootdir] [-d device] [-m mtu]\n"
|
||||
static void print_usage(FILE *stream)
|
||||
{
|
||||
fprintf(stream, "Usage: %s [-46cDfsv] [-u user] [-t chrootdir] [-d device] [-m mtu]\n"
|
||||
" [-z context] [-l ipv4 listen address] [-L ipv6 listen address]\n"
|
||||
" [-p port] [-n external ip] [-b dnsport] [-P password]\n"
|
||||
" [-F pidfile] [-i max idle time] tunnel_ip[/netmask] topdomain\n",
|
||||
__progname);
|
||||
}
|
||||
|
||||
static void
|
||||
usage() {
|
||||
print_usage();
|
||||
static void usage(void)
|
||||
{
|
||||
print_usage(stderr);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
static void
|
||||
help() {
|
||||
fprintf(stderr, "iodine IP over DNS tunneling server\n\n");
|
||||
print_usage();
|
||||
fprintf(stderr, "\nAvailable options:\n"
|
||||
static void help(FILE *stream)
|
||||
{
|
||||
fprintf(stream, "iodine IP over DNS tunneling server\n\n");
|
||||
print_usage(stream);
|
||||
fprintf(stream, "\nAvailable options:\n"
|
||||
" -v to print version info and exit\n"
|
||||
" -h to print this help and exit\n"
|
||||
" -4 to listen only on IPv4\n"
|
||||
|
@ -2475,7 +2475,7 @@ main(int argc, char **argv)
|
|||
foreground = 1;
|
||||
break;
|
||||
case 'h':
|
||||
help();
|
||||
help(stdout);
|
||||
break;
|
||||
case 'D':
|
||||
debug++;
|
||||
|
|
Loading…
Reference in a new issue