ft_ssl/includes/internal/cli/option.h
2026-04-29 21:25:56 +02:00

68 lines
1.3 KiB
C

#ifndef FT_SSL_OPT_H
#define FT_SSL_OPT_H
#include <cli.h>
#define FT_SSL_OPTION_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( \
'p', \
"stdin", \
no_argument, \
cli_handle_p, \
OPT_ARG_NONE, \
"Echo stdin to stdout and append checksum to output" \
) \
X( \
'q', \
"quiet", \
no_argument, \
cli_handle_q, \
OPT_ARG_NONE, \
"Quiet mode: only print the digest" \
) \
X( \
'r', \
"reverse", \
no_argument, \
cli_handle_r, \
OPT_ARG_NONE, \
"Reverse the output format (digest then filename)" \
) \
X( \
's', \
"string", \
required_argument, \
cli_handle_s, \
OPT_ARG_STRING, \
"Hash a string" \
)
#undef X
#define X(short_opt, long_opt, has_arg, handler, arg_type, desc) + 1
enum { FT_SSL_OPT_LEN = (0 FT_SSL_OPTION_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 { FT_SSL_OPTSTR_LEN = (2 FT_SSL_OPTION_LIST) };
/* +2 for ':' to disable getopt error messages and \0 */
#endif