Docs #3
@@ -27,6 +27,7 @@ fzl_options_t *fzl_mkoptions(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(opts, 0, sizeof(fzl_options_t));
|
memset(opts, 0, sizeof(fzl_options_t));
|
||||||
|
opts->should_continue = true;
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@@ -81,12 +82,14 @@ fzl_options_t *fzl_mkoptions(int argc, char **argv)
|
|||||||
size_t fcount = 0;
|
size_t fcount = 0;
|
||||||
char **files = malloc(fremainder * sizeof(char *));
|
char **files = malloc(fremainder * sizeof(char *));
|
||||||
|
|
||||||
|
if (opts->should_continue)
|
||||||
|
{
|
||||||
for (; i < argc; i++)
|
for (; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (argv[i][0] == '-')
|
if (argv[i][0] == '-')
|
||||||
{
|
{
|
||||||
printf(
|
printf("%sWarning%s: unhandled flag '%s' (should be defined before "
|
||||||
"%sWarning%s: unhandled flag '%s' (should be defined before sources "
|
"sources "
|
||||||
"list)\n",
|
"list)\n",
|
||||||
FZL_CWARNING, FZL_CRST, argv[i]);
|
FZL_CWARNING, FZL_CRST, argv[i]);
|
||||||
continue;
|
continue;
|
||||||
@@ -100,6 +103,7 @@ fzl_options_t *fzl_mkoptions(int argc, char **argv)
|
|||||||
|
|
||||||
files[fcount++] = argv[i];
|
files[fcount++] = argv[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
opts->files = files;
|
opts->files = files;
|
||||||
opts->files_count = fcount;
|
opts->files_count = fcount;
|
||||||
@@ -115,7 +119,6 @@ fzl_options_t *fzl_mkoptions(int argc, char **argv)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
opts->should_continue = true;
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ void print_hint()
|
|||||||
printf("Usage: fz [flags] <file path>\n");
|
printf("Usage: fz [flags] <file path>\n");
|
||||||
printf("Flags:\n");
|
printf("Flags:\n");
|
||||||
printf("\t-h\t--help\tprint usage information\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
|
// Parse passed arguments and build args setup structure
|
||||||
|
|||||||
Reference in New Issue
Block a user