From: stephan Date: Fri, 28 Mar 2025 15:36:49 +0000 (+0000) Subject: CLI shell: make (.output off) an alias for (.output /dev/null) or (.output nul),... X-Git-Tag: major-release~147 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd1cbd641c1423d1cc19307d8ca5d2d62f22288f;p=thirdparty%2Fsqlite.git CLI shell: make (.output off) an alias for (.output /dev/null) or (.output nul), depending on the platform. Discussed in [forum:633979ce307f1cc6|forum post 633979ce307f1cc6]. FossilOrigin-Name: 0f11087b84753576425823e10a7eeff45af02f3c0135dee72dec5019c8127500 --- diff --git a/manifest b/manifest index 60ff7cf960..c21a71bcb8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Configure/make\sdoc\stweaks.\sNo\sfunctional\schanges. -D 2025-03-28T14:32:01.403 +C CLI\sshell:\smake\s(.output\soff)\san\salias\sfor\s(.output\s/dev/null)\sor\s(.output\snul),\sdepending\son\sthe\splatform.\sDiscussed\sin\s[forum:633979ce307f1cc6|forum\spost\s633979ce307f1cc6]. +D 2025-03-28T15:36:49.069 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -786,7 +786,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 20e1fbe8f840ffc0cd835e33f68a802a22e34faa918d7a269f3de242fda02f99 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c bfe14cdfceba54744b1c6c29099313f5173a0793dfaff0cd484774e9d05dbeab -F src/shell.c.in 5acad3e594edad8de9f3e7f9a5ee8acfe934497ed642d29dc8fdd6665e25fdbf +F src/shell.c.in 213e2fd53d845432e47c0810eafa8eb66dd5295ae27f0313779c73df32d62fee F src/sqlite.h.in fd70afd92948cf7cc93f687ac960bad1b0b6fbc436752419eff2fd65a1809380 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2216,8 +2216,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 121f4d97f9a855131859d342bc2ade5f8c34ba7732029ae156d02cec7cb6dd85 -R 316f6c20de78edd89bb6149a00675932 +P dbcc03bd7a727f4643f18a814bb9fd9071c0355f98dd064286240f2af361ee7f +R fd12f331319e6fbbfa3b284204829987 U stephan -Z 912d6d89057979bf1659ce4d8c2a2bd3 +Z 41a98a24cb0e972787f7e1497beff5d6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 792af4ff5e..c83cc1ec78 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dbcc03bd7a727f4643f18a814bb9fd9071c0355f98dd064286240f2af361ee7f +0f11087b84753576425823e10a7eeff45af02f3c0135dee72dec5019c8127500 diff --git a/src/shell.c.in b/src/shell.c.in index 4efcfee953..76874e7f72 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -5238,6 +5238,7 @@ static const char *(azHelp[]) = { #ifndef SQLITE_SHELL_FIDDLE ".output ?FILE? Send output to FILE or stdout if FILE is omitted", " If FILE begins with '|' then open it as a pipe.", + " If FILE is 'off' then output is disabled.", " Options:", " --bom Prefix output with a UTF8 byte-order mark", " -e Send output to the system text editor", @@ -10271,7 +10272,15 @@ static int do_meta_command(char *zLine, ShellState *p){ goto meta_command_exit; } }else if( zFile==0 && eMode==0 ){ - zFile = sqlite3_mprintf("%s", z); + if( cli_strcmp(z, "off")==0 ){ +#ifdef _WIN32 + zFile = sqlite3_mprintf("nul"); +#else + zFile = sqlite3_mprintf("/dev/null"); +#endif + }else{ + zFile = sqlite3_mprintf("%s", z); + } if( zFile && zFile[0]=='|' ){ while( i+1