diff --git a/apps/test_shell.c b/apps/test_shell.c new file mode 100644 index 0000000..c2d42f4 --- /dev/null +++ b/apps/test_shell.c @@ -0,0 +1,33 @@ +// Minimal test shell to verify the execution environment +#include + +extern int write(int fd, const void *buf, size_t count); +extern int read(int fd, void *buf, size_t count); + +int main(int argc, char *argv[], char *envp[]) { + const char *prompt = "shell> "; + char buf[128]; + + while (1) { + // Print prompt + write(1, prompt, 7); + + // Read command + int n = read(0, buf, sizeof(buf) - 1); + if (n <= 0) continue; + + buf[n] = '\0'; + + // Echo back + write(1, "You typed: ", 11); + write(1, buf, n); + + // Check for exit + if (buf[0] == 'q' && buf[1] == '\n') { + write(1, "Goodbye!\n", 9); + break; + } + } + + return 0; +}