FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sqlcipher/tool/diffdb.c at master · PHPDOTSQL/sqlcipher · GitHub
PHPDOTSQL
/
sqlcipher
Public
forked from
sqlcipher/sqlcipher
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
sqlcipher
/
tool
/
diffdb.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (41 loc) · 976 Bytes
Breadcrumbs
sqlcipher
/
tool
/
diffdb.c
Copy path
File metadata and controls
44 lines (41 loc) · 976 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
);
}
Back
|
FazBrowse Home
|
New Git URL