[sac-dev] readline/libedit patch

Brian Savage savage at uri.edu
Tue Oct 7 12:14:37 PDT 2008


Kuang

I was looking at your readline patch to handle the real readline  
library when used with a script.
http://www.iris.washington.edu/pipermail/sac-dev/2008-September/ 
000109.html

It looks like when the tty is not being used (use_tty()) you avoid  
the select_loop().
This seems fine with me.  We also have very similar code in the zgtmsg 
() and
the code you added looks a lot like the original zgpmsg() code.  Can  
we do some
consolidation here, possibly just within the zgpmsg() to begin with.  
and include code
when with HAVE_LIBEDIT or HAVE_READLINE ( currently just READLINE) is  
true.
To make the the code easier to handle in the future I would prefer  
the libedit and
readline behave the same way if a tty is, or is not, encountered.

- Use the select_loop() while in a tty session.
- Avoid the select_loop() while no tty is available
- Avoid the select_loop() while no line handling is available

How about something like:

#ifdef HAVE_READLINE || HAVE_LIBEDIT
if( use_tty() ) {
	select_loop()
} else {
#endif /* HAVE READLINE || HAVE_LIBEDIT */

          getfline()

#ifdef HAVE_READLINE || HAVE_LIBEDIT
}
#endif /* HAVE READLINE || HAVE_LIBEDIT */

For reference:
zgtmsg() is only called from
src/exm/xpause.c
src/exm/xnews.c
src/cpf/cresp.c  (Standard Error Recovery, not sure this is used)

Cheers
Brian






More information about the sac-dev mailing list