Update the dbtotxt utility program so that it does not output characters that

are special to TCL, thus making the output of dbtotxt easier to insert into
test scripts.

FossilOrigin-Name: 48438bb35b48955a1df83ef90f0ef6c9cfed0b16d2e938f36d74ad9d53b4b5b4
This commit is contained in:
drh 2018-12-21 22:11:37 +00:00
parent cde4bf8ba7
commit a86c8ce940
3 changed files with 15 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Improved\sdetection\sof\sshadow\stable\scorruption\sin\sRTREE. C Update\sthe\sdbtotxt\sutility\sprogram\sso\sthat\sit\sdoes\snot\soutput\scharacters\sthat\nare\sspecial\sto\sTCL,\sthus\smaking\sthe\soutput\sof\sdbtotxt\seasier\sto\sinsert\sinto\ntest\sscripts.
D 2018-12-21T22:08:59.777 D 2018-12-21T22:11:37.526
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in d8b254f8bb81bab43c340d70d17dc3babab40fcc8a348c8255881f780a45fee6 F Makefile.in d8b254f8bb81bab43c340d70d17dc3babab40fcc8a348c8255881f780a45fee6
@ -1699,7 +1699,7 @@ F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367
F tool/cg_anno.tcl f95b0006c52cf7f0496b506343415b6ee3cdcdd3 x F tool/cg_anno.tcl f95b0006c52cf7f0496b506343415b6ee3cdcdd3 x
F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
F tool/dbhash.c a06228aa21ebc4e6ea8daa486601d938499238a5 F tool/dbhash.c a06228aa21ebc4e6ea8daa486601d938499238a5
F tool/dbtotxt.c 1655f60fd7b24a3e7a25d01cdb3a6a4785f30112213b08ff83a27ae7ef2dd13e F tool/dbtotxt.c 249536df1f4b540b275d3e20fbe1421e28e5a92db3498c0fb065d88b60bf6eb8
F tool/dbtotxt.md c9a57af8739957ef36d2cfad5c4b1443ff3688ed33e4901ee200c8b651f43f3c F tool/dbtotxt.md c9a57af8739957ef36d2cfad5c4b1443ff3688ed33e4901ee200c8b651f43f3c
F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2 F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
F tool/fast_vacuum.c 5ba0d6f5963a0a63bdc42840f678bad75b2ebce1 F tool/fast_vacuum.c 5ba0d6f5963a0a63bdc42840f678bad75b2ebce1
@ -1791,7 +1791,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P da587d18575ac06a6b65fec1d106f0cc65bc10f493ca6c6b99117a2162d15a52 P b39bf4356e6bcf1d8442721d6cbbfe06caba01325104fb469da8fe69e1f623a2
R 248bca4ac4fc95678d2d785205706e52 R 3408a85b9c4129beca4542bd35c340d6
U drh U drh
Z 13f01e556de62866a8c0edd7feaff34e Z a34a043ff225af5ec4da7a2cecb32954

View File

@ -1 +1 @@
b39bf4356e6bcf1d8442721d6cbbfe06caba01325104fb469da8fe69e1f623a2 48438bb35b48955a1df83ef90f0ef6c9cfed0b16d2e938f36d74ad9d53b4b5b4

View File

@ -27,6 +27,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
/* Return true if the line is all zeros */ /* Return true if the line is all zeros */
static int allZero(unsigned char *aLine){ static int allZero(unsigned char *aLine){
@ -47,6 +48,11 @@ int main(int argc, char **argv){
int iPage; /* Current page number */ int iPage; /* Current page number */
unsigned char aLine[16]; /* A single line of the file */ unsigned char aLine[16]; /* A single line of the file */
unsigned char aHdr[100]; /* File header */ unsigned char aHdr[100]; /* File header */
unsigned char bShow[256]; /* Characters ok to display */
memset(bShow, '.', sizeof(bShow));
for(i=' '; i<='~'; i++){
if( i!='{' && i!='}' && i!='"' && i!='\\' ) bShow[i] = i;
}
for(i=1; i<argc; i++){ for(i=1; i<argc; i++){
if( argv[i][0]=='-' ){ if( argv[i][0]=='-' ){
const char *z = argv[i]; const char *z = argv[i];
@ -129,8 +135,8 @@ int main(int argc, char **argv){
for(j=0; j<16; j++) printf(" %02x", aLine[j]); for(j=0; j<16; j++) printf(" %02x", aLine[j]);
printf(" "); printf(" ");
for(j=0; j<16; j++){ for(j=0; j<16; j++){
char c = aLine[j]; unsigned char c = (unsigned char)aLine[j];
fputc(c>=0x20 && c<=0x7e ? c : '.', stdout); fputc( bShow[c], stdout);
} }
fputc('\n', stdout); fputc('\n', stdout);
} }