[axel-commits] r117 - in /trunk: ROADMAP text.c
phihag-guest at users.alioth.debian.org
phihag-guest at users.alioth.debian.org
Wed Jan 6 12:19:26 UTC 2010
Author: phihag-guest
Date: Wed Jan 6 12:19:23 2010
New Revision: 117
URL: http://svn.debian.org/wsvn/axel/?sc=1&rev=117
Log:
Simplify text.c and allow for GB/s
Modified:
trunk/ROADMAP
trunk/text.c
Modified: trunk/ROADMAP
URL: http://svn.debian.org/wsvn/axel/trunk/ROADMAP?rev=117&op=diff
==============================================================================
--- trunk/ROADMAP (original)
+++ trunk/ROADMAP Wed Jan 6 12:19:23 2010
@@ -3,6 +3,7 @@
* replace old gettext with new one
* Check if strrstr is provided by environment
+* Use SI prefixes
Roadmap for Axel v3
===================
Modified: trunk/text.c
URL: http://svn.debian.org/wsvn/axel/trunk/text.c?rev=117&op=diff
==============================================================================
--- trunk/text.c (original)
+++ trunk/text.c Wed Jan 6 12:19:23 2010
@@ -276,12 +276,12 @@
}
}
sprintf( string, "%s.st", fn );
- if( access( fn, F_OK ) == 0 ) if( access( string, F_OK ) != 0 )
+ if( access( fn, F_OK ) == 0 && access( string, F_OK ) != 0 )
{
fprintf( stderr, _("No state file, cannot resume!\n") );
return( 1 );
}
- if( access( string, F_OK ) == 0 ) if( access( fn, F_OK ) != 0 )
+ if( access( string, F_OK ) == 0 && access( fn, F_OK ) != 0 )
{
printf( _("State file found, but no downloaded data. Starting from scratch.\n" ) );
unlink( string );
@@ -435,14 +435,14 @@
/* Convert a number of bytes to a human-readable form */
char *size_human( long long int value )
{
- if( value == 1 )
+ if( value < 1024 )
sprintf( string, _("%lld byte"), value );
- else if( value < 1024 )
- sprintf( string, _("%lld bytes"), value );
- else if( value < 10485760 )
- sprintf( string, _("%.1f kilobytes"), (float) value / 1024 );
- else
- sprintf( string, _("%.1f megabytes"), (float) value / 1048576 );
+ else if( value < 1024 * 1024 )
+ sprintf( string, _("%.1f Kilobyte"), (float) value / 1024 );
+ else if( value < 1024 * 1024 * 1024 )
+ sprintf( string, _("%.1f Megabyte"), (float) value / (1024 * 1024) );
+ else
+ sprintf( string, _("%.1f Gigabyte"), (float) value / (1024 * 1024 * 1024) );
return( string );
}
More information about the axel-commits
mailing list