Esempio n. 1
0
int main(int argc, char **argv) {
  shell_register_signals(); /* Hook SIGINT (namely ctrl-c) */

  while(true) {
    char *line = shell_getline("%u@dtsh: %d$ ", line);
    shell_execute(line);
    free(line);
  }
}
Esempio n. 2
0
/**
 * shell_prompt
 *
 * An interactive shell for xBoot.
 */
void shell_prompt(const char *prompt)
{
	int argc, guard;
	char *argv[MAXLINE];
	char buffer[MAXLINE];

	printf("\n\nEntering interactive shell. Run \'help\' for a list of commands.\n\n");

	guard = (strlen(prompt));

	while (1) {
		printf("%s", prompt);
		shell_getline(buffer, guard, MAXLINE);
		argc = shell_parseline(buffer, argv);
		shell_callcmd(argc, argv);
		shell_flushargs(argv);
		shell_flushbuffer(buffer);
	}

	return;
}