mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 18:15:13 +00:00
iodine: consolidate help() and usage()
This avoids redundancies. Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
parent
1c86bf347f
commit
2efa4dfb35
27
src/iodine.c
27
src/iodine.c
@ -15,6 +15,7 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -61,27 +62,22 @@ sighandler(int sig)
|
|||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
/* mark as no return to help some compilers to avoid warnings
|
/* mark as no return to help some compilers to avoid warnings
|
||||||
* about use of uninitialized variables */
|
* about use of uninitialized variables */
|
||||||
static void usage() __attribute__((noreturn));
|
static inline void usage(void) __attribute__((noreturn));
|
||||||
|
static inline void help(bool verbose) __attribute__((noreturn));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage() {
|
help(bool verbose) {
|
||||||
extern char *__progname;
|
|
||||||
|
|
||||||
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
|
|
||||||
"[-P password] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
|
|
||||||
"[-z context] [-F pidfile] [nameserver] topdomain\n", __progname);
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
help() {
|
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
|
|
||||||
fprintf(stderr, "iodine IP over DNS tunneling client\n");
|
fprintf(stderr, "iodine IP over DNS tunneling client\n");
|
||||||
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
|
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
|
||||||
"[-P password] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
|
"[-P password] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
|
||||||
"[-z context] [-F pidfile] [nameserver] topdomain\n", __progname);
|
"[-z context] [-F pidfile] [nameserver] topdomain\n", __progname);
|
||||||
|
|
||||||
|
if (!verbose)
|
||||||
|
exit(2);
|
||||||
|
|
||||||
fprintf(stderr, "Options to try if connection doesn't work:\n");
|
fprintf(stderr, "Options to try if connection doesn't work:\n");
|
||||||
fprintf(stderr, " -T force dns type: NULL, PRIVATE, TXT, SRV, MX, CNAME, A (default: autodetect)\n");
|
fprintf(stderr, " -T force dns type: NULL, PRIVATE, TXT, SRV, MX, CNAME, A (default: autodetect)\n");
|
||||||
fprintf(stderr, " -O force downstream encoding for -T other than NULL: Base32, Base64, Base64u,\n");
|
fprintf(stderr, " -O force downstream encoding for -T other than NULL: Base32, Base64, Base64u,\n");
|
||||||
@ -107,6 +103,11 @@ help() {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void usage(void)
|
||||||
|
{
|
||||||
|
help(false);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
version() {
|
version() {
|
||||||
|
|
||||||
@ -204,7 +205,7 @@ main(int argc, char **argv)
|
|||||||
foreground = 1;
|
foreground = 1;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
help();
|
help(true);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
|
Loading…
Reference in New Issue
Block a user