Skip to content

Commit 5e34909

Browse files
committed
unix: Make usage info reflect actual usage of -X option.
1 parent c3d35c6 commit 5e34909

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

unix/main.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,12 @@ mp_obj_t test_obj_new(int value) {
209209
}
210210

211211
int usage(void) {
212-
printf("usage: py [-c <command>] [-X <heap size>] [<filename>]\n");
212+
printf(
213+
"usage: py [-X <opt>] [-c <command>] [<filename>]\n"
214+
"\n"
215+
"Implementation specific options:\n"
216+
" heapsize=<n> -- set the heap size for the GC\n"
217+
);
213218
return 1;
214219
}
215220

@@ -242,11 +247,14 @@ void pre_process_options(int argc, char **argv) {
242247
if (a + 1 >= argc) {
243248
exit(usage());
244249
}
250+
if (0) {
245251
#if MICROPY_ENABLE_GC
246-
if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) {
252+
} else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) {
247253
heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, NULL, 0);
248-
}
249254
#endif
255+
} else {
256+
exit(usage());
257+
}
250258
a++;
251259
}
252260
}

0 commit comments

Comments
 (0)