I am in the progress of creating a bash shell. I have created my own stand alone programs for ls, kill, ps etc etc. How do I incorporate them into my program? I've got two programs - one called <def.h> where all the definitions and globals are stored and the other one the main code, with the main function, getline function, parse function, execute function etc.
The only bit i'm confused about is the builtin command - can anyone explain it to me? This is what I've found on the web site - and I don't understand it :-(
else if (check("cd"))
else if (check("history"))
else if (check("!"))
The do_cd() function can then extract a directory name from the line array and use the chdir() system call to make the change. For the ! and history commands, you need to modify the getline() function so that lines entered at the keyboard are stored as they are entered. The history command can then list all the commands in the store and the command can copy the appropriate stored command back into the line array. do_repeat_command() can then return a zero from builtin() so that line will be parsed as normal.
Do I need to specify the path of my program in the def.h??? How do I carry out my own script within the builtin command?!!!
Thanks in advanced.