tags:

views:

59

answers:

2

Hi,

I am currently writing my own shell program. My current 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

+2  A: 

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?

Carl Norum
Well, when I type vi on the new shell , the editor is launched but I am unable to type anything .And also I get back my new shell prompt waiting for the next command to be typed.I am unable to type anything on the screen and my program just hangs.any clue?
hits_lucky
+1  A: 

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;
}
jim mcnamara