Simple embedded shell with runtime pluggable commands.
Implements a simple unix-like shell for embedded systems with a pluggable command architecture.
Revision 3:ebb4893f033d, committed 2018-12-02
- Comitter:
- shimniok
- Date:
- Sun Dec 02 17:14:28 2018 +0000
- Parent:
- 2:4f0affdb7db9
- Child:
- 4:8b8fa59d0015
- Commit message:
- Stubbed command lookup
Changed in this revision
SimpleShell.cpp | Show annotated file Show diff for this revision Revisions of this file |
SimpleShell.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SimpleShell.cpp Sun Dec 02 17:09:08 2018 +0000 +++ b/SimpleShell.cpp Sun Dec 02 17:14:28 2018 +0000 @@ -14,7 +14,11 @@ while (!done) { printPrompt(); readCommand(); - //this.doCommand(cmdline); + //cb = findCommand(); + //if cb + // status = cb.call(); + // done = status == EXIT + //else error not found } puts("exiting shell\n"); @@ -38,6 +42,14 @@ } +Callback<void()> SimpleShell::findCommand() +{ + Callback<void()> cb=NULL; + + return cb; +} + + void SimpleShell::printPrompt() { fputc('(', stdout);
--- a/SimpleShell.h Sun Dec 02 17:09:08 2018 +0000 +++ b/SimpleShell.h Sun Dec 02 17:14:28 2018 +0000 @@ -10,10 +10,9 @@ public: SimpleShell(); + void run(); void attach(Callback<void()> cb, char *command); - -// void registerCommand(char *commandString, char *helpText, Callback<void(float)> cb); - void run(); + Callback<void()> findCommand(); private: static const int MAXBUF=128;