feat(args): $0, $1, ... in vars

This commit is contained in:
william.valenduc 2026-01-23 17:05:56 +00:00
parent 82f35cfa08
commit 7bcf48f63e
4 changed files with 82 additions and 29 deletions

View file

@ -20,9 +20,16 @@
int main(int argc, char **argv)
{
struct hash_map *vars = vars_init();
if (vars == NULL)
{
fprintf(stderr, "Error: Failed to initialize variables hash map\n");
return ERR_MALLOC;
}
// Create the options struct (with argument handler)
struct args_options options;
int return_code = args_handler(argc, argv, &options);
int return_code = args_handler(argc, argv, &options, vars);
if (return_code != 0)
{
print_usage(stderr, argv[0]);
@ -31,12 +38,6 @@ int main(int argc, char **argv)
// args_print(&options);
// Initialize variables hash map
struct hash_map *vars = vars_init();
if (vars == NULL)
{
fprintf(stderr, "Error: Failed to initialize variables hash map\n");
return ERR_MALLOC;
}
// Create the IO-Backend context struct
struct iob_context *io_context = malloc(sizeof(struct iob_context));