diff options
author | Mattias Andrée <maandree@kth.se> | 2018-11-15 20:25:11 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-11-15 20:25:11 +0100 |
commit | 160d0327aa121e0cfe4410cf8aad541266a5f3bd (patch) | |
tree | 87e1d1a41cbff858d38eb24732f0a5d40f8dd4d3 /libsimple-arg.h | |
parent | Fix man page alias (diff) | |
download | libsimple-160d0327aa121e0cfe4410cf8aad541266a5f3bd.tar.gz libsimple-160d0327aa121e0cfe4410cf8aad541266a5f3bd.tar.bz2 libsimple-160d0327aa121e0cfe4410cf8aad541266a5f3bd.tar.xz |
libsimple-arg: add test for long options
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libsimple-arg.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libsimple-arg.h b/libsimple-arg.h index 0ba316a..1f4291c 100644 --- a/libsimple-arg.h +++ b/libsimple-arg.h @@ -147,7 +147,7 @@ struct longopt { * @param LONGOPTS:struct longopt * The options, list shall end * with `NULL` as `.long_flag` */ -#define ARGMAPLONG(LONGOPTS)/* TODO test */\ +#define ARGMAPLONG(LONGOPTS)\ for (i_ = 0; (LONGOPTS)[i_].long_flag; i_++) {\ if (TESTLONG((LONGOPTS)[i_].long_flag, (LONGOPTS)[i_].with_arg)) {\ flag_ = (LONGOPTS)[i_].short_flag;\ @@ -338,7 +338,7 @@ struct longopt { * @param WARG:int Whether the option takes an argument, * should not have side-effects */ -#define TESTLONG(FLG, WARG)/* TODO test */\ +#define TESTLONG(FLG, WARG)\ ((WARG)\ ? ((!strncmp(lflag_, (FLG), (n_ = strlen(FLG), n_ -= ((FLG)[n_ - !!n_] == '='))) && lflag_[n_] == '=')\ ? (lflag_[n_] = '\0',\ @@ -393,7 +393,7 @@ struct longopt { * * This macro also defines `char *argv0` * - * @param SYNOPSIS Description of the command line argument syntax + * @param SYNOPSIS:const char * Description of the command line argument syntax */ #define USAGE(SYNOPSIS)\ NUSAGE(1, SYNOPSIS) @@ -409,8 +409,8 @@ struct longopt { * * This macro also defines `char *argv0` * - * @param SYNOPSIS Description of the command line argument syntax - * @parma STATUS The exit value for the process + * @param SYNOPSIS:const char * Description of the command line argument syntax + * @parma STATUS:int The exit value for the process */ #if defined(__GNUC__) || defined(__clang__) # define NUSAGE(STATUS, SYNOPSIS)\ |