开源Readline库
2016-04-22 16:34:07 阿炯

Readline库作用

按字面意义,它主要用于命令行交互使用,提供一些操作上的帮助,提高操作效率和方便性。如果将这些辅助代码统一起来,形成可供调用的链接库,就省去了各个应用自行完成该功能的代码段。举一个简单的例子:在shell中通过tab键来查看已存在字母打头的指令补全,通过上下方向键查找已经完成过的指令历史,更多的快捷键介绍请看此处


Readline库分类

在BSD和Linux两在家族各有一款readline库,在bsd平台的是Editline Library (libedit);在Linux平台上的是GNU Readline。同时它们是可以跨平台使用的且功能性并无太大差异,两者都有自己的追随者。不过前者已经多年不更新了。


libedit vs editline

Editline appears to be the decendent of libedit. In the sourceforge version I've found an implementation of the readline function to provide compatibility with the readline library. Newer versions of libedit don't implement this interface, but still provide much of the same functionality. The man page for libedit is however still referred to as editline.