diff options
Diffstat (limited to '')
-rw-r--r-- | libsimple-arg.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/libsimple-arg.h b/libsimple-arg.h index 6aa3c2a..3662b70 100644 --- a/libsimple-arg.h +++ b/libsimple-arg.h @@ -19,6 +19,8 @@ /** * The zeroth command line argument, the name of the process, * set by the command line parsing macros + * + * @since 1.0 */ extern char *argv0; @@ -32,6 +34,8 @@ extern char *argv0; * where `.long_flag` does not end with '=' and * `.with_arg` is zero. These *cannot* have the same * `.short_flag` + * + * @since 1.0 */ struct longopt { /** @@ -101,6 +105,8 @@ struct longopt { * // print usage information for other flags * usage(); * } ARGEND; + * + * @since 1.0 */ #define ARGBEGIN ARGBEGIN2(1, 0) @@ -109,6 +115,8 @@ struct longopt { * `ARGBEGIN {} ARGEND;`, however, `argv0` * is not set to `argv[0]`, instead `argv[0]` * is handled like any other element in `argv` + * + * @since 1.0 */ #define SUBARGBEGIN ARGBEGIN2(0, 0) @@ -120,6 +128,8 @@ struct longopt { * @param KEEP_DASHDASH If and only if 0, "--" is not removed * `argv` before parsing is stopped when it * is encountered + * + * @since 1.1 */ #define ARGBEGIN2(WITH_ARGV0, KEEP_DASHDASH)\ do {\ @@ -164,6 +174,8 @@ struct longopt { * * @param LONGOPTS:struct longopt * The options, list shall end * with `NULL` as `.long_flag` + * + * @since 1.0 */ #define ARGMAPLONG(LONGOPTS)\ for (i_ = 0; (LONGOPTS)[i_].long_flag; i_++) {\ @@ -198,6 +210,8 @@ struct longopt { * } ARGEND; * * @param SYMBOL:char The symbol flags should begin with + * + * @since 1.0 */ #define ARGALT(SYMBOL)\ }\ @@ -222,7 +236,9 @@ struct longopt { switch (flag_) { /** - * Refer to `ARGBEGIN`, `SUBARGBEGIN`, and `ARGBEGIN4` + * Refer to `ARGBEGIN`, `SUBARGBEGIN`, and `ARGBEGIN2` + * + * @since 1.0 */ #define ARGEND\ }\ @@ -243,6 +259,8 @@ struct longopt { /** * `case ARGNUM` creates a switch statement case for each digit + * + * @since 1.0 */ #define ARGNUM '0': case '1': case '2': case '3': case '4':\ case '5': case '6': case '7': case '8': case '9' @@ -252,6 +270,8 @@ struct longopt { * 'a' is returned * * @return :char The option's identifying character + * + * @since 1.0 */ #define FLAG() (flag_) @@ -263,6 +283,8 @@ struct longopt { * value can also be in the next argument * * @return :char * The current command line argument + * + * @since 1.0 */ #define LFLAG() (lflag_) @@ -275,6 +297,8 @@ struct longopt { * that the option has a value * * @return :char * The option's value, never `NULL` + * + * @since 1.0 */ #define ARG() (arg_ ? (brk_ = 1, arg_) : (usage(), NULL)) @@ -291,6 +315,8 @@ struct longopt { * * @return :char * The option's value, `NULL` if * the option does not have a value + * + * @since 1.1 */ #define ARGNULL() (arg_ ? (brk_ = 1, arg_) : NULL) @@ -326,6 +352,8 @@ struct longopt { * * @return :char * The option's value include the flag * character, never `NULL` or "" + * + * @since 1.0 */ #define ARGHERE() (brk_ = 1, argv[0]) @@ -355,6 +383,8 @@ struct longopt { * must not have side-effects * @param WARG:int Whether the option takes an argument, * should not have side-effects + * + * @since 1.0 */ #define TESTLONG(FLG, WARG)\ ((WARG)\ @@ -386,6 +416,8 @@ struct longopt { * * @param ... If non-zero, the `usage` function * will be called + * + * @since 1.0 */ #define NOFLAGS(...)\ do {\ @@ -412,6 +444,8 @@ struct longopt { * This macro also defines `char *argv0` * * @param SYNOPSIS:const char * Description of the command line argument syntax + * + * @since 1.0 */ #define USAGE(SYNOPSIS)\ NUSAGE(1, SYNOPSIS) @@ -440,6 +474,8 @@ struct longopt { * * @param SYNOPSIS:const char * Description of the command line argument syntax * @parma STATUS:int The exit value for the process + * + * @since 1.0 */ #define NUSAGE(STATUS, SYNOPSIS)\ static LIBSIMPLE_NORETURN__ void\ |