matt/src/args.h
2024-08-12 03:53:57 +03:00

23 lines
541 B
C

#pragma once
#include <stddef.h>
typedef struct arg {
char *name;
char *value;
bool registered;
} arg_t;
typedef struct args {
arg_t *list;
size_t count;
} args_t;
void args_register(args_t *args, char *name);
char *args_register_check(args_t *args);
args_t *args_parse(int argc, char *argv[]);
char *args_get_string(args_t *args, char *name);
bool args_get_bool(args_t *args, char *name);
int args_get_int(args_t *args, char *name);
bool args_split(args_t *args, char *name);
void args_free(args_t *args);