help-octave
[Top][All Lists]
Advanced

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

Re: inputrc issue


From: John W. Eaton
Subject: Re: inputrc issue
Date: Sun, 16 Oct 2005 22:33:54 -0400

On 16-Oct-2005, Mike Miller wrote:

| On Sun, 16 Oct 2005, John W. Eaton wrote:
| 
| > On 16-Oct-2005, Mike Miller wrote:
| >
| > | So doesn't this mean that Octave is only reading /etc/inputrc and not
| > | reading ~/.inputrc?
| >
| > Are there no other lines in the strace output for the .inputrc file in 
| > your home directory?  Here is what I see on my system:
| 
| I do not see that unless I have it in my startup/octaverc.  When I have 
| the appropriate lines in startup/octaverc, I see this in strace:
| 
| stat64("/home/mbmiller/local/share/octave/2.1.71/m/startup/inputrc", 
{st_mode=S_IFREG|0644, st_size=63, ...}) = 0
| open("/home/mbmiller/local/share/octave/2.1.71/m/startup/inputrc", O_RDONLY) 
= 4
| stat64("/home/mbmiller/.inputrc", {st_mode=S_IFREG|0640, st_size=63, ...}) = 0
| open("/home/mbmiller/.inputrc", O_RDONLY) = 4
| 
| 
| > Is it possible you your HOME environment variable is set inccorrectly?
| 
| I don't think so.  "echo $HOME" works fine from the command prompt before 
| I type "octave".
| 
| I am satisfied with what I have now.  I'm using the 
| ~/local/share/octave/2.1.71/m/startup/octaverc to control access to 
| inputrc files and it works fine.  If you want more help figuring out what 
| is going wrong, I'm happy to oblige.
| 
| Maybe it has to do with my use of ./configure --prefix=/home/mbmiller/local
| Is that possible?  Maybe not everything in Octave is following the prefix 
| correctly.  Otherwise, I think my installation is pretty ordinary.

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. */
  int
  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";
  #endif
    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.

jwe



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

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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