コード例 #1
0
ファイル: cc_base.cpp プロジェクト: scott-42/cc-tool
//==============================================================================
bool CC_Base::read_options(const po::options_description &desc, const po::variables_map &vm)
{
	if (vm.count("help"))
	{
		on_help(desc);
		return false;
	}

	if (vm.count("device"))
	{
		uint_t bus = 0, device = 0;
		if (!extract_usb_address(option_device_address_, bus, device))
			throw po::error("Bad device address format");
	}

	option_fast_interface_speed_ = vm.count("fast") > 0;
	return true;
}
コード例 #2
0
ファイル: musica.c プロジェクト: libertas/musica
int executer(char order[INPUT_LENGTH])
{
	char name_newdir[INPUT_LENGTH];

	if (strcmp(order, "add") == 0)
		on_add();

	else if (strcmp(order, "addl") == 0)
		on_addl();

	else if (strcmp(order, "import") == 0) {
		scanf(" %[^\n]", name_newdir);
		on_import(name_newdir);
	}

	else if (strcmp(order, "importl") == 0) {
		scanf(" %[^\n]", name_newdir);
		on_importl(name_newdir);
	}

	else if (strcmp(order, "order") == 0)
		on_order();

	else if (strcmp(order, "del") == 0 || strcmp(order, "delete") == 0)
		on_del();

	else if (strcmp(order, "delall") == 0
		 || strcmp(order, "deleteall") == 0)
		on_delall();

	else if (strcmp(order, "help") == 0 || strcmp(order, "?") == 0)
		on_help();

	else if (strcmp(order, "showlist") == 0 || strcmp(order, "show") == 0)
		on_showlist();

	else if (strcmp(order, "play") == 0) {
		if (on_play('d', 0))
			printf
			    ("The songlist cannot be played.Please check the song list\n");
	}

	else if (strcmp(order, "playone") == 0) {
		int which;
		scanf("%d", &which);
		if (on_play('a', which))
			printf
			    ("The songlist cannot be played.Please check the song list\n");
	}

	else if (strcmp(order, "save") == 0)
		on_save_config();

	else if (strcmp(order, "up") == 0)
		on_up();

	else if (strcmp(order, "down") == 0)
		on_down();

	else if (strcmp(order, "exit") == 0
		 || strcmp(order, "quit") == 0
		 || strcmp(order, "bye") == 0 || strcmp(order, "q") == 0)
		return 1;

	else if (strcmp(order, "") == 0) {
		return 1;	//printf("\n");
	} else
		printf("%s%s\n", "Command not found:", order);
	return 0;
}