From: drh <> Date: Mon, 14 Oct 2024 10:45:02 +0000 (+0000) Subject: The CLI now default to ".crlf ON" in Windows. CSV output always uses CRLF on X-Git-Tag: version-3.47.0~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=39b9249562d460f1d1a372467b48308968fdf3b0;p=thirdparty%2Fsqlite.git The CLI now default to ".crlf ON" in Windows. CSV output always uses CRLF on all platforms. FossilOrigin-Name: 84d19f03b1989d665547745defcd95fc927f8389ed65c76195a39206435791ba --- diff --git a/manifest b/manifest index f233734dc9..e151a057b5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Be\sconsistent\sabout\susing\s"CRLF"\sinstead\sof\s"CRNL". -D 2024-10-14T09:19:02.237 +C The\sCLI\snow\sdefault\sto\s".crlf\sON"\sin\sWindows.\s\sCSV\soutput\salways\suses\sCRLF\son\nall\splatforms. +D 2024-10-14T10:45:02.572 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -771,7 +771,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 a4174d9d73223ccc9b6bfa98a2feccf6af9f6386a1bdcbf7a4c527909a130bba +F src/shell.c.in 3e53af7cc5dd0f4710e7249b66f522f43df20579bf9f5d36ba294f537fbe8d1d F src/sqlite.h.in 1def838497ad53c81486649ce79821925d1ac20a9843af317a344d507efe116e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2217,8 +2217,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 31c46e84fffe29c45fc63ae8cd1f96f42196f0ab56e72cd07b4eedbd9058e85b -R 0ddfce1b00f5e783e91c489309275ead +P ec4f4cfd5f8ca83fad4f08cf6566251d9c63e50a3a4284baca299bd94b047951 +R b04dc4d5fe6236e22abab8975f6627f9 U drh -Z 0bab3d34918042e28b7a5784677fe83e +Z 6ce380ef14a7f907fc64ecc1f59106c2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b820220c96..08c03b54af 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ec4f4cfd5f8ca83fad4f08cf6566251d9c63e50a3a4284baca299bd94b047951 +84d19f03b1989d665547745defcd95fc927f8389ed65c76195a39206435791ba diff --git a/src/shell.c.in b/src/shell.c.in index 31c4a51cb5..9f7ab6b34b 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1629,7 +1629,7 @@ static const char *modeDescr[] = { #define SEP_Tab "\t" #define SEP_Space " " #define SEP_Comma "," -#define SEP_CrLf "\n" /* Use ".crlf on" to get \r\n line endings */ +#define SEP_CrLf "\r\n" #define SEP_Unit "\x1F" #define SEP_Record "\x1E" @@ -2797,21 +2797,13 @@ static int shell_callback( for(i=0; icrlfMode && cli_strcmp(p->rowSeparator,SEP_CrLf)==0 ){ - sqlite3_fputs("\r\n", p->out); - }else{ - sqlite3_fputs(p->rowSeparator, p->out); - } + sqlite3_fputs(p->rowSeparator, p->out); } if( nArg>0 ){ for(i=0; icrlfMode && cli_strcmp(p->rowSeparator,SEP_CrLf)==0 ){ - sqlite3_fputs("\r\n", p->out); - }else{ - sqlite3_fputs(p->rowSeparator, p->out); - } + sqlite3_fputs(p->rowSeparator, p->out); } setCrlfMode(p); break; @@ -4956,7 +4948,7 @@ static const char *(azHelp[]) = { ".clone NEWDB Clone data into NEWDB from the existing database", #endif ".connection [close] [#] Open or close an auxiliary database connection", - ".crlf on|off Translate \\n to \\r\\n sometimes. Default OFF", + ".crlf ?on|off? Whether or not to use \\r\\n line endings", ".databases List names and files of attached databases", ".dbconfig ?op? ?val? List or change sqlite3_db_config() options", #if SQLITE_SHELL_HAVE_RECOVER @@ -8579,12 +8571,13 @@ static int do_meta_command(char *zLine, ShellState *p){ || cli_strncmp(azArg[0], "crnl",n)==0) ){ if( nArg==2 ){ +#ifdef _WIN32 p->crlfMode = booleanValue(azArg[1]); - setCrlfMode(p); - }else{ - sqlite3_fprintf(stderr, "crlf is currently %s\n", - p->crlfMode ? "ON" : "OFF"); +#else + p->crlfMode = 0; +#endif } + sqlite3_fprintf(stderr, "crlf is %s\n", p->crlfMode ? "ON" : "OFF"); }else if( c=='d' && n>1 && cli_strncmp(azArg[0], "databases", n)==0 ){ @@ -12604,6 +12597,9 @@ static void main_init(ShellState *data) { memset(data, 0, sizeof(*data)); data->normalMode = data->cMode = data->mode = MODE_List; data->autoExplain = 1; +#ifdef _WIN32 + data->crlfMode = 1; +#endif data->pAuxDb = &data->aAuxDb[0]; memcpy(data->colSeparator,SEP_Column, 2); memcpy(data->rowSeparator,SEP_Row, 2); @@ -12617,16 +12613,6 @@ 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 ".crlf on" - ** command to change into O_TEXT mode to do automatic NL-to-CRLF - ** conversions on output for Windows. - ** - ** End-of-line marks on CVS output is CRLF when in .crlf is on and - ** NL when .crlf is off. - */ - data->crlfMode = 0; } /*