summaryrefslogtreecommitdiff
path: root/src/utils/xb_tblinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/xb_tblinfo.cpp')
-rwxr-xr-xsrc/utils/xb_tblinfo.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/utils/xb_tblinfo.cpp b/src/utils/xb_tblinfo.cpp
new file mode 100755
index 0000000..884ce5e
--- /dev/null
+++ b/src/utils/xb_tblinfo.cpp
@@ -0,0 +1,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;
+}