Revise makefile structure.
[pintos-anon] / src / tests / userprog / shell.c
1 #include <stdio.h>
2 #include <syscall.h>
3
4 int
5 main (void)
6 {
7   for (;;) 
8     {
9       char command[80], *cp;
10
11       /* Prompt. */
12       printf ("--");
13
14       /* Read and echo command. */
15       for (cp = command; cp < command + sizeof command - 1; cp++)
16         {
17           read (STDIN_FILENO, cp, 1);
18           putchar (*cp);
19           if (*cp == '\n')
20             break;
21         }
22       *cp = '\0';
23       
24       /* Execute command. */
25       if (cp > command) 
26         join (exec (command));
27     }
28 }