diff --git a/src/compiler/utils/fzl_options.c b/src/compiler/utils/fzl_options.c index 4060189..f923375 100644 --- a/src/compiler/utils/fzl_options.c +++ b/src/compiler/utils/fzl_options.c @@ -27,6 +27,7 @@ fzl_options_t *fzl_mkoptions(int argc, char **argv) } memset(opts, 0, sizeof(fzl_options_t)); + opts->should_continue = true; if (argc < 2) { @@ -81,24 +82,27 @@ fzl_options_t *fzl_mkoptions(int argc, char **argv) size_t fcount = 0; char **files = malloc(fremainder * sizeof(char *)); - for (; i < argc; i++) + if (opts->should_continue) { - if (argv[i][0] == '-') + for (; i < argc; i++) { - printf( - "%sWarning%s: unhandled flag '%s' (should be defined before sources " - "list)\n", - FZL_CWARNING, FZL_CRST, argv[i]); - continue; - } + if (argv[i][0] == '-') + { + printf("%sWarning%s: unhandled flag '%s' (should be defined before " + "sources " + "list)\n", + FZL_CWARNING, FZL_CRST, argv[i]); + continue; + } - if (fremainder <= fcount) - { - fremainder *= 2; - files = realloc(files, fremainder * sizeof(char *)); - } + if (fremainder <= fcount) + { + fremainder *= 2; + files = realloc(files, fremainder * sizeof(char *)); + } - files[fcount++] = argv[i]; + files[fcount++] = argv[i]; + } } opts->files = files; @@ -115,7 +119,6 @@ fzl_options_t *fzl_mkoptions(int argc, char **argv) return NULL; } - opts->should_continue = true; return opts; } diff --git a/src/vm/main.c b/src/vm/main.c index 55c85d4..f72d7a5 100644 --- a/src/vm/main.c +++ b/src/vm/main.c @@ -17,6 +17,7 @@ void print_hint() printf("Usage: fz [flags] \n"); printf("Flags:\n"); printf("\t-h\t--help\tprint usage information\n"); + printf("\t-d\t--debug\tdisplay program opcodes\n"); } // Parse passed arguments and build args setup structure