Hello Radek,

On 3/3/21 20:56, Radosław Korzeniewski wrote:
> Hello,
> 
> śr., 3 mar 2021 o 18:10 Eric Bollengier <e...@baculasystems.com> napisał(a):
> 
>> Hello Radek,
>>
>> On 3/3/21 17:40, Radosław Korzeniewski wrote:
>>> Hello,
>>>
>>> The readline manual (from Debian) gives:
>>>
>>> READLINE(3)
>>>
>>>     Library Functions Manual
>>>
>>>                      READLINE(3)
>>>
>>> NAME
>>>        readline - get a line from a user with editing
>>>
>>> SYNOPSIS
>>>        #include <stdio.h>
>>>        #include <readline/readline.h>
>>>        #include <readline/history.h>
>>>
>>> So, I assume that a correct way to include readline headers is as above.
>>> But is this Linux specific?
>>
>> Yes, this is specific and probably some version of linux only (recent
>> ones, but probably not old ones, or the one installed manually).
>>
> 
> Debian 9 and readline 7.0 is far from "recent". I'm not sure if you can
> install readline manually using include location other than
> "*/readline/readline.h".
> To verify that I compiled some readline library starting from version 2.0
> (released in 1994) then 4.0, 5.0, 6.0. Every time (except ver 2.0 which
> does not support this configure parameter) the library
> uses --includedir=... parameter + "readline" directory for header files
> location.
> 
> The question is why would a readline be available at an incorrect location
> not designed by readline developers?
> If readline developers designed his library to be used as
> <readline/readline.h> then in my opinion we use it incorrectly, right?

On Debian at least, users have the choice between two readline
implementations, libedit and libreadline. They are supposed to be
compatible (this is mostly a license issue with libreadline if I
remember correctly).

The libedit readline.h is available under:
/usr/include/editline/readline.h

We might change the ""  to <> in the header or even do some more
advanced detection, but using only <readline/readline.h> will force
users to patch the source to compile with libedit.

> I'm pretty sure that we use it incorrectly as the whole code goes like this:
> 
> #ifdef HAVE_READLINE
> #define READLINE_LIBRARY 1
> #include "readline.h"
> #include "history.h"
> ...
> 
> But our code is not a readline library code, so why do we define this
> macro: READLINE_LIBRARY at all?
> What I understand from the readline code is that this macro is used to
> distinguish between "internal" and "public" usages.
> We should use a public interface of readline, right? So if public then
> readline developers designed it as: <readline/*.h>
> 
> What do you think?

The READLINE_LIBRARY flag is a readline option to be able to locate the
readline headers in an other directory than readline/, for me this is a
compatibility trick that might not be necessary anymore, but that
doesn't cost anything, and might be used by some users.

I wrote this code in 15 years ago, and I'm pretty sure it was needed to
compile properly, else it would not be here. After, I do not remember
all details.

If you want to rewrite this part, I think it's ok, but you need to
support a dynamic location of the readline.h file (at least 3 places) as
it is today.
 Best Regards,
Eric


_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to