SQLite Forum

[PATCH] set readline application name
Login

[PATCH] set readline application name

(1) By anonymous on 2020-12-29 20:00:49 [source]

Hello,

I wanted to ask wether you would consider adding this patch, that sets the
readline application name. This allows for conditional readline configuration
per application[0]. The patch is attached. To check wether or not the
application name is set in the build see this[1]. Details about that variable
can be found here[2].

Thanks for considering.

[0]: https://web.mit.edu/gnu/doc/html/rlman_1.html#SEC10
[1]: https://stackoverflow.com/questions/27181517/readline-application-name
[2]: https://web.mit.edu/gnu/doc/html/rlman_2.html
  

diff --git a/src/shell.c.in b/src/shell.c.in
index 80bc261..58f7193 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -11310,6 +11310,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
       }
       if( zHistory ){ shell_read_history(zHistory); }
 #if HAVE_READLINE || HAVE_EDITLINE
+      rl_readline_name = "sqlite";
       rl_attempted_completion_function = readline_completion;
 #elif HAVE_LINENOISE
       linenoiseSetCompletionCallback(linenoise_completion);

(2) By Warren Young (wyoung) on 2020-12-29 21:41:47 in reply to 1 [link] [source]

Are you asking for this in order to get conditional inputrc parsing or for some other reason?

(3) By anonymous on 2020-12-29 21:45:43 in reply to 2 [link] [source]

Yes, mostly for the conditional parsing. And I dont think it has any negative effect. Unless I am missing something.