feat(main_loop): Wrote the base of the main entrypoint. Implemented a helper which converts the args options to iob_context

This commit is contained in:
Jean Herail 2026-01-12 22:27:26 +01:00
parent 83b7374583
commit f71d0a2183
3 changed files with 89 additions and 5 deletions

View file

@ -2,6 +2,8 @@
#include <stdio.h>
#include "utils/args/args.h"
static struct iob_context context;
static FILE *input;
@ -33,3 +35,28 @@ int iob_init(struct iob_context *ctx)
return -1;
}
}
int iob_config_from_args(struct args_options *args, struct iob_context *ctx)
{
switch (args->type)
{
case INPUT_STDIN:
ctx->mode = IOB_MODE_STDIN;
ctx->args = NULL;
break;
case INPUT_FILE:
ctx->mode = IOB_MODE_SCRIPT;
ctx->args = (char *)args->input_source;
break;
case INPUT_CMD:
ctx->mode = IOB_MODE_CMD;
ctx->args = NULL;
break;
default:
return -1;
}
return 0;
}