Beispiel #1
0
mloop()
{
	while (!quit) {
		if (incmd) {
			docmd();
		} else if (wwcurwin->ww_state != WWS_HASPROC) {
			if (!wwcurwin->ww_keepopen)
				closewin(wwcurwin);
			setcmd(1);
			if (wwpeekc() == escapec)
				(void) wwgetc();
			error("Process died.");
		} else {
			register struct ww *w = wwcurwin;
			register char *p;
			register n;

			if (wwibp >= wwibq)
				wwiomux();
			for (p = wwibp; p < wwibq && *p != escapec;
			     p++)
				;
			if ((n = p - wwibp) > 0) {
				if (!w->ww_ispty && w->ww_stopped)
					startwin(w);
				(void) write(w->ww_pty, wwibp, n);
				wwibp = p;
			}
			if (wwpeekc() == escapec) {
				(void) wwgetc();
				setcmd(1);
			}
		}
	}
}
Beispiel #2
0
int			main(void)
{
	t_env	env;
	int		ret;

	if (!power_two(WIN_VALUE))
		return (0);
	signal(SIGINT, sighandler);
	startwin(&env);
	while (true)
	{
		ret = menu(&env, 0, 0);
		if (ret == 2)
			break ;
		else if (ret == 1)
			highscore(&env);
		else if (ret == 0)
		{
			init_env_game(&env);
			game(&env);
			get_name(&env);
			get_score(&env, 0);
			del_env_game(&env);
		}
	}
	return (endwin(), 0);
}
Beispiel #3
0
void
docmd(void)
{
	int c;
	struct ww *w;
	char out = 0;

	while (!out && !quit) {
		if ((c = wwgetc()) < 0) {
			if (terse)
				wwsetcursor(0, 0);
			else {
				wwputs("Command: ", cmdwin);
				wwcurtowin(cmdwin);
			}
			do
				wwiomux();
			while ((c = wwgetc()) < 0);
		}
		if (!terse)
			wwputc('\n', cmdwin);
		switch (c) {
		default:
			if (c != escapec)
				break;
		case 'h': case 'j': case 'k': case 'l':
		case 'y': case 'p':
		case ctrl('y'):
		case ctrl('e'):
		case ctrl('u'):
		case ctrl('d'):
		case ctrl('b'):
		case ctrl('f'):
		case ctrl('s'):
		case ctrl('q'):
		case ctrl('['):
			if (selwin == 0) {
				error("No window.");
				continue;
			}
		}
		switch (c) {
		case '1': case '2': case '3': case '4': case '5':
		case '6': case '7': case '8': case '9':
			if ((w = window[c - '1']) == 0) {
				error("%c: No such window.", c);
				break;
			}
			setselwin(w);
			if (checkproc(selwin) >= 0)
				 out = 1;
			break;
		case '%':
			if ((w = getwin()) != 0)
				setselwin(w);
			break;
		case ctrl('^'):
			if (lastselwin != 0) {
				setselwin(lastselwin);
				if (checkproc(selwin) >= 0)
					out = 1;
			} else
				error("No previous window.");
			break;
		case 'c':
			if ((w = getwin()) != 0)
				closewin(w);
			break;
		case 'w':
			c_window();
			break;
		case 'm':
			if ((w = getwin()) != 0)
				c_move(w);
			break;
		case 'M':
			if ((w = getwin()) != 0)
				movewin(w, w->ww_alt.t, w->ww_alt.l);
			break;
		case 's':
			if ((w = getwin()) != 0)
				c_size(w);
			break;
		case 'S':
			if ((w = getwin()) != 0)
				sizewin(w, w->ww_alt.nr, w->ww_alt.nc);
			break;
		case 'y':
			c_yank();
			break;
		case 'p':
			c_put();
			break;
		case ':':
			c_colon();
			break;
		case 'h':
			(void) wwwrite(selwin, "\b", 1);
			break;
		case 'j':
			(void) wwwrite(selwin, "\n", 1);
			break;
		case 'k':
			(void) wwwrite(selwin, "\033A", 2);
			break;
		case 'l':
			(void) wwwrite(selwin, "\033C", 2);
			break;
		case ctrl('e'):
			wwscroll(selwin, 1);
			break;
		case ctrl('y'):
			wwscroll(selwin, -1);
			break;
		case ctrl('d'):
			wwscroll(selwin, selwin->ww_w.nr / 2);
			break;
		case ctrl('u'):
			wwscroll(selwin, - selwin->ww_w.nr / 2);
			break;
		case ctrl('f'):
			wwscroll(selwin, selwin->ww_w.nr);
			break;
		case ctrl('b'):
			wwscroll(selwin, - selwin->ww_w.nr);
			break;
		case ctrl('s'):
			stopwin(selwin);
			break;
		case ctrl('q'):
			startwin(selwin);
			break;
		case ctrl('l'):
			wwredraw();
			break;
		case '?':
			c_help();
			break;
		case ctrl('['):
			if (checkproc(selwin) >= 0)
				out = 1;
			break;
		case ctrl('z'):
			wwsuspend();
			break;
		case 'q':
			c_quit();
			break;
		/* debugging stuff */
		case '&':
			if (debug) {
				c_debug();
				break;
			}
		default:
			if (c == escapec) {
				if (checkproc(selwin) >= 0) {
					(void) write(selwin->ww_pty,
						&escapec, 1);
					out = 1;
				}
			} else {
				if (!terse)
					wwbell();
				error("Type ? for help.");
			}
		}
	}
	if (!quit)
		setcmd(0);
}
Beispiel #4
0
int main(int argc, char* argv[])
{
	
	if(argc > 1){
		if(argc == 2 && strcmp(argv[1],"help")==0){
			showAdminHelp();
			return 0;
		}
	//	if(bIsLogin==-1)
	//	{
       	//	Log::log (0, "请运行统一认证程序进行身份认证!谢谢!");
	//		return 0;
	//	}
	//	else if (bIsLogin == 0)
	//	{
       	//	Log::log (0, "用户未登陆,请登录后重试!谢谢!");
	//		return 0;			
	//	}
		hbaccessAdmin *phbAdmin = new hbaccessAdmin();
		phbAdmin->run();
		delete phbAdmin;
		phbAdmin = 0;
		return 0;
		
	}	
	else if(argc == 1) 
	{
	/*增加判断用户是否已经登陆*/
		//if(bIsLogin==-1)
		//{
       		//Log::log (0, "请运行统一认证程序进行身份认证!谢谢!");
		//	return 0;
	//	}	
	//	else if (bIsLogin == 0)
	//	{
       	//	Log::log (0, "用户未登陆,请登录后重试!谢谢!");
	//		return 0;			
	//	}
  //进入交互模式    
	   try {
	        signal (SIGINT, SIG_IGN);
	        signal (SIGQUIT, SIG_IGN);
	                
	        startwin();
	        //hblogin lg;
	        //lg.run();
	        hbmainmenu mm;
				  mm.run();
	        endwin();
	    }
    //# OCI Exception
    catch (TOCIException &e) {
        cout<<"[EXCEPTION]: TOCIException catched"<<endl;
        cout<<"  *Err: "<<e.getErrMsg()<<endl;
        cout<<"  *SQL: "<<e.getErrSrc()<<endl;
        Log::log (0, "收到TOCIException退出\n[TOCIEXCEPTION]: %s", e.getErrMsg());
    }

    //# Exception
    catch (Exception &e) {
        cout << "[EXCEPTION]: " << e.descript () << endl;
        Log::log (0, "收到Exception退出\n[EXCEPTION]: %s", e.descript());
    }

    //# Other Exception
    catch (...) {
        cout << "[EXCEPTION]: Exception catched" <<endl;
        Log::log (0, "收到其他Exception退出");
    }
	}
	//if(cHbLogin)
	//{
	//	delete cHbLogin; 
	//	cHbLogin = NULL;
	//}
    return 0;
}