diff options
| author | Armin Brauns <armin.brauns@embedded-solutions.at> | 2023-07-13 12:05:45 +0000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-07-24 23:32:11 +1000 |
| commit | 625e03d2dc88df40e9d5a8a29011084881730a2f (patch) | |
| tree | ee312850dcec71979ecf3b6ed47f70b114939b9f /mpy-cross/main.c | |
| parent | 52dc48b2a0da912396bd3224cd9c906f4e6288ee (diff) | |
mpy-cross: Allow specifying source files starting with -.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Diffstat (limited to 'mpy-cross/main.c')
| -rw-r--r-- | mpy-cross/main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mpy-cross/main.c b/mpy-cross/main.c index 8a4dd5bcb..cf82759c1 100644 --- a/mpy-cross/main.c +++ b/mpy-cross/main.c @@ -100,7 +100,7 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha STATIC int usage(char **argv) { printf( - "usage: %s [<opts>] [-X <implopt>] <input filename>\n" + "usage: %s [<opts>] [-X <implopt>] [--] <input filename>\n" "Options:\n" "--version : show version information\n" "-o : output file for compiled bytecode (defaults to input with .mpy extension)\n" @@ -220,10 +220,11 @@ MP_NOINLINE int main_(int argc, char **argv) { const char *input_file = NULL; const char *output_file = NULL; const char *source_file = NULL; + bool option_parsing_active = true; // parse main options for (int a = 1; a < argc; a++) { - if (argv[a][0] == '-') { + if (option_parsing_active && argv[a][0] == '-') { if (strcmp(argv[a], "-X") == 0) { a += 1; } else if (strcmp(argv[a], "--version") == 0) { @@ -309,6 +310,8 @@ MP_NOINLINE int main_(int argc, char **argv) { } else { return usage(argv); } + } else if (strcmp(argv[a], "--") == 0) { + option_parsing_active = false; } else { return usage(argv); } |
