Exemple #1
0
int main(int argc, char* argv[])
{
	salad_filename = argv[0];
	log_level = STATUS;

	config_t config;
	test_config_t test_config;

	switch (parse_options(argc, argv, &config, &test_config))
	{
	case SALAD_EXIT:         return bye(EXIT_FAILURE);
	case SALAD_HELP:         return usage_main();
	case SALAD_HELP_TRAIN:   return usage_train();
	case SALAD_HELP_PREDICT: return usage_predict();
	case SALAD_HELP_INSPECT: return usage_inspect();
	case SALAD_HELP_STATS:   return usage_stats();
#ifdef TEST_SALAD
	case SALAD_HELP_TEST:    return usage_test();
#endif
	case SALAD_VERSION:      return version();
	default: break;
	}

	if (config.input_type == IOMODE_FILES)
	{
		error("Input mode 'files' is not yet implemented.");
		return bye(EXIT_FAILURE);
	}

	int ret = EXIT_FAILURE, is_metaop = FALSE;
	switch (config.mode)
	{
	case TRAINING:
		ret = _salad_train_(&config);
		break;
	case PREDICT:
		ret = _salad_predict_(&config);
		break;
	case INSPECT:
		ret = _salad_inspect_(&config);
		break;
	default:
		is_metaop = TRUE;
		break;
	}
	switch (config.mode)
	{
	case STATS:
		ret = _salad_stats_(&config);
		break;
#ifdef TEST_SALAD
	case TEST:
		ret = _salad_test_(&test_config);
		break;
#endif

	default: break;
	}
	return bye_ex(ret, is_metaop ? NULL : "Done!");
}
Exemple #2
0
int main(int argc, char *argv[]) {
    if(argc == 1) {
        usage_main();
        return 0;
    } else if(strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
        usage_main();
        return 0;
    } else if(strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0) {
        print_version();
        return 0;
    } else if(strcmp(argv[1], "extract") == 0) {
        return extract_main(argc-1, argv+1);
    } else if(strcmp(argv[1], "mbias") == 0) {
        return mbias_main(argc-1, argv+1);
    } else if(strcmp(argv[1], "mergeContext") == 0) {
        return mergeContext_main(argc-1, argv+1);
    } else {
        fprintf(stderr, "Unknown command!\n");
        usage_main();
        return -1;
    }
}
Exemple #3
0
int main(int argc, char **argv)
{
    AFPObj obj = { 0 };

    if (argc < 2) {
        usage_main();
        return 1;
    }

    if (afp_config_parse(&obj, "ad") != 0)
        return 1;

    setuplog("default:note", "/dev/tty");

    if (load_volumes(&obj, LV_DEFAULT) != 0)
        return 1;

    if (STRCMP(argv[1], ==, "ls"))
        return ad_ls(argc - 1, argv + 1, &obj);
    else if (STRCMP(argv[1], ==, "cp"))