2006-08-11 15:55:18 +02:00
|
|
|
#include "user.h"
|
|
|
|
#include "types.h"
|
|
|
|
#include "fs.h"
|
|
|
|
#include "fcntl.h"
|
|
|
|
|
|
|
|
char *args[100];
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
char buf[128];
|
|
|
|
int pid;
|
|
|
|
|
|
|
|
while(1){
|
2006-08-12 13:38:57 +02:00
|
|
|
puts("$ ");
|
2006-08-11 15:55:18 +02:00
|
|
|
gets(buf, sizeof(buf));
|
|
|
|
if(buf[0] == '\0')
|
|
|
|
continue;
|
|
|
|
pid = fork();
|
|
|
|
if(pid == 0){
|
|
|
|
args[0] = buf;
|
|
|
|
args[1] = 0;
|
|
|
|
exec(buf, args);
|
2006-08-12 13:38:57 +02:00
|
|
|
printf(1, "%s: not found\n", buf);
|
2006-08-11 15:55:18 +02:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
if(pid > 0)
|
|
|
|
wait();
|
|
|
|
}
|
|
|
|
}
|