# include "clientapi.h" class ClientUser2 : public ClientUser { public: virtual void OutputError( const_char *errBuf ); virtual void OutputStat( StrDict *varList ); } ; class ClientUser1 : public ClientUser { public: virtual void OutputStat( StrDict *varList ); void Init(); void Final(); private: ClientUser2 ui2; ClientApi client2; Error e2; } ; void ClientUser1::OutputStat( StrDict *varList ) { StrPtr *mapstate; StrPtr *client; StrPtr *owner; StrPtr *host; char file[] = "//depot/foo"; char *filep = &file[0]; mapstate = varList->GetVar( "MapState" ); if( mapstate->Atoi() ) return; client = varList->GetVar( "client" ); owner = varList->GetVar( "Owner" ); host = varList->GetVar( "Host" ); client2.SetClient( client ); client2.SetUser( owner ); if( host->Length() ) client2.SetHost( host ); printf( "Executing p4 -c %s -u %s ", client->Text(), owner->Text() ); if( host->Length() ) printf( "-H %s ", host->Text() ); printf( "fstat %s\n", file ); client2.SetArgv( 1, &filep ); client2.Run( "fstat", &ui2 ); } void ClientUser1::Init() { client2.Init( &e2 ); } void ClientUser1::Final() { client2.Final( &e2 ); } void ClientUser2::OutputError( const_char *errBuf ) { } void ClientUser2::OutputStat( StrDict *varList ) { } int main( int argc, char **argv ); int main( int argc, char **argv ) { ClientUser1 ui; ClientApi client; Error e; // Any special protocol mods client.SetProtocol( "tag", "" ); // Connect to server client.Init( &e ); ui.Init(); client.Run( "clients", &ui ); // Close connection client.Final( &e ); ui.Final(); return 0; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 1652 | Michael Shields |
setmapstate utility for attempting to set the MapState flag in a 2002.1 (or greater) server's clients. It attempts to set the MapState flag by asking the server to execute p4 fstat //depot/foo for each client. If any of the server's users have a password defined, you'll need some additional magic (ask me). |