]>
cloudbase.mooo.com Git - z180-stamp.git/blob - include/cli.h
2 * (C) Copyright 2014-2016 Leo C. <erbl259-lmu@yahoo.de>
4 * (C) Copyright 2014 Google, Inc
5 * Simon Glass <sjg@chromium.org>
7 * SPDX-License-Identifier: GPL-2.0
16 * Go into the command loop
18 * This will return if we get a timeout waiting for a command, but only for
19 * the simple parser (not hush). See CONFIG_BOOT_RETRY_TIME.
24 * cli_simple_run_command() - Execute a command with the simple CLI
26 * @cmd: String containing the command to execute
27 * @flag Flag value - see CMD_FLAG_...
28 * @return 1 - command executed, repeatable
29 * 0 - command executed but not repeatable, interrupted commands are
30 * always considered not repeatable
31 * -1 - not executed (unrecognized, bootd recursion or too many args)
32 * (If cmd is NULL or "" or longer than CONFIG_SYS_CBSIZE-1 it is
33 * considered unrecognized)
35 //int cli_simple_run_command(const char *cmd, uint_fast8_t flag);
38 * cli_simple_run_command_list() - Execute a list of command
40 * The commands should be separated by ; or \n and will be executed
41 * by the built-in parser.
43 * This function cannot take a const char * for the command, since if it
44 * finds newlines in the string, it replaces them with \0.
46 * @param cmd String containing list of commands
47 * @param flag Execution flags (CMD_FLAG_...)
48 * @return 0 on success, or != 0 on error.
50 //int cli_simple_run_command_list(char *cmd, uint_fast8_t flag);
53 * parse_line() - split a command line down into separate arguments
55 * The argv[] array is filled with pointers into @line, and each argument
56 * is terminated by \0 (i.e. @line is changed in the process unless there
57 * is only one argument).
59 * #argv is terminated by a NULL after the last argument pointer.
61 * At most CONFIG_SYS_MAXARGS arguments are permited - if there are more
62 * than that then an error is printed, and this function returns
63 * CONFIG_SYS_MAXARGS, with argv[] set up to that point.
65 * @line: Command line to parse
66 * @args: Array to hold arguments
67 * @return number of arguments
69 //int cli_simple_parse_line(char *line, char *argv[]);
74 * @param cmd Command to run
75 * @param flag Execution flags (CMD_FLAG_...)
76 * @return 0 on success, or != 0 on error.
78 int run_command(const char *cmd
, uint_fast8_t flag
);
80 int run_command_list(const char *cmd
, int len
);