diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/3rdparty/kexisql/tool/diffdb.c | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/3rdparty/kexisql/tool/diffdb.c')
-rw-r--r-- | kexi/3rdparty/kexisql/tool/diffdb.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/kexi/3rdparty/kexisql/tool/diffdb.c b/kexi/3rdparty/kexisql/tool/diffdb.c new file mode 100644 index 00000000..0537d387 --- /dev/null +++ b/kexi/3rdparty/kexisql/tool/diffdb.c @@ -0,0 +1,44 @@ +/* +** A utility for printing the differences between two SQLite database files. +*/ +#include <stdio.h> +#include <ctype.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdlib.h> + + +#define PAGESIZE 1024 +static int db1 = -1; +static int db2 = -1; + +int main(int argc, char **argv){ + int iPg; + unsigned char a1[PAGESIZE], a2[PAGESIZE]; + if( argc!=3 ){ + fprintf(stderr,"Usage: %s FILENAME FILENAME\n", argv[0]); + exit(1); + } + db1 = open(argv[1], O_RDONLY); + if( db1<0 ){ + fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]); + exit(1); + } + db2 = open(argv[2], O_RDONLY); + if( db2<0 ){ + fprintf(stderr,"%s: can't open %s\n", argv[0], argv[2]); + exit(1); + } + iPg = 1; + while( read(db1, a1, PAGESIZE)==PAGESIZE && read(db2,a2,PAGESIZE)==PAGESIZE ){ + if( memcmp(a1,a2,PAGESIZE) ){ + printf("Page %d\n", iPg); + } + iPg++; + } + printf("%d pages checked\n", iPg-1); + close(db1); + close(db2); +} |