bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] Forwarding input from ncurses to readline


From: Chet Ramey
Subject: Re: [Bug-readline] Forwarding input from ncurses to readline
Date: Tue, 17 Feb 2015 16:48:23 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 2/17/15 4:25 PM, Ulf Magnusson wrote:

> Is the following comment in terminal.c outdated by the way?
> 
> /* If we're being compiled as part of bash, set the environment
>    variables $LINES and $COLUMNS to new values.  Otherwise, just
>    do a pair of putenv () or setenv () calls. */
> if (rl_change_environment)
>   sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
> 
> It doesn't seem to matter whether readline is compiled as part of bash.

It does, actually.  The trick is the traditional Unix linker behavior.
There is a source file in the readline library that provides a set of
functions whose names begin with sh_ (shell.o):

sh_single_quote (string)
sh_set_lines_and_columns (lines, cols)
sh_get_env_value (varname)
sh_get_home_dir ()
sh_unset_nodelay_mode (fd)

When readline is linked as part of bash, those are resolved from the
bash binary, since those names are already known to the linker when it
processes libreadline.a.  All of the functions in that file are resolved
from bash, so the file is not linked in.  When readline is not being
compiled as part of bash, those functions are not known when processing
libreadline.a, and are resolved using the built-in readline versions, so
the symbols in shell.o are used.

If you don't want readline to modify $LINES and $COLUMNS, set
rl_change_environment to 0.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]