예제 #1
0
파일: webhandle.c 프로젝트: ljvblfz/BBR
int do_login(void * ppage, char * pname, int type)
{
	char *				puser = getCookie("username");
	char *				pid   = getCookie("session_id");
	BROADBAND_ROUTER 	bbr[1];
	char				errmsg[256] = "";
	char *				language = getCookie("lang");

	load_bbr(bbr, errmsg);

	/* chage default language */
	if (!strcmp("ch", language))
		defLangSet(LANG_CH);
	else if (!strcmp("en", language))
		defLangSet(LANG_EN);
	else if (!strcmp("jp", language))
		defLangSet(LANG_JP);

	/* have been login */
	if (!isblankstr(puser) && !isblankstr(pid) &&
		!strcmp(puser, bbr->account.user) && 
		!strcmp(pid, bbr->account.session_id))			
		return FALSE;

	/* just login.csp */
	if (!strcmp(pname, "/login.csp"))
		return FALSE;

	/* redirect to login.csp */
	forward("/login.csp", TRUE);
	return FALSE;
	
	return TRUE;
}	
예제 #2
0
파일: tsh.c 프로젝트: Jarvishappy/tinyshell
/*
 * eval - Evaluate the command line that the user has just typed in
 *
 * If the user has requested a built-in command (quit, jobs, bg or fg)
 * then execute it immediately. Otherwise, fork a child process and
 * run the job in the context of the child. If the job is running in
 * the foreground, wait for it to terminate and then return.  Note:
 * each child process must have a unique process group ID so that our
 * background children don't receive SIGINT (SIGTSTP) from the kernel
 * when we type ctrl-c (ctrl-z) at the keyboard.
*/
void eval(char *cmdline)
{
    if (isblankstr(cmdline)) {
        return;
    }

    char *argv[MAXARGS];
    int bg = parseline(cmdline, argv);

    /* DBG(("bg:%d cmdline:%s", bg, cmdline)); */

    /* argv[0] contains the command name */
    if (is_builtin(argv[0])) {
        /* return run_builtin(bg, cmdline, argv); */
        builtin_cmd(argv);
    }
    else {
        run_external(bg, cmdline, argv);
    }
}