From: larrybr Date: Fri, 14 Apr 2023 21:23:08 +0000 (+0000) Subject: Set CLI -utf8 option and build with line-editing package to be mutually exclusive... X-Git-Tag: version-3.42.0~141^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cdb8a698c1997327d4bf9c23d1c9b295db20d5d5;p=thirdparty%2Fsqlite.git Set CLI -utf8 option and build with line-editing package to be mutually exclusive. Integration of console-invasive UTF-8 handling with line-editing takeover of console may come later. FossilOrigin-Name: 047344a91583f273a55fe3659bb8020ffc947c05c4274fbda54ee0608e62adb1 --- diff --git a/manifest b/manifest index 6dfe5033f4..40333232b4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cure\sCLI\sdouble-prompting\s(by\sditching\sgcc\sfgetws()),\sgeneral\scleanup.\sWork\sremaining\sis\sto\savoid\seffect\sof\s-utf8\swhen\sa\sline\seditor\sis\slinked/used\sas\spart\sof\sCLI. -D 2023-04-14T19:56:32.111 +C Set\sCLI\s-utf8\soption\sand\sbuild\swith\sline-editing\spackage\sto\sbe\smutually\sexclusive.\sIntegration\sof\sconsole-invasive\sUTF-8\shandling\swith\sline-editing\stakeover\sof\sconsole\smay\scome\slater. +D 2023-04-14T21:23:08.731 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -626,7 +626,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 3e53e02ce87c9582bd7e7d22f13f4094a271678d9dc72820fa257a2abb5e4032 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 F src/select.c 93bb02212256b49a90589a4664031896e2b2991198153dff1a33a72f437dad94 -F src/shell.c.in 23c6ed8477303108f53ec73c8333aaff8d11267276f3852597304d8915bc55d7 +F src/shell.c.in 48ca1d8461e3f39bc10b7a4600a4e6770e83af5c22c97f6a6cbeb72cc073fdbb F src/sqlite.h.in 4fff9c6cc5d4cbba9532a668112efb6dc469c425e1a2196664d7c07d508363ef F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4 @@ -2052,8 +2052,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b4fa233d3dda54fa83771844cf5156bf1275c687925340af17a7713a9400dfef -R c50b2d60063b3025d3b72bba985f6bbb +P 73a5f54231e9f6ad8f013df3987ea48c516080f9193ed873b56f982ee75658c2 +R 6cbccd65b09f7c37b3a15e7a5991ab63 U larrybr -Z 16fa3e5dbb2e04c40e7812c85b6fd381 +Z d6006bc3d1035c124212e23fa4c9f69b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d526131411..aad25c04fc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -73a5f54231e9f6ad8f013df3987ea48c516080f9193ed873b56f982ee75658c2 \ No newline at end of file +047344a91583f273a55fe3659bb8020ffc947c05c4274fbda54ee0608e62adb1 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 2d954bb218..6aaf5cb33e 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -449,7 +449,13 @@ static int bail_on_error = 0; */ static int stdin_is_interactive = 1; -#if (defined(_WIN32) || defined(WIN32)) && !defined(SQLITE_SHELL_FIDDLE) +#if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE +# define SHELL_WIN_UTF8_OPT 1 +#else +# define SHELL_WIN_UTF8_OPT 0 +#endif + +#if SHELL_WIN_UTF8_OPT /* ** Setup console for UTF-8 input/output when following variable true. */ @@ -588,7 +594,7 @@ static char *dynamicContinuePrompt(void){ } #endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */ -#if (defined(_WIN32) || defined(WIN32)) && !defined(SQLITE_SHELL_FIDDLE) +#if SHELL_WIN_UTF8_OPT /* Following variables are used for -utf8 operation. */ static int stdinEof = 0; /* EOF seen on console input */ static int infsMode; /* Input file stream mode upon shell start */ @@ -696,7 +702,7 @@ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){ } # define fgets(b,n,f) utf8_fgets(b,n,f) -#endif /* (defined(_WIN32)||defined(WIN32)) && !defined(SQLITE_SHELL_FIDDLE) */ +#endif /* SHELL_WIN_UTF8_OPT */ /* ** Render output like fprintf(). Except, if the output is going to the @@ -921,7 +927,11 @@ static char *local_getline(char *zLine, FILE *in){ /* For interactive input on Windows systems, without -utf8, ** translate the multi-byte characterset characters into UTF-8. ** This is the translation that predates the -utf8 option. */ - if( stdin_is_interactive && in==stdin && !console_utf8 ){ + if( stdin_is_interactive && in==stdin +# if SHELL_WIN_UTF8_OPT + && !console_utf8 +# endif /* SHELL_WIN_UTF8_OPT */ + ){ char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); if( zTrans ){ i64 nTrans = strlen(zTrans)+1; @@ -11705,7 +11715,7 @@ static const char zOptions[] = " -stats print memory stats before each finalize\n" " -table set output mode to 'table'\n" " -tabs set output mode to 'tabs'\n" -#if (defined(_WIN32) || defined(WIN32)) && !defined(SQLITE_SHELL_FIDDLE) +#if SHELL_WIN_UTF8_OPT " -utf8 setup interactive console code page for UTF-8\n" #endif " -version show SQLite version\n" @@ -11851,7 +11861,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ stdin_is_interactive = isatty(0); stdout_is_console = isatty(1); #endif -#if (defined(_WIN32) || defined(WIN32)) && !defined(SQLITE_SHELL_FIDDLE) +#if SHELL_WIN_UTF8_OPT atexit(instream_restore); /* Needs revision for CLI as library call */ #endif #ifdef SQLITE_DEBUG @@ -12244,9 +12254,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ }else if( cli_strcmp(z,"-batch")==0 ){ stdin_is_interactive = 0; }else if( cli_strcmp(z,"-utf8")==0 ){ -#if (defined(_WIN32) || defined(WIN32)) && !defined(SQLITE_SHELL_FIDDLE) +#if SHELL_WIN_UTF8_OPT console_utf8 = 1; -#endif +#endif /* SHELL_WIN_UTF8_OPT */ }else if( cli_strcmp(z,"-heap")==0 ){ i++; }else if( cli_strcmp(z,"-pagecache")==0 ){ @@ -12324,7 +12334,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ } data.cMode = data.mode; } -#if (defined(_WIN32) || defined(WIN32)) && !defined(SQLITE_SHELL_FIDDLE) +#if SHELL_WIN_UTF8_OPT if( console_utf8 && stdin_is_interactive ){ instream_prepare(); }else{