l********s 发帖数: 358 | 1 有个Linux下的project,我正在写command line parser。project的名字叫exec,那我
运行./exec后进入interactive mode. 我就可以输入如下的命令来运行各个task.
exec0001> read a.in
exec0002> write a.out
exec0003> quit
Parsing command line比较简单,我只要split into token,在调用getopt来parse。
我遇到的问题是我不能想shell一样输入<-(left arrow), ->(righ arrow)在command
line里面左右移动,也不能按Up arrow, Down arrow在之前和之后的command history里查
找,也不能按Tab来实现auto-complete,如果按arrow显示的是^[[A之类的乱码。
我需要添加些什么才能实现这些功能,有什么source code可供我参考吗?或者有什么
现成的library我可以使用? 我也用一个Berkeley的Linux下类似的程序,但它可以实现
这些功能,我进到 |
t****t 发帖数: 6806 | 2 有个库叫readline
command
history里查
【在 l********s 的大作中提到】 : 有个Linux下的project,我正在写command line parser。project的名字叫exec,那我 : 运行./exec后进入interactive mode. 我就可以输入如下的命令来运行各个task. : exec0001> read a.in : exec0002> write a.out : exec0003> quit : Parsing command line比较简单,我只要split into token,在调用getopt来parse。 : 我遇到的问题是我不能想shell一样输入<-(left arrow), ->(righ arrow)在command : line里面左右移动,也不能按Up arrow, Down arrow在之前和之后的command history里查 : 找,也不能按Tab来实现auto-complete,如果按arrow显示的是^[[A之类的乱码。 : 我需要添加些什么才能实现这些功能,有什么source code可供我参考吗?或者有什么
|
l********s 发帖数: 358 | 3 Thanks a lot. I'll go to check it. |
h***i 发帖数: 1970 | 4 试试直接用ledit run你的程序
【在 l********s 的大作中提到】 : Thanks a lot. I'll go to check it.
|
l********s 发帖数: 358 | 5 For ppl who also want to use readline library, remember to include "readline
" and "ncurses" library in the Makefile. |