1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

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

@ -27,6 +27,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
/* Return true if the line is all zeros */
static int allZero(unsigned char *aLine){
@ -47,6 +48,11 @@ int main(int argc, char **argv){
int iPage; /* Current page number */
unsigned char aLine[16]; /* A single line of the file */
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++){
if( argv[i][0]=='-' ){
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]);
printf(" ");
for(j=0; j<16; j++){
char c = aLine[j];
fputc(c>=0x20 && c<=0x7e ? c : '.', stdout);
unsigned char c = (unsigned char)aLine[j];
fputc( bShow[c], stdout);
}
fputc('\n', stdout);
}