diff options
-rw-r--r-- | interpreter.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/interpreter.c b/interpreter.c index 1ca2744..7be4fc7 100644 --- a/interpreter.c +++ b/interpreter.c @@ -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); |