/* * Copyright 1995, 2011 Perforce Software. All rights reserved. * * This file is part of Perforce - the FAST SCM System. */ # include <clientapi.h> # include <clientprog.h> # include <timer.h> # include <progress.h> ClientProgressText::ClientProgressText( int ty ) : typeOfProgress( ty ), total( 0 ), cnt( 0 ), backup( 0 ) { } ClientProgressText::~ClientProgressText() { } void ClientProgressText::Description( const StrPtr *description, int units ) { desc.Set( description ); printf( "%s ", desc.Text() ); cnt = 0; backup = 0; total = 0; } void ClientProgressText::Total( long t ) { total = t; } int ClientProgressText::Update( long pos ) { StrBuf res; if( cnt == 40 ) { // every 40 updates, rewrite description printf( "\r%s ", desc.Text() ); backup = 0; cnt = 0; } if( total ) { int pct = int(100.0 * pos / total); res << pct; res.Extend( '%' ); } else res << pos; res.Extend( ' ' ); res.Extend( "|/-\\"[ cnt++ & 3 ] ); res.Terminate(); while( backup-- > 0 ) putchar( '\b' ); fputs( res.Text(), stdout ); backup = res.Length(); fflush(stdout); return 0; } void ClientProgressText::Done( int fail ) { if( backup ) putchar( '\b' ); printf( fail == CPP_FAILDONE ? "failed!\n" : "finishing\n"); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 18760 | rlranft |
Populate -o //guest/perforce_software/p4/... //guest/rlranft/p4/.... |
||
//guest/perforce_software/p4/2015-1/client/clientprog.cc | |||||
#1 | 15903 | Matt Attaway | Everything should be happy now between the Workshop and the depot paths | ||
//guest/perforce_software/p4/2015_1/client/clientprog.cc | |||||
#1 | 15901 | Matt Attaway | Clean up code to fit modern Workshop naming standards | ||
//guest/perforce_software/p4/2015.1/client/clientprog.cc | |||||
#1 | 12190 | Matt Attaway | Initial drop of 2015.1 p4/p4api source |