upd: update usage hint in vm and compiler
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ void print_hint()
|
||||
printf("Usage: fz [flags] <file path>\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
|
||||
|
||||
Reference in New Issue
Block a user