mirror of
https://github.com/sqlite/sqlite.git
synced 2024-11-22 03:40:55 +01:00
Fix the CLI so that it can use either the canonical Antirez linenoise
(with HAVE_LINENOISE=1) or Steve Bennett's enhanced linenoise that works on the Win32 console as well as on Unix (with HAVE_LINENOISE=2). The ./configure script detects which one to use and sets HAVE_LINENOISE accordingly. FossilOrigin-Name: c0048e4482e9cb9662637899922af9609e7c8fb002a37b71e6181074df7a0dd1
This commit is contained in:
parent
7d7e82c9b1
commit
9bcb0a510f
15
auto.def
15
auto.def
@ -789,9 +789,18 @@ proc sqlite-check-line-editing {} {
|
||||
proj-fatal "Cannot find linenoise.h in $dirLn"
|
||||
}
|
||||
msg-result "Using linenoise from $dirLn"
|
||||
define CFLAGS_READLINE "-I$dirLn $dirLn/linenoise.c"
|
||||
define HAVE_LINENOISE 1
|
||||
sqlite-add-shell-opt -DHAVE_LINENOISE=1
|
||||
if {[file exists $dirLn/linenoise-ship.c]} {
|
||||
# HAVE_LINENOISE==2 means that the linenoise completion callback has an
|
||||
# extra userdata argument.
|
||||
define CFLAGS_READLINE "-I$dirLn $dirLn/linenoise-ship.c"
|
||||
define HAVE_LINENOISE 2
|
||||
sqlite-add-shell-opt -DHAVE_LINENOISE=2
|
||||
} else {
|
||||
# HAVE_LINENOISE==1 is the original Antirez linenoise
|
||||
define CFLAGS_READLINE "-I$dirLn $dirLn/linenoise.c"
|
||||
define HAVE_LINENOISE 1
|
||||
sqlite-add-shell-opt -DHAVE_LINENOISE=1
|
||||
}
|
||||
return "linenoise"
|
||||
} elseif {[opt-bool editline]} {
|
||||
# libedit mimics libreadline and on some systems does not have its
|
||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Clean\sup\sand\sadd\sdocs\sto\sthe\sTCL\svetting\ssteps.\sMake\swarning\sand\serror\smessages\sbold\sif\sstdout\sisatty.
|
||||
D 2024-10-30T05:07:18.996
|
||||
C Fix\sthe\sCLI\sso\sthat\sit\scan\suse\seither\sthe\scanonical\sAntirez\slinenoise\n(with\sHAVE_LINENOISE=1)\sor\sSteve\sBennett's\senhanced\slinenoise\sthat\sworks\non\sthe\sWin32\sconsole\sas\swell\sas\son\sUnix\s(with\sHAVE_LINENOISE=2).\s\sThe\n./configure\sscript\sdetects\swhich\sone\sto\suse\sand\ssets\sHAVE_LINENOISE\saccordingly.
|
||||
D 2024-10-30T14:03:56.112
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
|
||||
@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d
|
||||
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
|
||||
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
|
||||
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
||||
F auto.def 246f9d5fd2db744fd8670e2fc02ac2986501bc0fb96041bbe5891b80238e0be9
|
||||
F auto.def 2e458b180c7d6f765acd4c9f604d2087fb30114ae7343481e1ecfe7b6ddb16b5
|
||||
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
|
||||
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
|
||||
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
|
||||
@ -777,7 +777,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c c8a5372b97b2a2e972a280676f06ddb5b74e885d3b1f5ce383f839907b57ef68
|
||||
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
|
||||
F src/select.c 4b14337a2742f0c0beeba490e9a05507e9b4b12184b9cd12773501d08d48e3fe
|
||||
F src/shell.c.in b6b7944fc076c2fd29d38edb61e3da978e838e3f79e1cf2c96a1342c423b3892
|
||||
F src/shell.c.in 4eb010971da0a4b103af5853152e9c95b991174df75528fda6f333037f0007a0
|
||||
F src/sqlite.h.in 599203aa6cf3a662f879e7581f4b7f2678738c0b7c71ddda3c0cb5c59867c399
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
|
||||
@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
|
||||
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
|
||||
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 80584e165e4652e76cc3188befcee814f168298486743940bcf46696043686a0
|
||||
R 9bc2e5e8de07dc365525bf3b51622805
|
||||
U stephan
|
||||
Z f36698e72a5599d183442b07666428fe
|
||||
P 47157dcf9ec6b52b37578bcd5dc5ace8c36e62c8ca2625c94252c15db784b115
|
||||
R 61fb904d4434d51f1a06bd710d4e38ff
|
||||
U drh
|
||||
Z d06b56d237b61b23e8eb2bfeab607447
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
47157dcf9ec6b52b37578bcd5dc5ace8c36e62c8ca2625c94252c15db784b115
|
||||
c0048e4482e9cb9662637899922af9609e7c8fb002a37b71e6181074df7a0dd1
|
||||
|
@ -5795,15 +5795,22 @@ static char **readline_completion(const char *zText, int iStart, int iEnd){
|
||||
** Linenoise completion callback. Note that the 3rd argument is from
|
||||
** the "msteveb" version of linenoise, not the "antirez" version.
|
||||
*/
|
||||
static void linenoise_completion(const char *zLine, linenoiseCompletions *lc,
|
||||
void *pUserData){
|
||||
static void linenoise_completion(
|
||||
const char *zLine,
|
||||
linenoiseCompletions *lc
|
||||
#if HAVE_LINENOISE==2
|
||||
,void *pUserData
|
||||
#endif
|
||||
){
|
||||
i64 nLine = strlen(zLine);
|
||||
i64 i, iStart;
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
char *zSql;
|
||||
char zBuf[1000];
|
||||
|
||||
#if HAVE_LINENOISE==2
|
||||
UNUSED_PARAMETER(pUserData);
|
||||
#endif
|
||||
if( nLine>(i64)sizeof(zBuf)-30 ) return;
|
||||
if( zLine[0]=='.' || zLine[0]=='#') return;
|
||||
for(i=nLine-1; i>=0 && (isalnum(zLine[i]) || zLine[i]=='_'); i--){}
|
||||
@ -13196,7 +13203,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
if( zHistory ){ shell_read_history(zHistory); }
|
||||
#if (HAVE_READLINE || HAVE_EDITLINE) && !defined(SQLITE_OMIT_READLINE_COMPLETION)
|
||||
rl_attempted_completion_function = readline_completion;
|
||||
#elif HAVE_LINENOISE
|
||||
#elif HAVE_LINENOISE==1
|
||||
linenoiseSetCompletionCallback(linenoise_completion);
|
||||
#elif HAVE_LINENOISE==2
|
||||
linenoiseSetCompletionCallback(linenoise_completion, NULL);
|
||||
#endif
|
||||
data.in = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user