Understading internals of vi editor
I am currently writing my own shell program. My cu开发者_C百科rrent shell can just execute commands. I want to go a step future and execute vi from this new shell. I am trying to understand the internals of how a vi editor works , but no good articles on net.
Any pointers or links would be helpful.
Thanks
You can get the source code: http://ex-vi.sourceforge.net/
I'm not sure what you mean by "execute vi from this new shell". How is it different from any other command?
did you fork() -> exec() the vi executable with parameters then wait() in the parent? (your shell).
You can do this with a system() call as well. In fact if you want to see how system works, download glibc code.
int main()
{
system("vi t.lis");
return 0;
}
精彩评论