blob: 884ce5e56e821c5265ee5dfe163f77de694266bf (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/* xb_dumpmdx.cpp
XBase64 Software Library
Copyright (c) 1997,2003,2014,2021 Gary A Kunkel
The xb64 software library is covered under
the terms of the GPL Version 3, 2007 license.
Email Contact:
xb64-devel@lists.sourceforge.net
xb64-users@lists.sourceforge.net
*/
#include <xbase.h>
using namespace xb;
int main( int ac, char ** av ){
xbXBase x;
xbBool bHdr = xbFalse;
xbBool bMdxFound = xbFalse;
xbInt16 iRc;
xbString sTagName;
xbDbf *MyFile = NULL;
x.EnableMsgLogging();
x.SetLogSize( 1000000L );
if( ac <= 1 ) {
std::cout << "\nUsage: xb_dumpmdx filename.DBF -h -tTAGNAME...\n";
std::cout << "-h dump mdx file header (default)\n";
std::cout << "-tTAGNAME where TAGNAME is the name of a tag for extract\n";
return 1;
}
if( ac > 2 ){
for( int i = 1; i< ac; i++ ){
if( strstr( av[i], "-h" ))
bHdr = xbTrue;
else if( strstr( av[i], "-t" ))
sTagName.Set( av[i]+2 );
}
}
if( bHdr == xbFalse && sTagName == "" )
bHdr = xbTrue;
// std::cout << "Hdr = " << bHdr << std::endl;
if( sTagName != "" )
std::cout << "Tag = " << sTagName.Str() << std::endl;
if(( iRc = x.OpenHighestVersion( av[1], "", &MyFile )) != XB_NO_ERROR ){
std::cout << "Could not open file iRc = " << iRc << " file = " << av[1] << std::endl;
x.DisplayError( iRc );
return 0;
}
MyFile->DumpHeader( 4 );
// for each mdx file, dump the header
xbIxList *ixl = MyFile->GetIxList();
xbIx *ixp;
xbString sFileType;
while( ixl ){
ixp = ixl->ix;
ixp->GetFileType( sFileType );
if( sFileType == "MDX" ){
bMdxFound = xbTrue;
if( bHdr ){
// std::cout << "MDX header\n";
ixp->DumpHeader( 1, 3 );
}
}
ixl = ixl->next;
}
if( !bMdxFound )
std::cout << "No MDX index for file." << std::endl;
MyFile->Close();
delete MyFile;
return 0;
}
|