interpreter: forward "argv"

This commit is contained in:
Přemysl Eric Janouch 2017-05-26 20:25:02 +02:00
parent 3e68a09ae1
commit dd957483ac
Signed by: p
GPG Key ID: B715679E3A361BE6

View File

@ -50,9 +50,13 @@ main (int argc, char *argv[]) {
if (!init_runtime_library (&ctx))
printf ("%s\n", "runtime library initialization failed");
// In this one place we optimistically expect allocation to succeed
struct item *args = NULL, **tail = &args;
for (int i = 2; i < argc; i++)
tail = &(*tail = new_string (argv[i], strlen (argv[i])))->next;
struct item *result = NULL;
// TODO: pass argv as the list of arguments
(void) execute_block (&ctx, program, NULL, &result);
(void) execute_block (&ctx, program, args, &result);
item_free_list (result);
item_free_list (program);