diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-10-03 23:11:23 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-10-03 23:11:23 +0200 |
commit | 4fcb1ec318d74a454f6cfbefe018f35bbb32d6bf (patch) | |
tree | acadeb955c33c6d6e7d37e19754e10e9cf60ffa1 /include | |
parent | 2fdc8dba3690419f2b0dd12b3d6d1c391cc54ba2 (diff) |
Typedef enums and structures
Diffstat (limited to 'include')
-rw-r--r-- | include/cli.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/include/cli.h b/include/cli.h index 970b228..8efa2d0 100644 --- a/include/cli.h +++ b/include/cli.h @@ -7,7 +7,7 @@ #include "_rune.h" #include "_uNview.h" -struct optparser { +typedef struct { bool _b; int _subopt; char **_argv; @@ -15,28 +15,27 @@ struct optparser { int optind; char errmsg[128]; u8view_t optarg; -}; +} optparser_t; -enum cliarg { +typedef enum { CLI_NONE, CLI_OPT, CLI_REQ, -}; +} cli_opt_kind_t; -struct cli_option { +typedef struct { rune shortopt; u8view_t longopt; - enum cliarg argtype; -}; + cli_opt_kind_t argtype; +} cli_opt_t; -[[nodiscard]] rune optparse(struct optparser *, const struct cli_option *, - size_t); +[[nodiscard]] rune optparse(optparser_t *, const cli_opt_t *, size_t); [[_mlib_inline]] -static inline struct optparser +static inline optparser_t mkoptparser(char **argv) { - return (struct optparser){ + return (optparser_t){ ._argv = argv, .optind = argv[0] != nullptr, }; |