示例#1
0
static void ippool_set_prompt(char *server_name)
{
	static char prompt[48];

	snprintf(prompt, sizeof(prompt), "ippool-%s", server_name);
	cli_set_prompt(prompt);
}
示例#2
0
static void cli_command_set(char *args)
{
	char *token;

	cli_strip_spaces(&args);

	token = args;
	if(cli_strip_word(&args)) {
		uart_printf("1 Incorrect format, set prompt [\"text\"]\n");
		return;
	}

	if(strcmp(token, "prompt") == 0) {
		++args;
		cli_strip_spaces(&args);

		token = args;
		if(cli_strip_quotes(&args)) {
			uart_printf("2 Incorrect format, set prompt [\"text\"]\n");
			return;
		}

		++token;
		cli_set_prompt(token);
	}
	else {
		uart_printf("3 Incorrect format, set prompt [\"text\"]\n");
		return;
	}
}
示例#3
0
void init_cli(void)
{
	//initialize the hardware
	init_leds();
	init_uart();
	init_info();
	init_keyboard();

	cli_set_prompt(CLI_PROMPT);
}
示例#4
0
void init_cli(void)
{
	//initialize the hardware
	init_leds();
	init_uart();
	init_info();
	init_24lc16b();
	init_25lc040a();

	cli_set_prompt(CLI_PROMPT);
}
示例#5
0
文件: py_cli.c 项目: clicon/clicon
static PyObject *
_cli_set_prompt(PyObject *args)
{
    char *mode;
    char *prompt;
    clicon_handle h;
    PyObject *handle;
    
    if (!PyArg_ParseTuple(args, "Oss", &handle, &mode, &prompt))
        return NULL;
    h = PyCapsule_GetPointer(handle, NULL);
  
    if (cli_set_prompt(h, mode, prompt) == 0)
        Py_RETURN_FALSE;
    Py_RETURN_TRUE;
}
示例#6
0
void
shell_main(void *thiz) {
    Shell *s = (Shell *)thiz;
    char *args[MAX_ARGUMENT_NUM];
    int nargs;

    cli_set_cwd(s->cli, (char *)"/");
    cli_set_prompt(s->cli, (char *)"/");

    while (!s->cli->cli_quit) {
        input_new_line(s->input, s->cli->cli_prompt);

        while (!s->cmd) {
            vTaskDelay(20);
        }

        cli_parse_args(s->cmd, args, &nargs);
        s->cmd = NULL;

        if (nargs == 0) continue;

        // special case for man command
        if (!strcmp(args[0], "man")) {
            if (nargs == 2) {
                if (cli_cmd_help(s->cli, args) != 0) {
                    cli_printf(s->cli, "man: no manual for command '%s' available\n", args[1]);
                }
            } else {
                cli_printf(s->cli, "USAGE: man [command]\n");
            }

            continue;
        }

        if (cli_cmd_exec(s->cli, args) == 0) continue;

        cli_printf(s->cli, "%s: command not found\n", args[0]);
    }
}