From 4875a3dd9b183dcd2256e2abfc4ccf7484c233b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 7 Dec 2022 13:17:14 +0100 Subject: New upstream version 4.0.2 --- src/utils/xb_tblinfo.cpp | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 src/utils/xb_tblinfo.cpp (limited to 'src/utils/xb_tblinfo.cpp') 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 + +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; +} -- cgit v1.2.3