From: drh <> Date: Sat, 14 Sep 2024 11:23:57 +0000 (+0000) Subject: Add the --logfile FILE option for debugging. X-Git-Tag: version-3.47.0~118^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15e05eab32a257172e031c7c426ebda063351801;p=thirdparty%2Fsqlite.git Add the --logfile FILE option for debugging. FossilOrigin-Name: 30e1b92d5663e24d2f325f2bab35f81b55848ef39d15688e40b9005269626303 --- diff --git a/manifest b/manifest index a7fa243946..fc99c17e78 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\serror\smessages\scoming\sout\sof\ssqlite3-rsync. -D 2024-09-14T10:59:32.119 +C Add\sthe\s--logfile\sFILE\soption\sfor\sdebugging. +D 2024-09-14T11:23:57.579 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2174,7 +2174,7 @@ F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d40618 x F tool/split-sqlite3c.tcl 5aa60643afca558bc732b1444ae81a522326f91e1dc5665b369c54f09e20de60 F tool/sqldiff.c 847fc8fcfddf5ce4797b7394cad6372f2f5dc17d8186e2ef8fb44d50fae4f44a -F tool/sqlite3-rsync.c a92a4fa8752690546aada08fa04250c2c0c9a600156193a862ad27ebe4bbf34e +F tool/sqlite3-rsync.c 8cef3550aa9eb94e243c833c53e66cfe534e62d33e5490b2f884d4c73a184fb2 F tool/sqlite3_analyzer.c.in 8da2b08f56eeac331a715036cf707cc20f879f231362be0c22efd682e2b89b4f F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 @@ -2213,8 +2213,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 105ec44b470318fc9ff1773027c4064343f224068c9b6e71c5618f18f7dfcc3f -R 11b249479d28ab8ab57cb1dd31e2a2f3 +P 452fb6de3984c3cb10d30b51dcdb2574578ca128a0c519b2bd43df0bdd343083 +R a57a86421474386b5ed9caf031db8013 U drh -Z 8a831d8281ba8f908e1ad29b156358da +Z 4ff8584d3a3a5f66a03fe1e9c7d688fd # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c542164d90..0c1a83e195 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -452fb6de3984c3cb10d30b51dcdb2574578ca128a0c519b2bd43df0bdd343083 +30e1b92d5663e24d2f325f2bab35f81b55848ef39d15688e40b9005269626303 diff --git a/tool/sqlite3-rsync.c b/tool/sqlite3-rsync.c index d3898b49a0..fd2cb068e6 100644 --- a/tool/sqlite3-rsync.c +++ b/tool/sqlite3-rsync.c @@ -45,6 +45,7 @@ struct SQLiteRsync { const char *zReplica; /* Name of the replica */ FILE *pOut; /* Transmit to the other side */ FILE *pIn; /* Receive from the other side */ + FILE *pLog; /* Duplicate output here if not NULL */ sqlite3 *db; /* Database connection */ int nErr; /* Number of errors encountered */ u8 eVerbose; /* Bigger for more output. 0 means none. */ @@ -840,6 +841,7 @@ static int writeUint32(SQLiteRsync *p, unsigned int x){ buf[1] = x & 0xff; x >>= 8; buf[0] = x; + if( p->pLog ) fwrite(buf, sizeof(buf), 1, p->pLog); if( fwrite(buf, sizeof(buf), 1, p->pOut)!=1 ){ p->nErr++; return 1; @@ -859,6 +861,7 @@ int readByte(SQLiteRsync *p){ /* Write a single byte into the wire. */ void writeByte(SQLiteRsync *p, int c){ + if( p->pLog ) fputc(c, p->pLog); fputc(c, p->pOut); p->nOut++; } @@ -898,6 +901,7 @@ void readBytes(SQLiteRsync *p, int nByte, void *pData){ /* Write an array of bytes onto the wire. */ void writeBytes(SQLiteRsync *p, int nByte, const void *pData){ + if( p->pLog ) fwrite(pData, 1, nByte, p->pLog); if( fwrite(pData, 1, nByte, p->pOut)==nByte ){ p->nOut += nByte; }else{ @@ -1576,6 +1580,15 @@ int main(int argc, char const * const *argv){ zExe = cli_opt_val; continue; } + if( strcmp(z, "--logfile")==0 ){ + if( ctx.pLog ) fclose(ctx.pLog); + ctx.pLog = fopen(argv[++i],"wb"); + if( ctx.pLog==0 ){ + fprintf(stderr, "cannot open \"%s\" for writing\n", argv[i]); + return 1; + } + continue; + } if( strcmp(z, "-help")==0 || strcmp(z, "--help")==0 || strcmp(z, "-?")==0 ){ @@ -1714,6 +1727,7 @@ int main(int argc, char const * const *argv){ } originSide(&ctx); } + if( ctx.pLog ) fclose(ctx.pLog); tmEnd = currentTime(); tmElapse = tmEnd - tmStart; /* Elapse time in milliseconds */ if( ctx.nErr ){