1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

(daemon) #1520: "transmission-remote -l" doesn't show infinite ratio properly

This commit is contained in:
Charles Kerr 2008-11-27 17:28:18 +00:00
parent 924b9230f8
commit b8e9ef54fe

View file

@ -598,7 +598,7 @@ strlratio( char * buf,
tr_snprintf( buf, buflen, "%'.0f", ratio ); tr_snprintf( buf, buflen, "%'.0f", ratio );
} }
else if( numerator ) else if( numerator )
tr_strlcpy( buf, "Infinity", buflen ); tr_strlcpy( buf, "Inf", buflen );
else else
tr_strlcpy( buf, "None", buflen ); tr_strlcpy( buf, "None", buflen );
return buf; return buf;
@ -1028,20 +1028,21 @@ printTorrentList( tr_benc * top )
{ {
char etaStr[16]; char etaStr[16];
char statusStr[64]; char statusStr[64];
char ratioStr[32];
if( leftUntilDone ) if( leftUntilDone )
etaToString( etaStr, sizeof( etaStr ), eta ); etaToString( etaStr, sizeof( etaStr ), eta );
else else
tr_snprintf( etaStr, sizeof( etaStr ), "Done" ); tr_snprintf( etaStr, sizeof( etaStr ), "Done" );
printf( printf(
"%4d %3d%% %-8s %6.1f %6.1f %5.1f %-11s %s\n", "%4d %3d%% %-8s %6.1f %6.1f %5s %-11s %s\n",
(int)id, (int)id,
(int)( 100.0 * (int)( 100.0 *
( sizeWhenDone - leftUntilDone ) / sizeWhenDone ), ( sizeWhenDone - leftUntilDone ) / sizeWhenDone ),
etaStr, etaStr,
up / 1024.0, up / 1024.0,
down / 1024.0, down / 1024.0,
(double)( downEver ? ( (double)upEver / strlratio( ratioStr, downEver, upEver, sizeof( ratioStr ) ),
downEver ) : 0.0 ),
getStatusString( d, statusStr, sizeof( statusStr ) ), getStatusString( d, statusStr, sizeof( statusStr ) ),
name ); name );
} }