From: drh <> Date: Tue, 8 Oct 2024 15:11:43 +0000 (+0000) Subject: Additional improvements to the behavior of ".crnl" in the CLI. The default X-Git-Tag: version-3.47.0~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab85d9abd6e5ed5997387c9db31dd6dfaece2681;p=thirdparty%2Fsqlite.git Additional improvements to the behavior of ".crnl" in the CLI. The default output mode is O_BINARY so that results are identical on Windows and non-Windows systems. On Windows you can optionally do ".crnl on" to enable NL-to-CRLF conversion on output. Output to Windows console is always O_U8TEXT and so is unaffected by the .crnl setting. FossilOrigin-Name: dbfc10b8981bcce4f875c4adef43f398871b41551074445087e343ded50253c5 --- diff --git a/manifest b/manifest index 8fe0047b29..7f6a38ca30 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\s.crnl\scommand\sin\sthe\sshell\sso\sthat\sit\sdoes\snot\sget\sundone\sby\ncalls\sto\sprint\sa\squoted\sstring\sor\sCSV\soutput. -D 2024-10-08T14:07:28.260 +C Additional\simprovements\sto\sthe\sbehavior\sof\s".crnl"\sin\sthe\sCLI.\s\sThe\sdefault\noutput\smode\sis\sO_BINARY\sso\sthat\sresults\sare\sidentical\son\sWindows\sand\nnon-Windows\ssystems.\s\sOn\sWindows\syou\scan\soptionally\sdo\s".crnl\son"\sto\senable\nNL-to-CRLF\sconversion\son\soutput.\s\sOutput\sto\sWindows\sconsole\sis\salways\nO_U8TEXT\sand\sso\sis\sunaffected\sby\sthe\s.crnl\ssetting. +D 2024-10-08T15:11:43.353 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -770,7 +770,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 188b1fe5e403e8e0638e0aa1151a95d47e841ddaf0545973cae09e4a6cef4d98 +F src/shell.c.in 01f24bedda2d555f3f6782c0a68c3ca8deaf5a310a0bbec034544eade146fab5 F src/sqlite.h.in 1def838497ad53c81486649ce79821925d1ac20a9843af317a344d507efe116e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2216,8 +2216,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 39a56a23fec24dd713905457b6d4ed7c148f88e325a26c376f1e6daf147c69c8 -R f65d905956fc73a7bb20b3c2e0376b8f +P 6b932337c8dee3e52b472a38984e91b5091f3d90c41ac1cc171fa4149cc491c5 +R e82f4f1afba280f0e1242353ec41fc12 U drh -Z b2ad2cadf0ade220cb843ebb395ae876 +Z 8e8e0c8d96720025c8b99c6e17a99bf2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3f330f95b5..9d63130107 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6b932337c8dee3e52b472a38984e91b5091f3d90c41ac1cc171fa4149cc491c5 +dbfc10b8981bcce4f875c4adef43f398871b41551074445087e343ded50253c5 diff --git a/src/shell.c.in b/src/shell.c.in index 0485fb2a23..3f894e973a 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -6436,6 +6436,7 @@ static void output_redir(ShellState *p, FILE *pfNew){ sqlite3_fputs("Output already redirected.\n", stderr); }else{ p->out = pfNew; + setCrnlMode(p); if( p->mode==MODE_Www ){ sqlite3_fputs( "\n" @@ -6491,6 +6492,7 @@ static void output_reset(ShellState *p){ } p->outfile[0] = 0; p->out = stdout; + setCrnlMode(p); } #else # define output_redir(SS,pfO) @@ -10239,7 +10241,6 @@ static int do_meta_command(char *zLine, ShellState *p){ #ifdef SQLITE_OMIT_POPEN eputz("Error: pipes are not supported in this OS\n"); rc = 1; - p->out = stdout; #else p->in = sqlite3_popen(azArg[1]+1, "r"); if( p->in==0 ){ @@ -12620,6 +12621,14 @@ static void main_init(ShellState *data) { sqlite3_config(SQLITE_CONFIG_MULTITHREAD); sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> "); sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> "); + + /* By default, come up in O_BINARY mode. That way, the default output is + ** the same for Windows and non-Windows systems. Use the ".crnl on" + ** command to change into O_TEXT mode to do automatic NL-to-CRLF + ** conversions on output for Windows. Windows console output is not + ** subject to the crnlMode setting and is unaffected either way. This + ** setting only affects output going into a file or pipe. */ + data->crnlMode = 0; } /*