See https://github.com/antirez/linenoise for details. Implemented a routine atexit() in libc. Pdc modified to use readline library.