#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; argc--; argv++; ErrorId usage = { E_FAILED, "Usage: joincheck [ -b branch -c client -C charset -p port -u user -d -v ] [ path ]" }; opts.Parse( argc, argv, "u:b:c:p:C:dv", OPT_OPT, usage, &e ); client.SetProtocol( "tag", "" ); StrPtr *s; if ( s = opts['c'] ) client.SetClient( s ); if ( s = opts['C'] ) client.SetCharset( s ); if ( s = opts['p'] ) client.SetPort( s ); if ( s = opts['u'] ) client.SetUser( s ); s = opts['b']; if ( opts['d'] ) { printf( "\n" ); printf( "%7s: %s\n", "User", client.GetUser().Text() ); printf( "%7s: %s\n", "Client", client.GetClient().Text() ); printf( "%7s: %s\n", "Port", client.GetPort().Text() ); printf( "%7s: %s\n", "Charset", client.GetCharset().Text() ); if ( s = opts['b'] ) printf( "%7s: %s\n", "Branch", s->Text() ); } if ( client.GetCharset().Length() ) client.SetTrans( (int)CharSetApi::Lookup( client.GetCharset().Text() ), 0, 0, 0 ); 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. |