Initial version
This commit is contained in:
commit
6f405265a5
102 changed files with 14486 additions and 0 deletions
37
code/test/shell.c
Normal file
37
code/test/shell.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
#include "syscall.h"
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
SpaceId newProc;
|
||||
OpenFileId input = ConsoleInput;
|
||||
OpenFileId output = ConsoleOutput;
|
||||
char prompt[2], buffer[60];
|
||||
int i;
|
||||
|
||||
prompt[0] = '$';
|
||||
prompt[1] = ' ';
|
||||
|
||||
while (1)
|
||||
{
|
||||
Write (prompt, 2, output);
|
||||
|
||||
i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
Read (&buffer[i], 1, input);
|
||||
|
||||
}
|
||||
while (buffer[i++] != '\n');
|
||||
|
||||
buffer[--i] = '\0';
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
newProc = Exec (buffer);
|
||||
Join (newProc);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue