From 0e5bbc4e13fff6596c1c76eda4114e136b898008 Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Mon, 17 Feb 2014 13:07:03 +0100 Subject: [PATCH] Opt: Implemented OPT_UINT. --- ucw/opt.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ucw/opt.h b/ucw/opt.h index 98937777..392aabfb 100644 --- a/ucw/opt.h +++ b/ucw/opt.h @@ -3,6 +3,7 @@ * * (c) 2013 Jan Moskyto Matejka * (c) 2014 Martin Mares + * (c) 2014 Pavel Charvat * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -170,6 +171,9 @@ struct opt_item { /** Ordinary integer option. @target should be a variable of type `int`. **/ #define OPT_INT(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, int *), .help = desc, .flags = fl, .cls = OPT_CL_STATIC, .type = CT_INT } +/** Unsigned integer option. @target should be a variable of type `uint`. **/ +#define OPT_UINT(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, int *), .help = desc, .flags = fl, .cls = OPT_CL_STATIC, .type = CT_INT } + /** 64-bit integer option. @target should be a variable of type `u64`. **/ #define OPT_U64(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, u64 *), .help = desc, .flags = fl, .cls = OPT_CL_STATIC, .type = CT_U64 } @@ -185,6 +189,9 @@ struct opt_item { /** Multi-valued integer option. @target should be a growing array of `int`s. **/ #define OPT_INT_MULTIPLE(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, int **), .help = desc, .flags = fl, .cls = OPT_CL_MULTIPLE, .type = CT_INT } +/** Multi-valued unsigned integer option. @target should be a growing array of `uint`s. **/ +#define OPT_UINT_MULTIPLE(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, uint **), .help = desc, .flags = fl, .cls = OPT_CL_MULTIPLE, .type = CT_INT } + /** Multi-valued 64-bit integer option. @target should be a growing array of `u64`s. **/ #define OPT_U64_MULTIPLE(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, u64 **), .help = desc, .flags = fl, .cls = OPT_CL_MULTIPLE, .type = CT_U64 } -- 2.39.5