Revision 3da12676 core/src/aos_shell.c
core/src/aos_shell.c | ||
---|---|---|
1838 | 1838 |
* @brief Initializes a shell object with the specified parameters. |
1839 | 1839 |
* |
1840 | 1840 |
* @param[in,out] shell Pointer to the shell object to be initialized. |
1841 |
* @param[in] name Name of the shell thread (may be NULL). |
|
1841 | 1842 |
* @param[in] prompt Prompt line to print (NULL = use default prompt). |
1842 | 1843 |
* @param[in] inbuf Two dimensional input buffer. |
1843 | 1844 |
* @param[in] entries Number of entries in the input buffer (1st dimension). |
1844 | 1845 |
* @param[in] linewidth Length of each entry in the input buffer (2nd dimension). |
1845 | 1846 |
* @param[in] numargs Maximum number of arguments (defines size of internal buffer). |
1846 | 1847 |
*/ |
1847 |
void aosShellInit(aos_shell_t* shell, const char* prompt, char inbuf[], size_t entries, size_t linewidth, size_t numargs) |
|
1848 |
void aosShellInit(aos_shell_t* shell, const char* name, const char* prompt, char inbuf[], size_t entries, size_t linewidth, size_t numargs)
|
|
1848 | 1849 |
{ |
1849 | 1850 |
aosDbgCheck(shell != NULL); |
1850 | 1851 |
aosDbgCheck(inbuf != NULL); |
... | ... | |
1854 | 1855 |
|
1855 | 1856 |
// set parameters |
1856 | 1857 |
shell->thread = NULL; |
1858 |
#if (CH_CFG_USE_REGISTRY == TRUE) |
|
1859 |
shell->name = name; |
|
1860 |
#else /* (CH_CFG_USE_REGISTRY == TRUE) */ |
|
1861 |
(void)name; |
|
1862 |
#endif /* (CH_CFG_USE_REGISTRY == TRUE) */ |
|
1857 | 1863 |
chEvtObjectInit(&shell->eventSource); |
1858 | 1864 |
aosShellStreamInit(&shell->stream); |
1859 | 1865 |
shell->prompt = prompt; |
... | ... | |
2179 | 2185 |
aos_shellcommand_t* cmd; |
2180 | 2186 |
|
2181 | 2187 |
// initialize variables and buffers |
2188 |
#if (CH_CFG_USE_REGISTRY == TRUE) |
|
2189 |
currp->name = ((aos_shell_t*)shell)->name; |
|
2190 |
#endif /* (CH_CFG_USE_REGISTRY == TRUE) */ |
|
2182 | 2191 |
rdata.input.length = 0; |
2183 | 2192 |
rdata.input.cursorpos = 0; |
2184 | 2193 |
memset(rdata.input.escseq, '\0', AOS_SHELL_ESCSEQUENCE_LENGTH * sizeof(char)); |
Also available in: Unified diff