예제 #1
0
int CL_Service_Unix::main(int argc, char **argv)
{
	std::vector<CL_String> args;
	for (int i=0; i<argc; i++)
		args.push_back(argv[i]);

	if (argc >= 3 && args[1] == "-daemon")
	{
		return run_daemon(args);
	}
	else if (argc == 2 && args[1] == "-debug")
	{
		return run_debug(args);
	}
	else
	{
		std::cout << "Service parameters:" << std::endl;
		std::cout << "  -daemon <pidfile>   - Start service as a unix daemon" << std::endl;
		std::cout << "  -debug              - Debug service" << std::endl;
		return 0;
	}
}
예제 #2
0
int Service_Win32::main(int argc, char **argv)
{
	std::vector<std::string> args;
	for (int i=0; i<argc; i++)
		args.push_back(StringHelp::local8_to_text(argv[i]));

	if (argc == 2 && args[1] == "-debug")
	{
		return run_debug(args);
	}
	else if (argc == 2 && args[1] == "-install")
	{
		return run_install();
	}
	else if (argc == 2 && args[1] == "-uninstall")
	{
		return run_uninstall();
	}
	else
	{
		print_help();
		return run_service();
	}
}
예제 #3
0
void execute(struct Line *line1, struct VarSet *parent_set)
{
	struct VarSet varset;
	struct Line *ip, *next;
	int err = 0;

	varset_init(&varset, parent_set);
	
	for(ip = line1; ip != NULL && err == 0; ip = next){
		next = ip->then;
		
		DEBUGMSG("CMD=\"%s\"\n", BASIC_pcmds_s[ip->cmd]);
		
		switch(ip->cmd){
		case BASCMD_LET:
			err = run_let(ip, &varset);
			break;
		case BASCMD_DIM:
			/* TODO */
			break;
		case BASCMD_PRINT:
			err = run_print(ip, &varset);
			break;
		case BASCMD_INPUT:
			/* TODO */
			break;
		case BASCMD_READ:
			/* TODO */
			break;
		case BASCMD_IF:
			/* TODO */
			break;
		case BASCMD_ON:
			/* TODO */
			break;
		case BASCMD_FOR:
			/* TODO */
			break;
		case BASCMD_NEXT:
			/* TODO */
			break;
		case BASCMD_REM:
		case BASCMD_DATA:
			/* these don't do anything */
		case BASCMD_GOTO:
		case BASCMD_END:
			/* these are run implicitly */
			break;
		case BASCMD_GOSUB:
			/* TODO */
			break;
		case BASCMD_RETURN:
			/* TODO */
			break;
		case BASCMD_DEBUG:
			err = run_debug(ip, &varset);
			break;
		default:
			error("invalid command (this should not happen)");
			err = 1;
		}
	}

	varset_deinit(&varset);
}