Main Page   Compound List   File List   Compound Members   File Members  

shell.c

Go to the documentation of this file.
00001 #include "syscall.h"
00002 
00003 int
00004 main()
00005 {
00006     SpaceId newProc;
00007     OpenFileId input = ConsoleInput;
00008     OpenFileId output = ConsoleOutput;
00009     char prompt[2], ch, buffer[60];
00010     int i;
00011 
00012     prompt[0] = '-';
00013     prompt[1] = '-';
00014 
00015     while( 1 )
00016     {
00017         Write(prompt, 2, output);
00018 
00019         i = 0;
00020         
00021         do {
00022         
00023             Read(&buffer[i], 1, input); 
00024 
00025         } while( buffer[i++] != '\n' );
00026 
00027         buffer[--i] = '\0';
00028 
00029         if( i > 0 ) {
00030                 newProc = Exec(buffer);
00031                 Join(newProc);
00032         }
00033     }
00034 }
00035 

Generated on Mon Feb 10 09:54:47 2003 for nachos by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees