[Top][All Lists]

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

Re: inputrc issue

From: Mike Miller
Subject: Re: inputrc issue
Date: Mon, 17 Oct 2005 00:21:53 -0500 (CDT)

On Sun, 16 Oct 2005, John W. Eaton wrote:

Looking at the definition of rl_read_init_file in bind.c from
readline, I see

 /* Do key bindings from a file.  If FILENAME is NULL it defaults
    to the first non-null filename from this list:
      1. the filename used for the previous call
      2. the value of the shell variable `INPUTRC'
      3. ~/.inputrc
    If the file existed and could be opened and read, 0 is returned,
    otherwise errno is returned. */
 rl_read_init_file (filename)
      const char *filename;
   /* Default the filename. */
   if (filename == 0)
        filename = last_readline_init_file;
        if (filename == 0)
          filename = sh_get_env_value ("INPUTRC");
        if (filename == 0)
          filename = DEFAULT_INPUTRC;

   if (*filename == 0)
     filename = DEFAULT_INPUTRC;

 #if defined (__MSDOS__)
   if (_rl_read_init_file (filename, 0) == 0)
     return 0;
   filename = "~/_inputrc";
   return (_rl_read_init_file (filename, 0));

This function is called with filename == NULL from
readline_initialize_everything, which is called the first time
readline is called.  My guess is you have INPUTRC set to
"/etc/inputrc" in your environment .  Maybe that is done in
/etc/profile on your system?

I had assumed that readline was looking in /etc/inputrc then
~/.inputrc, but that's apparently not what happens.  Instead, it is
only reading one file at startup time.

It looks like you figured this one out too, John! I'm using tcsh on Red Hat Linux and this is in the default /etc/csh.login file that came with the system:

if ( -f $HOME/.inputrc ) then
        setenv INPUTRC /etc/inputrc

I guess I don't understand the reason for that section because it looks like it is saying that if ~/.inputrc is a plain file, the environment variable INPUTRC should be set to /etc/inputrc so that ~/.inputrc will not be read.

This does explain something strange that I noticed before. When I installed a ~/.inputrc earlier, it worked fine. Later, after the machine was rebooted due to a power failure, I installed the new Octave and it did not use the ~/.inputrc, but neither did the old Octave. How could that be? Well, restarting meant sourcing the /etc/csh.login file which then detected ~/.inputrc and set INPUTRC to /etc/inputrc. It seems crazy.

Can anyone see the need for that section of /etc/csh.login above?

Anyway, tcsh is good but I'm working on switching everything to bash now.



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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