gc: add 'help' option to list all available GC
authorJean Privat <jean@pryen.org>
Fri, 28 Aug 2009 17:00:54 +0000 (13:00 -0400)
committerJean Privat <jean@pryen.org>
Fri, 28 Aug 2009 17:00:54 +0000 (13:00 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

c_src/clib/nit_main.c
clib/nit_main.c

index e7ad4e9..1f955cd 100644 (file)
@@ -101,6 +101,13 @@ void initialize_gc_option(void) {
                        gc_option = nitgc;
                } else if (strcmp(opt, "large")==0) {
                        gc_option = large;
+               } else if (strcmp(opt, "help")==0) {
+                       fprintf(stderr, "NIT_GC_OPTION accepts 'nitgc'"
+#ifdef WITH_LIBGC
+                                       ", 'boehm'"
+#endif
+                                       ", 'large'. Default is '%s'.\n", def);
+                       exit(1);
                } else {
                        fprintf(stderr, "Invalid GC option in NIT_GC_OPTION environment variable. Using default '%s'.\n", def);
                }
index e7ad4e9..1f955cd 100644 (file)
@@ -101,6 +101,13 @@ void initialize_gc_option(void) {
                        gc_option = nitgc;
                } else if (strcmp(opt, "large")==0) {
                        gc_option = large;
+               } else if (strcmp(opt, "help")==0) {
+                       fprintf(stderr, "NIT_GC_OPTION accepts 'nitgc'"
+#ifdef WITH_LIBGC
+                                       ", 'boehm'"
+#endif
+                                       ", 'large'. Default is '%s'.\n", def);
+                       exit(1);
                } else {
                        fprintf(stderr, "Invalid GC option in NIT_GC_OPTION environment variable. Using default '%s'.\n", def);
                }