Esempio n. 1
0
void NanoShellRun(void) 
{
	char cmd[COMMAND_MAX_LENGTH];
	int i, ret;

	ns_printf(BOLD_BLUE("\tNaSH ---A Nano Shell program.\n"));
	ns_printf(UNDER_YELLOW("Copyright(c) Long.Luo. All Rights Reserved!\n\n"));
	
	while (1) 
	{
		ns_printf(BOLD_GREEN("NanoShell") "> ");
		ns_gets(cmd, COMMAND_MAX_LENGTH);
		
		for (i = 0; cmd[i] != 0 && i < COMMAND_MAX_LENGTH; i++)
		{
			if (cmd[i] == '\n' || cmd[i] == '\r') 
			{ 
				cmd[i] = '\0'; 
				break;
			}
		}

		ret = Parse(cmd);
		if (ret < 0)
		{
			ns_printf(BOLD_YELLOW("Command not found: %s\n"), cmd);
		}
		else if (ret > 0)
		{
			ns_printf(BOLD_RED("Error executing command: %s\n"), cmd);
		}
	}
}
Esempio n. 2
0
static int default_help (void) {
	int i;

	t_printf ("\n" BOLD_GREEN("TinyShell available commands:") "\n");
	for (i = 0; commands[i].command_name != 0; i++) {
		t_printf(BOLD_YELLOW("%s") " - " BOLD_CYAN("%s\n"), commands[i].command_name,
                (commands[i].description==0)? "No desc. available" : commands[i].description);
	}
	t_printf ("\r\n");

	return 0;
}
Esempio n. 3
0
static int default_help (void) {
	int i;

	USART_fputs ("\r\n" BOLD_GREEN("TinyShell available commands:") "\r\n", DBGU_USART);
	for (i = 0; commands[i].command_name != 0; i++) {
		USART_fprintf(DBGU_USART, BOLD_YELLOW("%s") " - " BOLD_CYAN("%s\r\n"), commands[i].command_name,
                (commands[i].description==0)? "No desc. available" : commands[i].description);
	}
	USART_fputs ("\r\n",DBGU_USART);

	return 0;
}
Esempio n. 4
0
int help(void) 
{
	int i = 0;

	// Print some header text.
	ns_printf("\n" BOLD_GREEN("NanoShell available commands:") "\n");
	ns_printf("------------------\n");
		
	for (i = 0; commands[i].command_name != 0; i++) 
	{
		// Print the command name and the brief description.
		ns_printf(BOLD_YELLOW("%s") " - " BOLD_CYAN("%s\n"), commands[i].command_name,
                (commands[i].pcHelp==0)? "No Help. available" : commands[i].pcHelp);
	}
	ns_printf ("\r\n");

	return 0;
}
Esempio n. 5
0
void TinyShellRun (void) {

	char cmd[COMMAND_MAX_LENGTH];
	int i, ret;

	while (1) {
		t_printf (BOLD_GREEN("TinyShell") "> ");
		t_gets (cmd, COMMAND_MAX_LENGTH);
		for (i = 0; cmd[i] != 0 && i < COMMAND_MAX_LENGTH; i++)
			if (cmd[i] == '\n' || cmd[i] == '\r') { cmd[i] = '\0'; break; }

		ret = parse (cmd);
		if (ret < 0)
			t_printf (BOLD_YELLOW("Command not found: %s\n"), cmd);
		else if (ret > 0)
			t_printf (BOLD_RED("Error executing command: %s\n"), cmd);

	}
}
Esempio n. 6
0
void TinyShellRun (void *pvParameters) {

	char cmd[COMMAND_MAX_LENGTH];
	int i, ret;

	while (1) {
		USART_fputs (BOLD_GREEN("TinyShell") "> ", DBGU_USART);
		USART_fgets (cmd, COMMAND_MAX_LENGTH, DBGU_USART);
		for (i = 0; cmd[i] != 0 && i < COMMAND_MAX_LENGTH; i++)
			if (cmd[i] == '\n' || cmd[i] == '\r') { cmd[i] = '\0'; break; }

		ret = parse (cmd);
		if (ret < 0)
			USART_fprintf (DBGU_USART, BOLD_YELLOW("%s: %s\r\n"), "Command not found", cmd);
		else if (ret > 0)
			USART_fprintf (DBGU_USART, BOLD_RED("%s: %s\r\n"), "Error executing command", cmd);

	}
}