Example #1
0
File: main.c Project: h2oota/Gauche
int parse_options(int argc, char *argv[])
{
    int c;
    while ((c = getopt(argc, argv, "+be:E:ip:ql:L:m:u:Vr:F:f:I:A:-")) >= 0) {
        switch (c) {
        case 'b': batch_mode = TRUE; break;
        case 'i': interactive_mode = TRUE; break;
        case 'q': load_initfile = FALSE; break;
        case 'V': version(); break;
        case 'f': further_options(optarg); break;
        case 'p': profiler_options(optarg); break;
        case 'F': feature_options(optarg); break;
        case 'm':
            main_module = Scm_Intern(SCM_STRING(SCM_MAKE_STR_COPYING(optarg)));
            break;
        case 'r': /*FALLTHROUGH*/;
        case 'u': /*FALLTHROUGH*/;
        case 'l': /*FALLTHROUGH*/;
        case 'L': /*FALLTHROUGH*/;
        case 'I': /*FALLTHROUGH*/;
        case 'A': /*FALLTHROUGH*/;
        case 'e': /*FALLTHROUGH*/;
        case 'E': /*FALLTHROUGH*/;
            pre_cmds = Scm_Acons(SCM_MAKE_CHAR(c),
                                 SCM_MAKE_STR_COPYING(optarg), pre_cmds);
            break;
        case '-': break;
        case '?': usage(); break;
        }
    }
    return optind;
}
Example #2
0
File: main.c Project: leque/Gauche
void invoke_other_version(const char *version, int argc, char **argv)
{
    static ScmObj invoke_other_version = SCM_UNDEFINED;
    SCM_BIND_PROC(invoke_other_version, "%invoke-other-version",
                  Scm_GaucheInternalModule());
    ScmEvalPacket epkt;
    Scm_Apply(invoke_other_version,
              SCM_LIST2(SCM_MAKE_STR_COPYING(version),
                        Scm_CStringArrayToList((const char**)argv, argc, 0)),
              &epkt);
    /* %invoke-other-version won't return.  If we're here,
       we even failed to call it. */
    Scm_Panic("Failed to call %%invoke-other-version.  Installation problem?");
}