MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / executeCommand

Method executeCommand

src/General/MiniTerminal.cpp:192–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void MiniTerminal::executeCommand(const char* cmdLine)
193{
194 uint32_t idx = 0U;
195
196 for (idx = 0U; UTIL_ARRAY_NUM(m_cmdTable) > idx; ++idx)
197 {
198 const CmdTableEntry entry = m_cmdTable[idx];
199 const size_t cmdLen = strlen(entry.cmdStr);
200
201 if (0 == strncmp(cmdLine, entry.cmdStr, cmdLen))
202 {
203 const char* par = &cmdLine[cmdLen];
204
205 /* Skip leading whitespace. */
206 while ((ASCII_SP == *par) || (ASCII_TAB == *par))
207 {
208 ++par;
209 }
210 // NOTE: Allow empty parameters to be able to clear settings values.
211
212 /* Execute the command with its parameters (optional). */
213 (this->*entry.handler)(par);
214
215 break;
216 }
217 }
218
219 if (UTIL_ARRAY_NUM(m_cmdTable) == idx)
220 {
221 writeError("Unknown command.\n");
222 }
223}
224
225void MiniTerminal::cmdRestart(const char* par)
226{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected