lab7-fix2023/user/shell_0.c
2023-11-22 16:16:24 +08:00

31 lines
535 B
C

#include "type.h"
#include "const.h"
#include "protect.h"
#include "string.h"
#include "proc.h"
#include "global.h"
#include "proto.h"
#include "stdio.h"
int main(int arg, char *argv[])
{
int stdin = open("dev_tty0", O_RDWR);
int stdout = open("dev_tty0", O_RDWR);
int stderr = open("dev_tty0", O_RDWR);
char buf[1024];
int pid;
int times = 0;
while (1)
{
printf("\nminiOS:/ $ ");
if (gets(buf) && strlen(buf) != 0)
{
if (exec(buf) != 0)
{
printf("exec failed: file not found!\n");
continue;
}
}
}
}