Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Command interpreter
- #include <stdio.h>
- char prompt[2] = "\nSHELL>";
- char* partOfString = "";
- char* command = "";
- char space = ' ';
- char* echo = "echo";
- void parseCommand()
- {
- if(command[0] == '#') return; //this is a comment in the shell
- //use strcmp and fscanf for I/O
- //if (strcmp(command, "echo") printf("%s", partOfString);
- }
- void promptUser()
- {
- while(command != "" || command != "exit")
- {
- printf("%s", prompt);
- scanf("%s", &command);
- parseCommand();
- if (command == "exit") break;
- }
- }
- int main()
- {
- promptUser();
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement