[axel-commits] r25 - in /trunk: CHANGES CREDITS axel.c axel.h conn.c conn.h http.c http.h search.c text.c
appaji-guest at users.alioth.debian.org
appaji-guest at users.alioth.debian.org
Wed Jan 30 11:38:44 UTC 2008
Author: appaji-guest
Date: Wed Jan 30 11:38:43 2008
New Revision: 25
URL: http://svn.debian.org/wsvn/axel/?sc=1&rev=25
Log:
Initial large file support, thanks David Turnbull
Modified:
trunk/CHANGES
trunk/CREDITS
trunk/axel.c
trunk/axel.h
trunk/conn.c
trunk/conn.h
trunk/http.c
trunk/http.h
trunk/search.c
trunk/text.c
Modified: trunk/CHANGES
URL: http://svn.debian.org/wsvn/axel/trunk/CHANGES?rev=25&op=diff
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Jan 30 11:38:43 2008
@@ -1,3 +1,9 @@
+Version 2.0:
+
+- Large file support
+
+UNFINISHED Jan 30 2008
+
Version 1.1:
- Compilation for GNU/kFreeBSD, thanks to Cyril Brulebois
Modified: trunk/CREDITS
URL: http://svn.debian.org/wsvn/axel/trunk/CREDITS?rev=25&op=diff
==============================================================================
--- trunk/CREDITS (original)
+++ trunk/CREDITS Wed Jan 30 11:38:43 2008
@@ -1,4 +1,7 @@
An not-quite-sorted list of people who helped somehow:
+
+- David Turnbull <dsturnbull at gmail.com>
+ Large file support
- Hermann J. Beckers <hjb-rheine at t-online.de>
German translation.
Modified: trunk/axel.c
URL: http://svn.debian.org/wsvn/axel/trunk/axel.c?rev=25&op=diff
==============================================================================
--- trunk/axel.c (original)
+++ trunk/axel.c Wed Jan 30 11:38:43 2008
@@ -23,6 +23,7 @@
Suite 330, Boston, MA 02111-1307 USA
*/
+#define _FILE_OFFSET_BITS 64
#include "axel.h"
/* Axel */
@@ -123,7 +124,7 @@
if( ( axel->size = axel->conn[0].size ) != INT_MAX )
{
if( axel->conf->verbose > 0 )
- axel_message( axel, _("File size: %i bytes"), axel->size );
+ axel_message( axel, _("File size: %lld bytes"), axel->size );
}
/* Wildcards in URL --> Get complete filename */
@@ -137,6 +138,7 @@
int axel_open( axel_t *axel )
{
int i, fd;
+ long long int j;
if( axel->conf->verbose > 0 )
axel_message( axel, _("Opening output file %s"), axel->filename );
@@ -167,7 +169,7 @@
for( i = 0; i < axel->conf->num_connections; i ++ )
read( fd, &axel->conn[i].currentbyte, sizeof( axel->conn[i].currentbyte ) );
- axel_message( axel, _("State file found: %i bytes downloaded, %i to go."),
+ axel_message( axel, _("State file found: %lld bytes downloaded, %lld to go."),
axel->bytes_done, axel->size - axel->bytes_done );
close( fd );
@@ -193,7 +195,7 @@
/* And check whether the filesystem can handle seeks to
past-EOF areas.. Speeds things up. :) AFAIK this
should just not happen: */
- if( lseek( axel->outfd, axel->size, SEEK_SET ) == -1 && axel->conf->num_connections > 1 )
+ if( lseek64( axel->outfd, axel->size, SEEK_SET ) == -1 && axel->conf->num_connections > 1 )
{
/* But if the OS/fs does not allow to seek behind
EOF, we have to fill the file with zeroes before
@@ -201,11 +203,11 @@
axel_message( axel, _("Crappy filesystem/OS.. Working around. :-(") );
lseek( axel->outfd, 0, SEEK_SET );
memset( buffer, 0, axel->conf->buffer_size );
- i = axel->size;
- while( i > 0 )
- {
- write( axel->outfd, buffer, min( i, axel->conf->buffer_size ) );
- i -= axel->conf->buffer_size;
+ j = axel->size;
+ while( j > 0 )
+ {
+ write( axel->outfd, buffer, min( j, axel->conf->buffer_size ) );
+ j -= axel->conf->buffer_size;
}
}
}
@@ -260,7 +262,8 @@
void axel_do( axel_t *axel )
{
fd_set fds[1];
- int hifd, i, j, size;
+ int hifd, i, j;
+ long long int size;
struct timeval timeval[1];
/* Create statefile if necessary */
@@ -571,13 +574,13 @@
for( i = 1; i < axel->conf->num_connections; i ++ )
{
#ifdef DEBUG
- printf( "Downloading %i-%i using conn. %i\n", axel->conn[i-1].currentbyte, axel->conn[i-1].lastbyte, i - 1 );
+ printf( "Downloading %lld-%lld using conn. %i\n", axel->conn[i-1].currentbyte, axel->conn[i-1].lastbyte, i - 1 );
#endif
axel->conn[i].currentbyte = axel->conn[i-1].lastbyte + 1;
axel->conn[i].lastbyte = axel->conn[i].currentbyte + axel->size / axel->conf->num_connections;
}
axel->conn[axel->conf->num_connections-1].lastbyte = axel->size - 1;
#ifdef DEBUG
- printf( "Downloading %i-%i using conn. %i\n", axel->conn[i-1].currentbyte, axel->conn[i-1].lastbyte, i - 1 );
+ printf( "Downloading %lld-%lld using conn. %i\n", axel->conn[i-1].currentbyte, axel->conn[i-1].lastbyte, i - 1 );
#endif
}
Modified: trunk/axel.h
URL: http://svn.debian.org/wsvn/axel/trunk/axel.h?rev=25&op=diff
==============================================================================
--- trunk/axel.h (original)
+++ trunk/axel.h Wed Jan 30 11:38:43 2008
@@ -95,7 +95,7 @@
char filename[MAX_STRING];
double start_time;
int next_state, finish_time;
- int bytes_done, start_byte, size;
+ long long bytes_done, start_byte, size;
int bytes_per_second;
int delay_time;
int outfd;
Modified: trunk/conn.c
URL: http://svn.debian.org/wsvn/axel/trunk/conn.c?rev=25&op=diff
==============================================================================
--- trunk/conn.c (original)
+++ trunk/conn.c Wed Jan 30 11:38:43 2008
@@ -242,7 +242,7 @@
if( conn->currentbyte )
{
- ftp_command( conn->ftp, "REST %i", conn->currentbyte );
+ ftp_command( conn->ftp, "REST %lld", conn->currentbyte );
if( ftp_wait( conn->ftp ) / 100 != 3 &&
conn->ftp->status / 100 != 2 )
return( 0 );
@@ -282,12 +282,12 @@
/* It's all a bit messed up.. But it works. */
if( conn->proto == PROTO_FTP && !conn->proxy )
{
- ftp_command( conn->ftp, "REST %i", 1 );
+ ftp_command( conn->ftp, "REST %lld", 1 );
if( ftp_wait( conn->ftp ) / 100 == 3 ||
conn->ftp->status / 100 == 2 )
{
conn->supported = 1;
- ftp_command( conn->ftp, "REST %i", 0 );
+ ftp_command( conn->ftp, "REST %lld", 0 );
ftp_wait( conn->ftp );
}
else
@@ -308,7 +308,7 @@
else
{
char s[MAX_STRING], *t;
- int i = 0;
+ long long int i = 0;
do
{
Modified: trunk/conn.h
URL: http://svn.debian.org/wsvn/axel/trunk/conn.h?rev=25&op=diff
==============================================================================
--- trunk/conn.h (original)
+++ trunk/conn.h Wed Jan 30 11:38:43 2008
@@ -42,9 +42,9 @@
ftp_t ftp[1];
http_t http[1];
- int size; /* File size, not 'connection size'.. */
- int currentbyte;
- int lastbyte;
+ long long size; /* File size, not 'connection size'.. */
+ long long currentbyte;
+ long long lastbyte;
int fd;
int enabled;
int supported;
Modified: trunk/http.c
URL: http://svn.debian.org/wsvn/axel/trunk/http.c?rev=25&op=diff
==============================================================================
--- trunk/http.c (original)
+++ trunk/http.c Wed Jan 30 11:38:43 2008
@@ -109,9 +109,9 @@
if( conn->firstbyte )
{
if( conn->lastbyte )
- http_addheader( conn, "Range: bytes=%i-%i", conn->firstbyte, conn->lastbyte );
+ http_addheader( conn, "Range: bytes=%lld-%lld", conn->firstbyte, conn->lastbyte );
else
- http_addheader( conn, "Range: bytes=%i-", conn->firstbyte );
+ http_addheader( conn, "Range: bytes=%lld-", conn->firstbyte );
}
}
@@ -196,15 +196,15 @@
return( NULL );
}
-int http_size( http_t *conn )
+long long int http_size( http_t *conn )
{
char *i;
- int j;
+ long long int j;
if( ( i = http_header( conn, "Content-Length:" ) ) == NULL )
return( -2 );
- sscanf( i, "%i", &j );
+ sscanf( i, "%lld", &j );
return( j );
}
Modified: trunk/http.h
URL: http://svn.debian.org/wsvn/axel/trunk/http.h?rev=25&op=diff
==============================================================================
--- trunk/http.h (original)
+++ trunk/http.h Wed Jan 30 11:38:43 2008
@@ -33,8 +33,8 @@
char headers[MAX_QUERY];
int proto; /* FTP through HTTP proxies */
int proxy;
- int firstbyte;
- int lastbyte;
+ long long int firstbyte;
+ long long int lastbyte;
int status;
int fd;
char *local_if;
@@ -46,6 +46,6 @@
void http_addheader( http_t *conn, char *format, ... );
int http_exec( http_t *conn );
char *http_header( http_t *conn, char *header );
-int http_size( http_t *conn );
+long long int http_size( http_t *conn );
void http_encode( char *s );
void http_decode( char *s );
Modified: trunk/search.c
URL: http://svn.debian.org/wsvn/axel/trunk/search.c?rev=25&op=diff
==============================================================================
--- trunk/search.c (original)
+++ trunk/search.c Wed Jan 30 11:38:43 2008
@@ -88,7 +88,7 @@
s = malloc( size );
sprintf( s, "http://www.filesearching.com/cgi-bin/s?q=%s&w=a&l=en&"
- "t=f&e=on&m=%i&o=n&s1=%i&s2=%i&x=15&y=15",
+ "t=f&e=on&m=%i&o=n&s1=%lld&s2=%lld&x=15&y=15",
conn->file, results->conf->search_amount,
conn->size, conn->size );
Modified: trunk/text.c
URL: http://svn.debian.org/wsvn/axel/trunk/text.c?rev=25&op=diff
==============================================================================
--- trunk/text.c (original)
+++ trunk/text.c Wed Jan 30 11:38:43 2008
@@ -26,9 +26,9 @@
#include "axel.h"
static void stop( int signal );
-static char *size_human( int value );
+static char *size_human( long long int value );
static char *time_human( int value );
-static void print_commas( int bytes_done );
+static void print_commas( long long int bytes_done );
static void print_alternate_output( axel_t *axel );
static void print_help();
static void print_version();
@@ -323,7 +323,7 @@
while( !axel->ready && run )
{
- int prev, done;
+ long long int prev, done;
prev = axel->bytes_done;
axel_do( axel );
@@ -347,9 +347,9 @@
if( prev >= 1024 )
printf( " [%6.1fKB/s]", (double) axel->bytes_per_second / 1024 );
if( axel->size < 10240000 )
- printf( "\n[%3i%%] ", min( 100, 102400 * i / axel->size ) );
+ printf( "\n[%3lld%%] ", min( 100, 102400 * i / axel->size ) );
else
- printf( "\n[%3i%%] ", min( 100, i / ( axel->size / 102400 ) ) );
+ printf( "\n[%3lld%%] ", min( 100, i / ( axel->size / 102400 ) ) );
}
else if( ( i % 10 ) == 0 )
{
@@ -413,12 +413,12 @@
}
/* Convert a number of bytes to a human-readable form */
-char *size_human( int value )
+char *size_human( long long int value )
{
if( value == 1 )
- sprintf( string, _("%i byte"), value );
+ sprintf( string, _("%lld byte"), value );
else if( value < 1024 )
- sprintf( string, _("%i bytes"), value );
+ sprintf( string, _("%lld bytes"), value );
else if( value < 10485760 )
sprintf( string, _("%.1f kilobytes"), (float) value / 1024 );
else
@@ -444,7 +444,7 @@
/* Part of the infamous wget-like interface. Just put it in a function
because I need it quite often.. */
-void print_commas( int bytes_done )
+void print_commas( long long int bytes_done )
{
int i, j;
@@ -462,8 +462,8 @@
static void print_alternate_output(axel_t *axel)
{
- int done=axel->bytes_done;
- int total=axel->size;
+ long long int done=axel->bytes_done;
+ long long int total=axel->size;
int i,j=0;
double now = gettime();
More information about the axel-commits
mailing list