(trunk daemon) #1833: Sum-total line of speed Up and Down colums, at the end of the transmission-remote -l report
This commit is contained in:
parent
130cb762d9
commit
852c61afe1
|
@ -15,11 +15,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h> /* strcmp */
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h> /* getcwd */
|
||||
#else
|
||||
#include <unistd.h> /* getcwd */
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#include <direct.h> /* getcwd */
|
||||
#else
|
||||
#include <unistd.h> /* getcwd */
|
||||
#endif
|
||||
|
||||
#include <libevent/event.h>
|
||||
|
||||
|
@ -131,18 +131,18 @@ static int debug = 0;
|
|||
static char * auth = NULL;
|
||||
static char * netrc = NULL;
|
||||
|
||||
static char*
|
||||
tr_getcwd( void )
|
||||
{
|
||||
char buf[2048];
|
||||
*buf = '\0';
|
||||
#ifdef WIN32
|
||||
_getcwd( buf, sizeof( buf ) );
|
||||
#else
|
||||
getcwd( buf, sizeof( buf ) );
|
||||
#endif
|
||||
return tr_strdup( buf );
|
||||
}
|
||||
static char*
|
||||
tr_getcwd( void )
|
||||
{
|
||||
char buf[2048];
|
||||
*buf = '\0';
|
||||
#ifdef WIN32
|
||||
_getcwd( buf, sizeof( buf ) );
|
||||
#else
|
||||
getcwd( buf, sizeof( buf ) );
|
||||
#endif
|
||||
return tr_strdup( buf );
|
||||
}
|
||||
|
||||
static char*
|
||||
absolutify( const char * path )
|
||||
|
@ -461,8 +461,8 @@ readargs( int argc,
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
fprintf(stderr, "Transmission %s\n", LONG_VERSION_STRING);
|
||||
exit(0);
|
||||
fprintf( stderr, "Transmission %s\n", LONG_VERSION_STRING );
|
||||
exit( 0 );
|
||||
break;
|
||||
|
||||
case 'w': {
|
||||
|
@ -830,7 +830,6 @@ printSession( tr_benc * top )
|
|||
printf( " Uploadlimit enabled: %s\n", ( i ? "Yes" : "No" ) );
|
||||
if( tr_bencDictFindInt( args, "speed-limit-up", &i ) )
|
||||
printf( " Uploadlimit: %6" PRId64 " KB/sec\n", i );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1140,9 +1139,13 @@ printTorrentList( tr_benc * top )
|
|||
&& ( tr_bencDictFindList( args, "torrents", &list ) ) )
|
||||
{
|
||||
int i, n;
|
||||
int64_t total_up = 0, total_down = 0, total_size = 0;
|
||||
char haveStr[32];
|
||||
|
||||
printf( "%-4s %-4s %9s %-8s %6s %6s %-5s %-11s %s\n",
|
||||
"ID", "Done", "Have", "ETA", "Up", "Down", "Ratio", "Status",
|
||||
"Name" );
|
||||
|
||||
for( i = 0, n = tr_bencListSize( list ); i < n; ++i )
|
||||
{
|
||||
int64_t id, eta, status, up, down;
|
||||
|
@ -1163,7 +1166,6 @@ printTorrentList( tr_benc * top )
|
|||
char etaStr[16];
|
||||
char statusStr[64];
|
||||
char ratioStr[32];
|
||||
char haveStr[32];
|
||||
char doneStr[8];
|
||||
int64_t error;
|
||||
char errorMark;
|
||||
|
@ -1194,8 +1196,17 @@ printTorrentList( tr_benc * top )
|
|||
strlratio2( ratioStr, ratio, sizeof( ratioStr ) ),
|
||||
getStatusString( d, statusStr, sizeof( statusStr ) ),
|
||||
name );
|
||||
|
||||
total_up += up;
|
||||
total_down += up;
|
||||
total_size += sizeWhenDone - leftUntilDone;
|
||||
}
|
||||
}
|
||||
|
||||
printf( "Sum: %9s %6.1f %6.1f\n",
|
||||
strlsize( haveStr, total_size, sizeof( haveStr ) ),
|
||||
total_up / 1024.0,
|
||||
total_down / 1024.0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue