65 lines
1.2 KiB
C
65 lines
1.2 KiB
C
#ifndef TRACEROUTE_CLI_OPT_H
|
|
#define TRACEROUTE_CLI_OPT_H
|
|
|
|
#include <getopt.h>
|
|
#include "cli.h"
|
|
|
|
enum {
|
|
OPT_TR_ARG_HOPS = OPT_ARG_STRING + 1,
|
|
OPT_TR_ARG_SECONDS,
|
|
};
|
|
|
|
#define TRACEROUTE_OPTIONS_LIST \
|
|
X( \
|
|
'h', \
|
|
"help", \
|
|
no_argument, \
|
|
cli_handle_help, \
|
|
OPT_ARG_NONE, \
|
|
"Display this help and exit" \
|
|
) \
|
|
X( \
|
|
'V', \
|
|
"version", \
|
|
no_argument, \
|
|
cli_handle_version, \
|
|
OPT_ARG_NONE, \
|
|
"Display version information and exit" \
|
|
) \
|
|
X( \
|
|
'v', \
|
|
"verbose", \
|
|
no_argument, \
|
|
cli_handle_verbose, \
|
|
OPT_ARG_NONE, \
|
|
"Verbose output" \
|
|
) \
|
|
X( \
|
|
'm', \
|
|
"max-ttl", \
|
|
required_argument, \
|
|
cli_handle_max_ttl, \
|
|
OPT_TR_ARG_HOPS, \
|
|
"Set the max number of hops" \
|
|
) \
|
|
X( \
|
|
'w', \
|
|
"waittime", \
|
|
required_argument, \
|
|
cli_handle_waittime, \
|
|
OPT_TR_ARG_SECONDS, \
|
|
"Set the time to wait for a response" \
|
|
)
|
|
|
|
#undef X
|
|
#define X(short_opt, long_opt, has_arg, handler, arg_type, desc) + 1
|
|
enum { TR_OPT_LEN = (0 TRACEROUTE_OPTIONS_LIST) };
|
|
|
|
#undef X
|
|
#define X(short_opt, long_opt, has_arg, handler, arg_type, desc) \
|
|
+ (1 * (has_arg == no_argument) \
|
|
+ (2 * (has_arg == required_argument) \
|
|
+ (3 * (has_arg == optional_argument))))
|
|
enum { TR_OPTSTR_LEN = (2 TRACEROUTE_OPTIONS_LIST) };
|
|
|
|
#endif
|