简体   繁体   中英

Understading internals of vi editor

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM