Exemplo n.º 1
0
/*
 * Re-starting processing
 *	mode = -1		Reset and re-start	(cold boot)
 *	mode = -2		Re-start		(warm boot)
 *	mode = -3		Reboot			(normal boot)
 *	mode = 0xFFhhmmss	Re-start at hh:mm:ss
 *				0 <= hh < 24, 0 <= mm,ss < 60
 */
EXPORT ER restart_device( W mode )
{
	if ( mode == -1 ) {
		/* Reset and re-start (cold boot) */
#if USE_KERNEL_MESSAGE
		tm_putstring((UB*)"\n<< SYSTEM RESTART >>\n");
#endif
		tm_exit(-1);  /* no return */
		return E_OBJ;
	}

	if ( mode == -3 ) {
		/* Reboot (normal boot) */
		static UB bdcmd[4 + L_DEVNM] = "bd ";
#if USE_KERNEL_MESSAGE
		tm_putstring((UB*)"\n<< SYSTEM REBOOT >>\n");
#endif
		strncat((char*)bdcmd, (char*)SCInfo.bootdev, L_DEVNM);
		tm_command(bdcmd);	/* Normally no return */
		return E_OBJ;		/* When the BD command is an error */
	}

	if ( mode == -2 ) {
		return E_NOSPT; /* Unsupported */
	}

	if ( (mode & 0xff000000) == 0xff000000 ) {
		/* Re-start at specified time */
		return E_NOSPT;	/* Unsupported */
	}

	return E_PAR;
}
Exemplo n.º 2
0
/*
 *	Application main entry
 */
EXPORT	void	appl_main( void )
{
	B	buf[256];
	INT	fin, n;

	/* initialize calendar date */
	init_calendar_date();

	/* command processing */
	for (fin = 0; fin == 0; ) {
		P("T2EX >> ");
		Gets(buf, sizeof(buf));
		for (n = strlen(buf); --n >= 0 && buf[n] <= ' '; ) 
			buf[n] = '\0';
		P("%s\n", buf);
		if (strncmp(buf, "quit", 1) == 0) {
			fin = 1;

		/* t-monitor */
#if 0
		} else if (strncmp(buf, "#", 1) == 0) {
			tm_command(&buf[1]);

		/* misc. command */
#endif
		} else {
			if (exec_cmd(buf) == 0) {
				P("q[uit]      quit\n");
				//P("# [cmd]     exec t-monitor command\n");
				P("?           command help\n");
				P("<command>   misc. command\n");
			}
		}
	}
	
	vd_printf("fin\n");
}