On 2 May 2012 22:18, David Korn <[email protected]> wrote: > Subject: Re: [ast-users] Using libshell for emacs line editing > -------- > >> We have a small application which needs to prompt for a text line >> (with emacs command line editing) and currently uses libtecla for this >> purpose Can we use libshell for the same task? Is there a code example >> how to do this for libshell? >> > > If you are asking how to do this in ksh, You should be able to do > > set -o emacs > IFS= read var > > and you will be able to use emacs editing on the input line. > You can also continue lines by ending them with a \.
Well, this is close but I want to do this from C code, i.e. have a C function int shell_readinputline(const char *prompt, const char *histfile, const char *defaultvalue, char **returnstring) which accepts a prompt string passed to PS1, a histfile used as history file for this application (use /dev/null if value is NULL), defaultvalue which is presented as option and return string returns the string the user entered. > If you are asking how to use editing in an existing program then you can > LD_PRELOAD libedit assuming you have the ast-open package. Where is libedit.so? I can't find it in my ast-open build. _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
