#ifndef PING_CLI_OPT_H #define PING_CLI_OPT_H #define CLI_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( \ 'q', \ "quiet", \ no_argument, \ cli_handle_quiet, \ OPT_ARG_NONE, \ "Quiet mode (only show summary)" \ ) \ X( \ 'c', \ "count", \ required_argument, \ cli_handle_count, \ OPT_ARG_UINT, \ "Stop after sending N packets" \ ) \ X( \ 'i', \ "interval", \ required_argument, \ cli_handle_interval, \ OPT_ARG_SECONDS, \ "Wait N seconds between packets" \ ) \ X( \ 't', \ "ttl", \ required_argument, \ cli_handle_ttl, \ OPT_ARG_TTL, \ "Set Time To Live" \ ) \ X( \ 's', \ "size", \ required_argument, \ cli_handle_size, \ OPT_ARG_BYTES, \ "Packet size in bytes" \ ) \ X( \ 'W', \ "timeout", \ required_argument, \ cli_handle_timeout, \ OPT_ARG_SECONDS, \ "Timeout for replies in seconds" \ ) \ X( \ 'f', \ "flood", \ no_argument, \ cli_handle_flood, \ OPT_ARG_NONE, \ "Flood mode" \ ) #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)))) #define CLI_OPT_STR_LEN (0 CLI_OPTIONS_LIST) #endif