]>
Commit | Line | Data |
---|---|---|
35edb766 | 1 | /* |
04b3ea0e | 2 | * (C) Copyright 2014-2016 Leo C. <erbl259-lmu@yahoo.de> |
35edb766 L |
3 | * |
4 | * (C) Copyright 2014 Google, Inc | |
5 | * Simon Glass <sjg@chromium.org> | |
6 | * | |
8ed66016 | 7 | * SPDX-License-Identifier: GPL-2.0 |
35edb766 L |
8 | */ |
9 | ||
10 | #ifndef CLI_H | |
d684c216 L |
11 | #define CLI_H |
12 | ||
fcf1d5b3 L |
13 | #include "common.h" |
14 | ||
d684c216 L |
15 | /** |
16 | * Go into the command loop | |
17 | * | |
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. | |
20 | */ | |
21 | void cli_loop(void); | |
22 | ||
23 | /** | |
24 | * cli_simple_run_command() - Execute a command with the simple CLI | |
25 | * | |
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) | |
34 | */ | |
fcf1d5b3 | 35 | //int cli_simple_run_command(const char *cmd, uint_fast8_t flag); |
d684c216 L |
36 | |
37 | /** | |
38 | * cli_simple_run_command_list() - Execute a list of command | |
39 | * | |
40 | * The commands should be separated by ; or \n and will be executed | |
41 | * by the built-in parser. | |
42 | * | |
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. | |
45 | * | |
46 | * @param cmd String containing list of commands | |
47 | * @param flag Execution flags (CMD_FLAG_...) | |
48 | * @return 0 on success, or != 0 on error. | |
49 | */ | |
fcf1d5b3 | 50 | //int cli_simple_run_command_list(char *cmd, uint_fast8_t flag); |
d684c216 L |
51 | |
52 | /** | |
53 | * parse_line() - split a command line down into separate arguments | |
54 | * | |
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). | |
58 | * | |
59 | * #argv is terminated by a NULL after the last argument pointer. | |
60 | * | |
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. | |
64 | * | |
65 | * @line: Command line to parse | |
66 | * @args: Array to hold arguments | |
67 | * @return number of arguments | |
68 | */ | |
69 | //int cli_simple_parse_line(char *line, char *argv[]); | |
70 | ||
b08e079d L |
71 | /* |
72 | * Run a command. | |
73 | * | |
74 | * @param cmd Command to run | |
75 | * @param flag Execution flags (CMD_FLAG_...) | |
76 | * @return 0 on success, or != 0 on error. | |
77 | */ | |
fcf1d5b3 | 78 | int run_command(const char *cmd, uint_fast8_t flag); |
b08e079d | 79 | |
d684c216 L |
80 | int run_command_list(const char *cmd, int len); |
81 | ||
82 | ||
83 | #endif /* CLI_H */ |