Page 1 of 1

C shell

Posted: Sat Feb 22, 2003 5:25 pm
by nuno_silva_pt
How can i make a shell in c++?

Re:C shell

Posted: Sat Feb 22, 2003 5:43 pm
by Mr_Spam
for the greatists stability of the kernel, i'd make a shell system call then an application started from the kernel at boot calls the shell system call baised on the user input.

Re:C shell

Posted: Sat Feb 22, 2003 11:27 pm
by gtsphere
due to handling many different things that C++ has to offer, you need to recreate the wheel in some cases. Here is a good linke to help you out.

http://www.invalidsoftware.net/os/

Re:C shell

Posted: Sun Feb 23, 2003 8:58 am
by Pype.Clicker
- have an "input reader"
- once the user entered a line, check the syntax
- grab the first word : that's the command name
- locate the code for that command (it might be internal command like "help", "ls", "cd", "set" ... or some external program)
- if external program, look up for the program in every directory in $PATH
- if program found, load it in memory, set up arguments array and call main(argc, argv[])
- when program returns, restart