#include <clientapi.h> #include <debug.h> #include <mapapi.h> #include <options.h> #include <i18napi.h> #include "joincheck.h" int main( int argc, char** argv ) { ClientApi client; Error e; JoinCheck check( &client, &e ); Options opts; StrBuf p4port; argc--; argv++; ErrorId usage = { E_FAILED, "Usage: joincheck [ -b branch -c client -k charset -p port -u user -d -v ] [ path ]" }; opts.Parse( argc, argv, "u:b:c:p:k:dv", OPT_OPT, usage, &e ); client.SetProtocol( "tag", "" ); if( opts['u'] && opts['d']) { printf("\n%7s: %s\n","User",(opts['u'])->Text()); } else if( opts['d'] ) { printf("\n%7s: %s\n","User",client.GetUser()); } if( opts['c'] && opts['d'] ) { printf("%7s: %s\n","Client",(opts['c'])->Text()); } else if( opts['d'] ) { printf("%7s: %s\n","Client",client.GetClient()); } if( opts['b'] && opts['d'] ) { printf("%7s: %s\n","Branch",(opts['b'])->Text()); } if( opts['p'] ) { if( opts['d'] ) { printf("%7s: %s\n","Port",(opts['p'])->Text()); } p4port = (opts['p'])->Text(); client.SetPort(&p4port); } else if( opts['d'] ) { printf("%7s: %s\n","Port",client.GetPort()); } if( opts['k'] ) { if( opts['d'] ) { printf("%7s: %s\n\n","Charset",(opts['k'])->Text()); } client.SetCharset((opts['k'])->Text()); client.SetTrans((int) CharSetApi::Lookup( client.GetCharset().Text() ), 0, 0, 0); } else if( opts['d'] ) { printf("%7s: %s\n","Charset",client.GetCharset()); } client.Init( &e ); if ( e.Test() ) { check.Message( &e ); return 1; } check.LoadProtect( opts['u'] ); check.LoadBranch( opts['b'] ); check.LoadClient( opts['c'] ); client.Final( &e ); if ( e.Test() ) { check.Message( &e ); return 1; } // Set joinmax tunables way high before doing any joins. p4debug.SetLevel( "map.joinmax1=999999999" ); p4debug.SetLevel( "map.joinmax2=999999999" ); check.LoadPath( argc ? argv[0] : 0 ); check.DoJoins(); MapApi *j = check.Join(); printf( "Joined map size: %d lines\n", j->Count() ); printf( "Most wild line: %d wildcards\n", check.MaxWild( j ) ); if ( opts['v'] ) { printf( "\nJoined map:\n" ); check.DumpView( j ); } return 0; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 7800 | Stephen Moon | .Text() was appended to the Get*() calls | ||
#3 | 7789 | Stephen Moon | Integrating the changes that Sam made to my changes | ||
#2 | 7783 | Stephen Moon | Added -k charset -p port options to the program | ||
#1 | 7782 | Stephen Moon | Integrating the latest joincheck code from Sam's branch | ||
//guest/sam_stafford/joincheck/main.cpp | |||||
#4 | 7730 | Sam Stafford | Raise joinmax tunables, and update the build. | ||
#3 | 7729 | Sam Stafford | Whoops, forgot to update the usage string. | ||
#2 | 7728 | Sam Stafford |
Add an option for a file path, and another join of the protect table after the branch map. |
||
#1 | 7727 | Sam Stafford |
MapApi-based tool for displaying joins of protects, client, and optionally a branch view. |