Merge branch 'execution' into dev

This commit is contained in:
Jean Herail 2026-01-13 21:01:11 +01:00
commit aa440a6343
3 changed files with 87 additions and 10 deletions

View file

@ -8,6 +8,8 @@
// === Static variables
#include "utils/args/args.h"
static struct iob_context context;
static FILE *input = NULL;
static char *stream_buf = NULL;
@ -102,3 +104,28 @@ ssize_t stream_read(char **stream)
return IOB_ERROR_GENERIC;
}
}
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;
}