From ed6f70753a49e62807bb0d8f5765c9075eacf55a Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Thu, 31 Mar 2022 13:17:02 -0800 Subject: tinyrad: adding --dry-run option --- src/tru/tinyradutil.c | 5 +++++ src/tru/tinyradutil.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tru/tinyradutil.c b/src/tru/tinyradutil.c index b07492a..ec627d7 100644 --- a/src/tru/tinyradutil.c +++ b/src/tru/tinyradutil.c @@ -460,6 +460,10 @@ tru_getopt( }; return(TRU_GETOPT_MATCHED); + case 'n': + cnf->opts |= TRU_OPT_DRY_RUN; + return(TRU_GETOPT_MATCHED); + case 'q': cnf->opts |= TRUTILS_OPT_QUIET; cnf->opts &= ~TRUTILS_OPT_VERBOSE; @@ -529,6 +533,7 @@ tru_usage_options( if ((strchr(s, 'H'))) printf(" -H uri RADIUS URI\n"); if ((strchr(s, 'h'))) printf(" -h, --help print this help and exit\n"); if ((strchr(s, 'I'))) printf(" -I path add path to dictionary search paths\n"); + if ((strchr(s, 'n'))) printf(" -n, --dry-run generate request without transmitting request\n"); if ((strchr(s, 'q'))) printf(" -q, --quiet, --silent do not print messages\n"); if ((strchr(s, 'r'))) printf(" -r, --resolve resolve URLs\n"); if ((strchr(s, 'V'))) printf(" -V, --version print version number and exit\n"); diff --git a/src/tru/tinyradutil.h b/src/tru/tinyradutil.h index 156a07e..6bfda50 100644 --- a/src/tru/tinyradutil.h +++ b/src/tru/tinyradutil.h @@ -77,6 +77,7 @@ #define TRU_OPT_RESOLVE 0x0001 +#define TRU_OPT_DRY_RUN 0x0002 #define TRU_COMMON_SHORT "d:hqVv" @@ -101,8 +102,9 @@ { "ipv6", no_argument, NULL, '6' }, \ -#define TRU_REQ_SHORT "f:" +#define TRU_REQ_SHORT "f:n" #define TRU_REQ_LONG \ + { "dry-run", no_argument, NULL, 'n' }, \ { "file", optional_argument, NULL, 'f' }, \ -- cgit v1.2.3