axel-2.4/axel.c0000644000175000001440000004054011175337327012604 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* Main control */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "axel.h" /* Axel */ static void save_state( axel_t *axel ); static void *setup_thread( void * ); static void axel_message( axel_t *axel, char *format, ... ); static void axel_divide( axel_t *axel ); static char *buffer = NULL; /* Create a new axel_t structure */ axel_t *axel_new( conf_t *conf, int count, void *url ) { search_t *res; axel_t *axel; url_t *u; char *s; int i; axel = malloc( sizeof( axel_t ) ); memset( axel, 0, sizeof( axel_t ) ); *axel->conf = *conf; axel->conn = malloc( sizeof( conn_t ) * axel->conf->num_connections ); memset( axel->conn, 0, sizeof( conn_t ) * axel->conf->num_connections ); if( axel->conf->max_speed > 0 ) { if( (float) axel->conf->max_speed / axel->conf->buffer_size < 0.5 ) { if( axel->conf->verbose >= 2 ) axel_message( axel, _("Buffer resized for this speed.") ); axel->conf->buffer_size = axel->conf->max_speed; } axel->delay_time = (int) ( (float) 1000000 / axel->conf->max_speed * axel->conf->buffer_size * axel->conf->num_connections ); } if( buffer == NULL ) buffer = malloc( max( MAX_STRING, axel->conf->buffer_size ) ); if( count == 0 ) { axel->url = malloc( sizeof( url_t ) ); axel->url->next = axel->url; strncpy( axel->url->text, (char *) url, MAX_STRING ); } else { res = (search_t *) url; u = axel->url = malloc( sizeof( url_t ) ); for( i = 0; i < count; i ++ ) { strncpy( u->text, res[i].url, MAX_STRING ); if( i < count - 1 ) { u->next = malloc( sizeof( url_t ) ); u = u->next; } else { u->next = axel->url; } } } axel->conn[0].conf = axel->conf; if( !conn_set( &axel->conn[0], axel->url->text ) ) { axel_message( axel, _("Could not parse URL.\n") ); axel->ready = -1; return( axel ); } axel->conn[0].local_if = axel->conf->interfaces->text; axel->conf->interfaces = axel->conf->interfaces->next; strncpy( axel->filename, axel->conn[0].file, MAX_STRING ); http_decode( axel->filename ); if( *axel->filename == 0 ) /* Index page == no fn */ strncpy( axel->filename, axel->conf->default_filename, MAX_STRING ); if( ( s = strchr( axel->filename, '?' ) ) != NULL && axel->conf->strip_cgi_parameters ) *s = 0; /* Get rid of CGI parameters */ if( !conn_init( &axel->conn[0] ) ) { axel_message( axel, axel->conn[0].message ); axel->ready = -1; return( axel ); } /* This does more than just checking the file size, it all depends on the protocol used. */ if( !conn_info( &axel->conn[0] ) ) { axel_message( axel, axel->conn[0].message ); axel->ready = -1; return( axel ); } s = conn_url( axel->conn ); strncpy( axel->url->text, s, MAX_STRING ); if( ( axel->size = axel->conn[0].size ) != INT_MAX ) { if( axel->conf->verbose > 0 ) axel_message( axel, _("File size: %lld bytes"), axel->size ); } /* Wildcards in URL --> Get complete filename */ if( strchr( axel->filename, '*' ) || strchr( axel->filename, '?' ) ) strncpy( axel->filename, axel->conn[0].file, MAX_STRING ); return( axel ); } /* Open a local file to store the downloaded data */ 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 ); snprintf( buffer, MAX_STRING, "%s.st", axel->filename ); axel->outfd = -1; /* Check whether server knows about RESTart and switch back to single connection download if necessary */ if( !axel->conn[0].supported ) { axel_message( axel, _("Server unsupported, " "starting from scratch with one connection.") ); axel->conf->num_connections = 1; axel->conn = realloc( axel->conn, sizeof( conn_t ) ); axel_divide( axel ); } else if( ( fd = open( buffer, O_RDONLY ) ) != -1 ) { read( fd, &axel->conf->num_connections, sizeof( axel->conf->num_connections ) ); axel->conn = realloc( axel->conn, sizeof( conn_t ) * axel->conf->num_connections ); memset( axel->conn + 1, 0, sizeof( conn_t ) * ( axel->conf->num_connections - 1 ) ); axel_divide( axel ); read( fd, &axel->bytes_done, sizeof( axel->bytes_done ) ); 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: %lld bytes downloaded, %lld to go."), axel->bytes_done, axel->size - axel->bytes_done ); close( fd ); if( ( axel->outfd = open( axel->filename, O_WRONLY, 0666 ) ) == -1 ) { axel_message( axel, _("Error opening local file") ); return( 0 ); } } /* If outfd == -1 we have to start from scrath now */ if( axel->outfd == -1 ) { axel_divide( axel ); if( ( axel->outfd = open( axel->filename, O_CREAT | O_WRONLY, 0666 ) ) == -1 ) { axel_message( axel, _("Error opening local file") ); return( 0 ); } /* 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 ) { /* But if the OS/fs does not allow to seek behind EOF, we have to fill the file with zeroes before starting. Slow.. */ axel_message( axel, _("Crappy filesystem/OS.. Working around. :-(") ); lseek( axel->outfd, 0, SEEK_SET ); memset( buffer, 0, 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; } } } return( 1 ); } /* Start downloading */ void axel_start( axel_t *axel ) { int i; /* HTTP might've redirected and FTP handles wildcards, so re-scan the URL for every conn */ for( i = 0; i < axel->conf->num_connections; i ++ ) { conn_set( &axel->conn[i], axel->url->text ); axel->url = axel->url->next; axel->conn[i].local_if = axel->conf->interfaces->text; axel->conf->interfaces = axel->conf->interfaces->next; axel->conn[i].conf = axel->conf; if( i ) axel->conn[i].supported = 1; } if( axel->conf->verbose > 0 ) axel_message( axel, _("Starting download") ); for( i = 0; i < axel->conf->num_connections; i ++ ) if( axel->conn[i].currentbyte <= axel->conn[i].lastbyte ) { if( axel->conf->verbose >= 2 ) { axel_message( axel, _("Connection %i downloading from %s:%i using interface %s"), i, axel->conn[i].host, axel->conn[i].port, axel->conn[i].local_if ); } axel->conn[i].state = 1; if( pthread_create( axel->conn[i].setup_thread, NULL, setup_thread, &axel->conn[i] ) != 0 ) { axel_message( axel, _("pthread error!!!") ); axel->ready = -1; } else { axel->conn[i].last_transfer = gettime(); } } /* The real downloading will start now, so let's start counting */ axel->start_time = gettime(); axel->ready = 0; } /* Main 'loop' */ void axel_do( axel_t *axel ) { fd_set fds[1]; int hifd, i; long long int remaining,size; struct timeval timeval[1]; /* Create statefile if necessary */ if( gettime() > axel->next_state ) { save_state( axel ); axel->next_state = gettime() + axel->conf->save_state_interval; } /* Wait for data on (one of) the connections */ FD_ZERO( fds ); hifd = 0; for( i = 0; i < axel->conf->num_connections; i ++ ) { if( axel->conn[i].enabled ) FD_SET( axel->conn[i].fd, fds ); hifd = max( hifd, axel->conn[i].fd ); } if( hifd == 0 ) { /* No connections yet. Wait... */ usleep( 100000 ); goto conn_check; } else { timeval->tv_sec = 0; timeval->tv_usec = 100000; /* A select() error probably means it was interrupted by a signal, or that something else's very wrong... */ if( select( hifd + 1, fds, NULL, NULL, timeval ) == -1 ) { axel->ready = -1; return; } } /* Handle connections which need attention */ for( i = 0; i < axel->conf->num_connections; i ++ ) if( axel->conn[i].enabled ) { if( FD_ISSET( axel->conn[i].fd, fds ) ) { axel->conn[i].last_transfer = gettime(); size = read( axel->conn[i].fd, buffer, axel->conf->buffer_size ); if( size == -1 ) { if( axel->conf->verbose ) { axel_message( axel, _("Error on connection %i! " "Connection closed"), i ); } axel->conn[i].enabled = 0; conn_disconnect( &axel->conn[i] ); continue; } else if( size == 0 ) { if( axel->conf->verbose ) { /* Only abnormal behaviour if: */ if( axel->conn[i].currentbyte < axel->conn[i].lastbyte && axel->size != INT_MAX ) { axel_message( axel, _("Connection %i unexpectedly closed"), i ); } else { axel_message( axel, _("Connection %i finished"), i ); } } if( !axel->conn[0].supported ) { axel->ready = 1; } axel->conn[i].enabled = 0; conn_disconnect( &axel->conn[i] ); continue; } /* remaining == Bytes to go */ remaining = axel->conn[i].lastbyte - axel->conn[i].currentbyte + 1; if( remaining < size ) { if( axel->conf->verbose ) { axel_message( axel, _("Connection %i finished"), i ); } axel->conn[i].enabled = 0; conn_disconnect( &axel->conn[i] ); size = remaining; /* Don't terminate, still stuff to write! */ } /* This should always succeed.. */ lseek( axel->outfd, axel->conn[i].currentbyte, SEEK_SET ); if( write( axel->outfd, buffer, size ) != size ) { axel_message( axel, _("Write error!") ); axel->ready = -1; return; } axel->conn[i].currentbyte += size; axel->bytes_done += size; } else { if( gettime() > axel->conn[i].last_transfer + axel->conf->connection_timeout ) { if( axel->conf->verbose ) axel_message( axel, _("Connection %i timed out"), i ); conn_disconnect( &axel->conn[i] ); axel->conn[i].enabled = 0; } } } if( axel->ready ) return; conn_check: /* Look for aborted connections and attempt to restart them. */ for( i = 0; i < axel->conf->num_connections; i ++ ) { if( !axel->conn[i].enabled && axel->conn[i].currentbyte < axel->conn[i].lastbyte ) { if( axel->conn[i].state == 0 ) { // Wait for termination of this thread pthread_join(*(axel->conn[i].setup_thread), NULL); conn_set( &axel->conn[i], axel->url->text ); axel->url = axel->url->next; /* axel->conn[i].local_if = axel->conf->interfaces->text; axel->conf->interfaces = axel->conf->interfaces->next; */ if( axel->conf->verbose >= 2 ) axel_message( axel, _("Connection %i downloading from %s:%i using interface %s"), i, axel->conn[i].host, axel->conn[i].port, axel->conn[i].local_if ); axel->conn[i].state = 1; if( pthread_create( axel->conn[i].setup_thread, NULL, setup_thread, &axel->conn[i] ) == 0 ) { axel->conn[i].last_transfer = gettime(); } else { axel_message( axel, _("pthread error!!!") ); axel->ready = -1; } } else { if( gettime() > axel->conn[i].last_transfer + axel->conf->reconnect_delay ) { pthread_cancel( *axel->conn[i].setup_thread ); axel->conn[i].state = 0; } } } } /* Calculate current average speed and finish_time */ axel->bytes_per_second = (int) ( (double) ( axel->bytes_done - axel->start_byte ) / ( gettime() - axel->start_time ) ); axel->finish_time = (int) ( axel->start_time + (double) ( axel->size - axel->start_byte ) / axel->bytes_per_second ); /* Check speed. If too high, delay for some time to slow things down a bit. I think a 5% deviation should be acceptable. */ if( axel->conf->max_speed > 0 ) { if( (float) axel->bytes_per_second / axel->conf->max_speed > 1.05 ) axel->delay_time += 10000; else if( ( (float) axel->bytes_per_second / axel->conf->max_speed < 0.95 ) && ( axel->delay_time >= 10000 ) ) axel->delay_time -= 10000; else if( ( (float) axel->bytes_per_second / axel->conf->max_speed < 0.95 ) ) axel->delay_time = 0; usleep( axel->delay_time ); } /* Ready? */ if( axel->bytes_done == axel->size ) axel->ready = 1; } /* Close an axel connection */ void axel_close( axel_t *axel ) { int i; message_t *m; /* Terminate any thread still running */ for( i = 0; i < axel->conf->num_connections; i ++ ) /* don't try to kill non existing thread */ if ( *axel->conn[i].setup_thread != 0 ) pthread_cancel( *axel->conn[i].setup_thread ); /* Delete state file if necessary */ if( axel->ready == 1 ) { snprintf( buffer, MAX_STRING, "%s.st", axel->filename ); unlink( buffer ); } /* Else: Create it.. */ else if( axel->bytes_done > 0 ) { save_state( axel ); } /* Delete any message not processed yet */ while( axel->message ) { m = axel->message; axel->message = axel->message->next; free( m ); } /* Close all connections and local file */ close( axel->outfd ); for( i = 0; i < axel->conf->num_connections; i ++ ) conn_disconnect( &axel->conn[i] ); free( axel->conn ); free( axel ); } /* time() with more precision */ double gettime() { struct timeval time[1]; gettimeofday( time, 0 ); return( (double) time->tv_sec + (double) time->tv_usec / 1000000 ); } /* Save the state of the current download */ void save_state( axel_t *axel ) { int fd, i; char fn[MAX_STRING+4]; /* No use for such a file if the server doesn't support resuming anyway.. */ if( !axel->conn[0].supported ) return; snprintf( fn, MAX_STRING, "%s.st", axel->filename ); if( ( fd = open( fn, O_CREAT | O_TRUNC | O_WRONLY, 0666 ) ) == -1 ) { return; /* Not 100% fatal.. */ } write( fd, &axel->conf->num_connections, sizeof( axel->conf->num_connections ) ); write( fd, &axel->bytes_done, sizeof( axel->bytes_done ) ); for( i = 0; i < axel->conf->num_connections; i ++ ) { write( fd, &axel->conn[i].currentbyte, sizeof( axel->conn[i].currentbyte ) ); } close( fd ); } /* Thread used to set up a connection */ void *setup_thread( void *c ) { conn_t *conn = c; int oldstate; /* Allow this thread to be killed at any time. */ pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, &oldstate ); pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate ); if( conn_setup( conn ) ) { conn->last_transfer = gettime(); if( conn_exec( conn ) ) { conn->last_transfer = gettime(); conn->enabled = 1; conn->state = 0; return( NULL ); } } conn_disconnect( conn ); conn->state = 0; return( NULL ); } /* Add a message to the axel->message structure */ static void axel_message( axel_t *axel, char *format, ... ) { message_t *m = malloc( sizeof( message_t ) ), *n = axel->message; va_list params; memset( m, 0, sizeof( message_t ) ); va_start( params, format ); vsnprintf( m->text, MAX_STRING, format, params ); va_end( params ); if( axel->message == NULL ) { axel->message = m; } else { while( n->next != NULL ) n = n->next; n->next = m; } } /* Divide the file and set the locations for each connection */ static void axel_divide( axel_t *axel ) { int i; axel->conn[0].currentbyte = 0; axel->conn[0].lastbyte = axel->size / axel->conf->num_connections - 1; for( i = 1; i < axel->conf->num_connections; i ++ ) { #ifdef DEBUG 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 %lld-%lld using conn. %i\n", axel->conn[i-1].currentbyte, axel->conn[i-1].lastbyte, i - 1 ); #endif } axel-2.4/conf.c0000644000175000001440000001320711175337327012600 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* Configuration handling file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "axel.h" /* Some nifty macro's.. */ #define get_config_string( name ) \ if( strcmp( key, #name ) == 0 ) \ { \ st = 1; \ strcpy( conf->name, value ); \ } #define get_config_number( name ) \ if( strcmp( key, #name ) == 0 ) \ { \ st = 1; \ sscanf( value, "%i", &conf->name ); \ } int parse_interfaces( conf_t *conf, char *s ); int conf_loadfile( conf_t *conf, char *file ) { int i, line = 0; FILE *fp; char s[MAX_STRING], key[MAX_STRING], value[MAX_STRING]; fp = fopen( file, "r" ); if( fp == NULL ) return( 1 ); /* Not a real failure */ while( !feof( fp ) ) { int st; line ++; *s = 0; fscanf( fp, "%100[^\n#]s", s ); fscanf( fp, "%*[^\n]s" ); fgetc( fp ); /* Skip newline */ if( strchr( s, '=' ) == NULL ) continue; /* Probably empty? */ sscanf( s, "%[^= \t]s", key ); for( i = 0; s[i]; i ++ ) if( s[i] == '=' ) { for( i ++; isspace( (int) s[i] ) && s[i]; i ++ ); break; } strcpy( value, &s[i] ); for( i = strlen( value ) - 1; isspace( (int) value[i] ); i -- ) value[i] = 0; st = 0; /* Long live macros!! */ get_config_string( default_filename ); get_config_string( http_proxy ); get_config_string( no_proxy ); get_config_number( strip_cgi_parameters ); get_config_number( save_state_interval ); get_config_number( connection_timeout ); get_config_number( reconnect_delay ); get_config_number( num_connections ); get_config_number( buffer_size ); get_config_number( max_speed ); get_config_number( verbose ); get_config_number( alternate_output ); get_config_number( search_timeout ); get_config_number( search_threads ); get_config_number( search_amount ); get_config_number( search_top ); /* Option defunct but shouldn't be an error */ if( strcmp( key, "speed_type" ) == 0 ) st = 1; if( strcmp( key, "interfaces" ) == 0 ) st = parse_interfaces( conf, value ); if( !st ) { fprintf( stderr, _("Error in %s line %i.\n"), file, line ); return( 0 ); } get_config_number( add_header_count ); for(i=0;iadd_header_count;i++) get_config_string( add_header[i] ); get_config_string( user_agent ); } fclose( fp ); return( 1 ); } int conf_init( conf_t *conf ) { char s[MAX_STRING], *s2; int i; /* Set defaults */ memset( conf, 0, sizeof( conf_t ) ); strcpy( conf->default_filename, "default" ); *conf->http_proxy = 0; *conf->no_proxy = 0; conf->strip_cgi_parameters = 1; conf->save_state_interval = 10; conf->connection_timeout = 45; conf->reconnect_delay = 20; conf->num_connections = 4; conf->buffer_size = 5120; conf->max_speed = 0; conf->verbose = 1; conf->alternate_output = 0; conf->search_timeout = 10; conf->search_threads = 3; conf->search_amount = 15; conf->search_top = 3; conf->add_header_count = 0; strncpy( conf->user_agent, DEFAULT_USER_AGENT, MAX_STRING ); conf->interfaces = malloc( sizeof( if_t ) ); memset( conf->interfaces, 0, sizeof( if_t ) ); conf->interfaces->next = conf->interfaces; if( ( s2 = getenv( "http_proxy" ) ) != NULL ) strncpy( conf->http_proxy, s2, MAX_STRING ); else if( ( s2 = getenv( "HTTP_PROXY" ) ) != NULL ) strncpy( conf->http_proxy, s2, MAX_STRING ); if( !conf_loadfile( conf, ETCDIR "/axelrc" ) ) return( 0 ); if( ( s2 = getenv( "HOME" ) ) != NULL ) { sprintf( s, "%s/%s", s2, ".axelrc" ); if( !conf_loadfile( conf, s ) ) return( 0 ); } /* Convert no_proxy to a 0-separated-and-00-terminated list.. */ for( i = 0; conf->no_proxy[i]; i ++ ) if( conf->no_proxy[i] == ',' ) conf->no_proxy[i] = 0; conf->no_proxy[i+1] = 0; return( 1 ); } int parse_interfaces( conf_t *conf, char *s ) { char *s2; if_t *iface; iface = conf->interfaces->next; while( iface != conf->interfaces ) { if_t *i; i = iface->next; free( iface ); iface = i; } free( conf->interfaces ); if( !*s ) { conf->interfaces = malloc( sizeof( if_t ) ); memset( conf->interfaces, 0, sizeof( if_t ) ); conf->interfaces->next = conf->interfaces; return( 1 ); } s[strlen(s)+1] = 0; conf->interfaces = iface = malloc( sizeof( if_t ) ); while( 1 ) { while( ( *s == ' ' || *s == '\t' ) && *s ) s ++; for( s2 = s; *s2 != ' ' && *s2 != '\t' && *s2; s2 ++ ); *s2 = 0; if( *s < '0' || *s > '9' ) get_if_ip( s, iface->text ); else strcpy( iface->text, s ); s = s2 + 1; if( *s ) { iface->next = malloc( sizeof( if_t ) ); iface = iface->next; } else { iface->next = conf->interfaces; break; } } return( 1 ); } axel-2.4/conn.c0000644000175000001440000002102011175337327012600 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* Connection stuff */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "axel.h" char string[MAX_STRING]; /* Convert an URL to a conn_t structure */ int conn_set( conn_t *conn, char *set_url ) { char url[MAX_STRING]; char *i, *j; /* protocol:// */ if( ( i = strstr( set_url, "://" ) ) == NULL ) { conn->proto = PROTO_DEFAULT; strncpy( url, set_url, MAX_STRING ); } else { if( set_url[0] == 'f' ) conn->proto = PROTO_FTP; else if( set_url[0] == 'h' ) conn->proto = PROTO_HTTP; else { return( 0 ); } strncpy( url, i + 3, MAX_STRING ); } /* Split */ if( ( i = strchr( url, '/' ) ) == NULL ) { strcpy( conn->dir, "/" ); } else { *i = 0; snprintf( conn->dir, MAX_STRING, "/%s", i + 1 ); if( conn->proto == PROTO_HTTP ) http_encode( conn->dir ); } strncpy( conn->host, url, MAX_STRING ); j = strchr( conn->dir, '?' ); if( j != NULL ) *j = 0; i = strrchr( conn->dir, '/' ); *i = 0; if( j != NULL ) *j = '?'; if( i == NULL ) { strncpy( conn->file, conn->dir, MAX_STRING ); strcpy( conn->dir, "/" ); } else { strncpy( conn->file, i + 1, MAX_STRING ); strcat( conn->dir, "/" ); } /* Check for username in host field */ if( strrchr( conn->host, '@' ) != NULL ) { strncpy( conn->user, conn->host, MAX_STRING ); i = strrchr( conn->user, '@' ); *i = 0; strncpy( conn->host, i + 1, MAX_STRING ); *conn->pass = 0; } /* If not: Fill in defaults */ else { if( conn->proto == PROTO_FTP ) { /* Dash the password: Save traffic by trying to avoid multi-line responses */ strcpy( conn->user, "anonymous" ); strcpy( conn->pass, "mailto:axel-devel@lists.alioth.debian.org" ); } else { *conn->user = *conn->pass = 0; } } /* Password? */ if( ( i = strchr( conn->user, ':' ) ) != NULL ) { *i = 0; strncpy( conn->pass, i + 1, MAX_STRING ); } /* Port number? */ if( ( i = strchr( conn->host, ':' ) ) != NULL ) { *i = 0; sscanf( i + 1, "%i", &conn->port ); } /* Take default port numbers from /etc/services */ else { #ifndef DARWIN struct servent *serv; if( conn->proto == PROTO_FTP ) serv = getservbyname( "ftp", "tcp" ); else serv = getservbyname( "www", "tcp" ); if( serv ) conn->port = ntohs( serv->s_port ); else #endif if( conn->proto == PROTO_HTTP ) conn->port = 80; else conn->port = 21; } return( conn->port > 0 ); } /* Generate a nice URL string. */ char *conn_url( conn_t *conn ) { if( conn->proto == PROTO_FTP ) strcpy( string, "ftp://" ); else strcpy( string, "http://" ); if( *conn->user != 0 && strcmp( conn->user, "anonymous" ) != 0 ) sprintf( string + strlen( string ), "%s:%s@", conn->user, conn->pass ); sprintf( string + strlen( string ), "%s:%i%s%s", conn->host, conn->port, conn->dir, conn->file ); return( string ); } /* Simple... */ void conn_disconnect( conn_t *conn ) { if( conn->proto == PROTO_FTP && !conn->proxy ) ftp_disconnect( conn->ftp ); else http_disconnect( conn->http ); conn->fd = -1; } int conn_init( conn_t *conn ) { char *proxy = conn->conf->http_proxy, *host = conn->conf->no_proxy; int i; if( *conn->conf->http_proxy == 0 ) { proxy = NULL; } else if( *conn->conf->no_proxy != 0 ) { for( i = 0; ; i ++ ) if( conn->conf->no_proxy[i] == 0 ) { if( strstr( conn->host, host ) != NULL ) proxy = NULL; host = &conn->conf->no_proxy[i+1]; if( conn->conf->no_proxy[i+1] == 0 ) break; } } conn->proxy = proxy != NULL; if( conn->proto == PROTO_FTP && !conn->proxy ) { conn->ftp->local_if = conn->local_if; conn->ftp->ftp_mode = FTP_PASSIVE; if( !ftp_connect( conn->ftp, conn->host, conn->port, conn->user, conn->pass ) ) { conn->message = conn->ftp->message; conn_disconnect( conn ); return( 0 ); } conn->message = conn->ftp->message; if( !ftp_cwd( conn->ftp, conn->dir ) ) { conn_disconnect( conn ); return( 0 ); } } else { conn->http->local_if = conn->local_if; if( !http_connect( conn->http, conn->proto, proxy, conn->host, conn->port, conn->user, conn->pass ) ) { conn->message = conn->http->headers; conn_disconnect( conn ); return( 0 ); } conn->message = conn->http->headers; conn->fd = conn->http->fd; } return( 1 ); } int conn_setup( conn_t *conn ) { if( conn->ftp->fd <= 0 && conn->http->fd <= 0 ) if( !conn_init( conn ) ) return( 0 ); if( conn->proto == PROTO_FTP && !conn->proxy ) { if( !ftp_data( conn->ftp ) ) /* Set up data connnection */ return( 0 ); conn->fd = conn->ftp->data_fd; if( conn->currentbyte ) { ftp_command( conn->ftp, "REST %lld", conn->currentbyte ); if( ftp_wait( conn->ftp ) / 100 != 3 && conn->ftp->status / 100 != 2 ) return( 0 ); } } else { char s[MAX_STRING]; int i; snprintf( s, MAX_STRING, "%s%s", conn->dir, conn->file ); conn->http->firstbyte = conn->currentbyte; conn->http->lastbyte = conn->lastbyte; http_get( conn->http, s ); http_addheader( conn->http, "User-Agent: %s", conn->conf->user_agent ); for( i = 0; i < conn->conf->add_header_count; i++) http_addheader( conn->http, "%s", conn->conf->add_header[i] ); } return( 1 ); } int conn_exec( conn_t *conn ) { if( conn->proto == PROTO_FTP && !conn->proxy ) { if( !ftp_command( conn->ftp, "RETR %s", conn->file ) ) return( 0 ); return( ftp_wait( conn->ftp ) / 100 == 1 ); } else { if( !http_exec( conn->http ) ) return( 0 ); return( conn->http->status / 100 == 2 ); } } /* Get file size and other information */ int conn_info( conn_t *conn ) { /* It's all a bit messed up.. But it works. */ if( conn->proto == PROTO_FTP && !conn->proxy ) { 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 %lld", 0 ); ftp_wait( conn->ftp ); } else { conn->supported = 0; } if( !ftp_cwd( conn->ftp, conn->dir ) ) return( 0 ); conn->size = ftp_size( conn->ftp, conn->file, MAX_REDIR ); if( conn->size < 0 ) conn->supported = 0; if( conn->size == -1 ) return( 0 ); else if( conn->size == -2 ) conn->size = INT_MAX; } else { char s[MAX_STRING], *t; long long int i = 0; do { conn->currentbyte = 1; if( !conn_setup( conn ) ) return( 0 ); conn_exec( conn ); conn_disconnect( conn ); /* Code 3xx == redirect */ if( conn->http->status / 100 != 3 ) break; if( ( t = http_header( conn->http, "location:" ) ) == NULL ) return( 0 ); sscanf( t, "%255s", s ); if( strstr( s, "://" ) == NULL) { sprintf( conn->http->headers, "%s%s", conn_url( conn ), s ); strncpy( s, conn->http->headers, MAX_STRING ); } else if( s[0] == '/' ) { sprintf( conn->http->headers, "http://%s:%i%s", conn->host, conn->port, s ); strncpy( s, conn->http->headers, MAX_STRING ); } conn_set( conn, s ); i ++; } while( conn->http->status / 100 == 3 && i < MAX_REDIR ); if( i == MAX_REDIR ) { sprintf( conn->message, _("Too many redirects.\n") ); return( 0 ); } conn->size = http_size( conn->http ); if( conn->http->status == 206 && conn->size >= 0 ) { conn->supported = 1; conn->size ++; } else if( conn->http->status == 200 || conn->http->status == 206 ) { conn->supported = 0; conn->size = INT_MAX; } else { t = strchr( conn->message, '\n' ); if( t == NULL ) sprintf( conn->message, _("Unknown HTTP error.\n") ); else *t = 0; return( 0 ); } } return( 1 ); } axel-2.4/ftp.c0000644000175000001440000002006211175337327012441 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* FTP control file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "axel.h" int ftp_connect( ftp_t *conn, char *host, int port, char *user, char *pass ) { conn->data_fd = -1; conn->message = malloc( MAX_STRING ); if( ( conn->fd = tcp_connect( host, port, conn->local_if ) ) == -1 ) { sprintf( conn->message, _("Unable to connect to server %s:%i\n"), host, port ); return( 0 ); } if( ftp_wait( conn ) / 100 != 2 ) return( 0 ); ftp_command( conn, "USER %s", user ); if( ftp_wait( conn ) / 100 != 2 ) { if( conn->status / 100 == 3 ) { ftp_command( conn, "PASS %s", pass ); if( ftp_wait( conn ) / 100 != 2 ) return( 0 ); } else { return( 0 ); } } /* ASCII mode sucks. Just use Binary.. */ ftp_command( conn, "TYPE I" ); if( ftp_wait( conn ) / 100 != 2 ) return( 0 ); return( 1 ); } void ftp_disconnect( ftp_t *conn ) { if( conn->fd > 0 ) close( conn->fd ); if( conn->data_fd > 0 ) close( conn->data_fd ); if( conn->message ) { free( conn->message ); conn->message = NULL; } *conn->cwd = 0; conn->fd = conn->data_fd = -1; } /* Change current working directory */ int ftp_cwd( ftp_t *conn, char *cwd ) { /* Necessary at all? */ if( strncmp( conn->cwd, cwd, MAX_STRING ) == 0 ) return( 1 ); ftp_command( conn, "CWD %s", cwd ); if( ftp_wait( conn ) / 100 != 2 ) { fprintf( stderr, _("Can't change directory to %s\n"), cwd ); return( 0 ); } strncpy( conn->cwd, cwd, MAX_STRING ); return( 1 ); } /* Get file size. Should work with all reasonable servers now */ long long int ftp_size( ftp_t *conn, char *file, int maxredir ) { long long int i, j, size = MAX_STRING; char *reply, *s, fn[MAX_STRING]; /* Try the SIZE command first, if possible */ if( !strchr( file, '*' ) && !strchr( file, '?' ) ) { ftp_command( conn, "SIZE %s", file ); if( ftp_wait( conn ) / 100 == 2 ) { sscanf( conn->message, "%*i %lld", &i ); return( i ); } else if( conn->status / 10 != 50 ) { sprintf( conn->message, _("File not found.\n") ); return( -1 ); } } if( maxredir == 0 ) { sprintf( conn->message, _("Too many redirects.\n") ); return( -1 ); } if( !ftp_data( conn ) ) return( -1 ); ftp_command( conn, "LIST %s", file ); if( ftp_wait( conn ) / 100 != 1 ) return( -1 ); /* Read reply from the server. */ reply = malloc( size ); memset( reply, 0, size ); *reply = '\n'; i = 1; while( ( j = read( conn->data_fd, reply + i, size - i - 3 ) ) > 0 ) { i += j; reply[i] = 0; if( size - i <= 10 ) { size *= 2; reply = realloc( reply, size ); memset( reply + size / 2, 0, size / 2 ); } } close( conn->data_fd ); conn->data_fd = -1; if( ftp_wait( conn ) / 100 != 2 ) { free( reply ); return( -1 ); } #ifdef DEBUG fprintf( stderr, reply ); #endif /* Count the number of probably legal matches: Files&Links only */ j = 0; for( i = 1; reply[i] && reply[i+1]; i ++ ) if( reply[i] == '-' || reply[i] == 'l' ) j ++; else while( reply[i] != '\n' && reply[i] ) i ++; /* No match or more than one match */ if( j != 1 ) { if( j == 0 ) sprintf( conn->message, _("File not found.\n") ); else sprintf( conn->message, _("Multiple matches for this URL.\n") ); free( reply ); return( -1 ); } /* Symlink handling */ if( ( s = strstr( reply, "\nl" ) ) != NULL ) { /* Get the real filename */ sscanf( s, "%*s %*i %*s %*s %*i %*s %*i %*s %100s", fn ); strcpy( file, fn ); /* Get size of the file linked to */ strncpy( fn, strstr( s, "->" ) + 3, MAX_STRING ); free( reply ); if( ( reply = strchr( fn, '\r' ) ) != NULL ) *reply = 0; if( ( reply = strchr( fn, '\n' ) ) != NULL ) *reply = 0; return( ftp_size( conn, fn, maxredir - 1 ) ); } /* Normal file, so read the size! And read filename because of possible wildcards. */ else { s = strstr( reply, "\n-" ); i = sscanf( s, "%*s %*i %*s %*s %lld %*s %*i %*s %100s", &size, fn ); if( i < 2 ) { i = sscanf( s, "%*s %*i %lld %*i %*s %*i %*i %100s", &size, fn ); if( i < 2 ) { return( -2 ); } } strcpy( file, fn ); free( reply ); return( size ); } } /* Open a data connection. Only Passive mode supported yet, easier.. */ int ftp_data( ftp_t *conn ) { int i, info[6]; char host[MAX_STRING]; /* Already done? */ if( conn->data_fd > 0 ) return( 0 ); /* if( conn->ftp_mode == FTP_PASSIVE ) { */ ftp_command( conn, "PASV" ); if( ftp_wait( conn ) / 100 != 2 ) return( 0 ); *host = 0; for( i = 0; conn->message[i]; i ++ ) { if( sscanf( &conn->message[i], "%i,%i,%i,%i,%i,%i", &info[0], &info[1], &info[2], &info[3], &info[4], &info[5] ) == 6 ) { sprintf( host, "%i.%i.%i.%i", info[0], info[1], info[2], info[3] ); break; } } if( !*host ) { sprintf( conn->message, _("Error opening passive data connection.\n") ); return( 0 ); } if( ( conn->data_fd = tcp_connect( host, info[4] * 256 + info[5], conn->local_if ) ) == -1 ) { sprintf( conn->message, _("Error opening passive data connection.\n") ); return( 0 ); } return( 1 ); /* } else { sprintf( conn->message, _("Active FTP not implemented yet.\n" ) ); return( 0 ); } */ } /* Send a command to the server */ int ftp_command( ftp_t *conn, char *format, ... ) { va_list params; char cmd[MAX_STRING]; va_start( params, format ); vsnprintf( cmd, MAX_STRING - 3, format, params ); strcat( cmd, "\r\n" ); va_end( params ); #ifdef DEBUG fprintf( stderr, "fd(%i)<--%s", conn->fd, cmd ); #endif if( write( conn->fd, cmd, strlen( cmd ) ) != strlen( cmd ) ) { sprintf( conn->message, _("Error writing command %s\n"), format ); return( 0 ); } else { return( 1 ); } } /* Read status from server. Should handle multi-line replies correctly. Multi-line replies suck... */ int ftp_wait( ftp_t *conn ) { int size = MAX_STRING, r = 0, complete, i, j; char *s; conn->message = realloc( conn->message, size ); do { do { r += i = read( conn->fd, conn->message + r, 1 ); if( i <= 0 ) { sprintf( conn->message, _("Connection gone.\n") ); return( -1 ); } if( ( r + 10 ) >= size ) { size += MAX_STRING; conn->message = realloc( conn->message, size ); } } while( conn->message[r-1] != '\n' ); conn->message[r] = 0; sscanf( conn->message, "%i", &conn->status ); if( conn->message[3] == ' ' ) complete = 1; else complete = 0; for( i = 0; conn->message[i]; i ++ ) if( conn->message[i] == '\n' ) { if( complete == 1 ) { complete = 2; break; } if( conn->message[i+4] == ' ' ) { j = -1; sscanf( &conn->message[i+1], "%3i", &j ); if( j == conn->status ) complete = 1; } } } while( complete != 2 ); #ifdef DEBUG fprintf( stderr, "fd(%i)-->%s", conn->fd, conn->message ); #endif if( ( s = strchr( conn->message, '\n' ) ) != NULL ) *s = 0; if( ( s = strchr( conn->message, '\r' ) ) != NULL ) *s = 0; conn->message = realloc( conn->message, max( strlen( conn->message ) + 1, MAX_STRING ) ); return( conn->status ); } axel-2.4/http.c0000644000175000001440000001336211175337327012634 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* HTTP control file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "axel.h" int http_connect( http_t *conn, int proto, char *proxy, char *host, int port, char *user, char *pass ) { char base64_encode[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz0123456789+/"; char auth[MAX_STRING]; conn_t tconn[1]; int i; strncpy( conn->host, host, MAX_STRING ); conn->proto = proto; if( proxy != NULL ) { if( *proxy != 0 ) { sprintf( conn->host, "%s:%i", host, port ); if( !conn_set( tconn, proxy ) ) { /* We'll put the message in conn->headers, not in request */ sprintf( conn->headers, _("Invalid proxy string: %s\n"), proxy ); return( 0 ); } host = tconn->host; port = tconn->port; conn->proxy = 1; } else { conn->proxy = 0; } } if( ( conn->fd = tcp_connect( host, port, conn->local_if ) ) == -1 ) { /* We'll put the message in conn->headers, not in request */ sprintf( conn->headers, _("Unable to connect to server %s:%i\n"), host, port ); return( 0 ); } if( *user == 0 ) { *conn->auth = 0; } else { memset( auth, 0, MAX_STRING ); snprintf( auth, MAX_STRING, "%s:%s", user, pass ); for( i = 0; auth[i*3]; i ++ ) { conn->auth[i*4] = base64_encode[(auth[i*3]>>2)]; conn->auth[i*4+1] = base64_encode[((auth[i*3]&3)<<4)|(auth[i*3+1]>>4)]; conn->auth[i*4+2] = base64_encode[((auth[i*3+1]&15)<<2)|(auth[i*3+2]>>6)]; conn->auth[i*4+3] = base64_encode[auth[i*3+2]&63]; if( auth[i*3+2] == 0 ) conn->auth[i*4+3] = '='; if( auth[i*3+1] == 0 ) conn->auth[i*4+2] = '='; } } return( 1 ); } void http_disconnect( http_t *conn ) { if( conn->fd > 0 ) close( conn->fd ); conn->fd = -1; } void http_get( http_t *conn, char *lurl ) { *conn->request = 0; if( conn->proxy ) { http_addheader( conn, "GET %s://%s%s HTTP/1.0", conn->proto == PROTO_HTTP ? "http" : "ftp", conn->host, lurl ); } else { http_addheader( conn, "GET %s HTTP/1.0", lurl ); http_addheader( conn, "Host: %s", conn->host ); } if( *conn->auth ) http_addheader( conn, "Authorization: Basic %s", conn->auth ); if( conn->firstbyte ) { if( conn->lastbyte ) http_addheader( conn, "Range: bytes=%lld-%lld", conn->firstbyte, conn->lastbyte ); else http_addheader( conn, "Range: bytes=%lld-", conn->firstbyte ); } } void http_addheader( http_t *conn, char *format, ... ) { char s[MAX_STRING]; va_list params; va_start( params, format ); vsnprintf( s, MAX_STRING - 3, format, params ); strcat( s, "\r\n" ); va_end( params ); strncat( conn->request, s, MAX_QUERY - strlen(conn->request) - 1); } int http_exec( http_t *conn ) { int i = 0; char s[2] = " ", *s2; #ifdef DEBUG fprintf( stderr, "--- Sending request ---\n%s--- End of request ---\n", conn->request ); #endif http_addheader( conn, "" ); write( conn->fd, conn->request, strlen( conn->request ) ); *conn->headers = 0; /* Read the headers byte by byte to make sure we don't touch the actual data */ while( 1 ) { if( read( conn->fd, s, 1 ) <= 0 ) { /* We'll put the message in conn->headers, not in request */ sprintf( conn->headers, _("Connection gone.\n") ); return( 0 ); } if( *s == '\r' ) { continue; } else if( *s == '\n' ) { if( i == 0 ) break; i = 0; } else { i ++; } strncat( conn->headers, s, MAX_QUERY ); } #ifdef DEBUG fprintf( stderr, "--- Reply headers ---\n%s--- End of headers ---\n", conn->headers ); #endif sscanf( conn->headers, "%*s %3i", &conn->status ); s2 = strchr( conn->headers, '\n' ); *s2 = 0; strcpy( conn->request, conn->headers ); *s2 = '\n'; return( 1 ); } char *http_header( http_t *conn, char *header ) { char s[32]; int i; for( i = 1; conn->headers[i]; i ++ ) if( conn->headers[i-1] == '\n' ) { sscanf( &conn->headers[i], "%31s", s ); if( strcasecmp( s, header ) == 0 ) return( &conn->headers[i+strlen(header)] ); } return( NULL ); } long long int http_size( http_t *conn ) { char *i; long long int j; if( ( i = http_header( conn, "Content-Length:" ) ) == NULL ) return( -2 ); sscanf( i, "%lld", &j ); return( j ); } /* Decode%20a%20file%20name */ void http_decode( char *s ) { char t[MAX_STRING]; int i, j, k; for( i = j = 0; s[i]; i ++, j ++ ) { t[j] = s[i]; if( s[i] == '%' ) if( sscanf( s + i + 1, "%2x", &k ) ) { t[j] = k; i += 2; } } t[j] = 0; strcpy( s, t ); } void http_encode( char *s ) { char t[MAX_STRING]; int i, j; for( i = j = 0; s[i]; i ++, j ++ ) { /* Fix buffer overflow */ if (j >= MAX_STRING - 1) { break; } t[j] = s[i]; if( s[i] == ' ' ) { /* Fix buffer overflow */ if (j >= MAX_STRING - 3) { break; } strcpy( t + j, "%20" ); j += 2; } } t[j] = 0; strcpy( s, t ); } axel-2.4/search.c0000644000175000001440000001525111175337327013121 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* filesearching.com searcher */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "axel.h" static char *strrstr( char *haystack, char *needle ); static void *search_speedtest( void *r ); static int search_sortlist_qsort( const void *a, const void *b ); #ifdef STANDALONE int main( int argc, char *argv[] ) { conf_t conf[1]; search_t *res; int i, j; if( argc != 2 ) { fprintf( stderr, "Incorrect amount of arguments\n" ); return( 1 ); } conf_init( conf ); res = malloc( sizeof( search_t ) * ( conf->search_amount + 1 ) ); memset( res, 0, sizeof( search_t ) * ( conf->search_amount + 1 ) ); res->conf = conf; i = search_makelist( res, argv[1] ); if( i == -1 ) { fprintf( stderr, "File not found\n" ); return( 1 ); } printf( "%i usable mirrors:\n", search_getspeeds( res, i ) ); search_sortlist( res, i ); for( j = 0; j < i; j ++ ) printf( "%-70.70s %5i\n", res[j].url, res[j].speed ); return( 0 ); } #endif int search_makelist( search_t *results, char *url ) { int i, size = 8192, j = 0; char *s, *s1, *s2, *s3; conn_t conn[1]; double t; memset( conn, 0, sizeof( conn_t ) ); conn->conf = results->conf; t = gettime(); if( !conn_set( conn, url ) ) return( -1 ); if( !conn_init( conn ) ) return( -1 ); if( !conn_info( conn ) ) return( -1 ); strcpy( results[0].url, url ); results[0].speed = 1 + 1000 * ( gettime() - t ); results[0].size = conn->size; 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=%lld&s2=%lld&x=15&y=15", conn->file, results->conf->search_amount, conn->size, conn->size ); conn_disconnect( conn ); memset( conn, 0, sizeof( conn_t ) ); conn->conf = results->conf; if( !conn_set( conn, s ) ) { free( s ); return( 1 ); } if( !conn_setup( conn ) ) { free( s ); return( 1 ); } if( !conn_exec( conn ) ) { free( s ); return( 1 ); } while( ( i = read( conn->fd, s + j, size - j ) ) > 0 ) { j += i; if( j + 10 >= size ) { size *= 2; s = realloc( s, size ); memset( s + size / 2, 0, size / 2 ); } } conn_disconnect( conn ); s1 = strstr( s, "
" ) == NULL )
	{
		/* Incomplete list					*/
		free( s );
		return( 1 );
	}
	for( i = 1; strncmp( s1, "
", 6 ) && i < results->conf->search_amount && *s1; i ++ ) { s3 = strchr( s1, '\n' ); *s3 = 0; s2 = strrstr( s1, "sin_addr ) ); return( 1 ); } else { return( 0 ); } } axel-2.4/text.c0000644000175000001440000003325611175337327012645 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* Text interface */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "axel.h" static void stop( int signal ); static char *size_human( long long int value ); static char *time_human( int value ); 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(); static void print_messages( axel_t *axel ); int run = 1; #ifdef NOGETOPTLONG #define getopt_long( a, b, c, d, e ) getopt( a, b, c ) #else static struct option axel_options[] = { /* name has_arg flag val */ { "max-speed", 1, NULL, 's' }, { "num-connections", 1, NULL, 'n' }, { "output", 1, NULL, 'o' }, { "search", 2, NULL, 'S' }, { "no-proxy", 0, NULL, 'N' }, { "quiet", 0, NULL, 'q' }, { "verbose", 0, NULL, 'v' }, { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "alternate", 0, NULL, 'a' }, { "header", 1, NULL, 'H' }, { "user-agent", 1, NULL, 'U' }, { NULL, 0, NULL, 0 } }; #endif /* For returning string values from functions */ static char string[MAX_STRING]; int main( int argc, char *argv[] ) { char fn[MAX_STRING] = ""; int do_search = 0; search_t *search; conf_t conf[1]; axel_t *axel; int i, j, cur_head = 0; char *s; #ifdef I18N setlocale( LC_ALL, "" ); bindtextdomain( PACKAGE, LOCALE ); textdomain( PACKAGE ); #endif if( !conf_init( conf ) ) { return( 1 ); } opterr = 0; j = -1; while( 1 ) { int option; option = getopt_long( argc, argv, "s:n:o:S::NqvhVaH:U:", axel_options, NULL ); if( option == -1 ) break; switch( option ) { case 'U': strncpy( conf->user_agent, optarg, MAX_STRING); break; case 'H': strncpy( conf->add_header[cur_head++], optarg, MAX_STRING ); break; case 's': if( !sscanf( optarg, "%i", &conf->max_speed ) ) { print_help(); return( 1 ); } break; case 'n': if( !sscanf( optarg, "%i", &conf->num_connections ) ) { print_help(); return( 1 ); } break; case 'o': strncpy( fn, optarg, MAX_STRING ); break; case 'S': do_search = 1; if( optarg != NULL ) if( !sscanf( optarg, "%i", &conf->search_top ) ) { print_help(); return( 1 ); } break; case 'a': conf->alternate_output = 1; break; case 'N': *conf->http_proxy = 0; break; case 'h': print_help(); return( 0 ); case 'v': if( j == -1 ) j = 1; else j ++; break; case 'V': print_version(); return( 0 ); case 'q': close( 1 ); conf->verbose = -1; if( open( "/dev/null", O_WRONLY ) != 1 ) { fprintf( stderr, _("Can't redirect stdout to /dev/null.\n") ); return( 1 ); } break; default: print_help(); return( 1 ); } } conf->add_header_count = cur_head; if( j > -1 ) conf->verbose = j; if( argc - optind == 0 ) { print_help(); return( 1 ); } else if( strcmp( argv[optind], "-" ) == 0 ) { s = malloc( MAX_STRING ); if (scanf( "%1024[^\n]s", s) != 1) { fprintf( stderr, _("Error when trying to read URL (Too long?).\n") ); return( 1 ); } } else { s = argv[optind]; if( strlen( s ) > MAX_STRING ) { fprintf( stderr, _("Can't handle URLs of length over %d\n" ), MAX_STRING ); return( 1 ); } } printf( _("Initializing download: %s\n"), s ); if( do_search ) { search = malloc( sizeof( search_t ) * ( conf->search_amount + 1 ) ); memset( search, 0, sizeof( search_t ) * ( conf->search_amount + 1 ) ); search[0].conf = conf; if( conf->verbose ) printf( _("Doing search...\n") ); i = search_makelist( search, s ); if( i < 0 ) { fprintf( stderr, _("File not found\n" ) ); return( 1 ); } if( conf->verbose ) printf( _("Testing speeds, this can take a while...\n") ); j = search_getspeeds( search, i ); search_sortlist( search, i ); if( conf->verbose ) { printf( _("%i usable servers found, will use these URLs:\n"), j ); j = min( j, conf->search_top ); printf( "%-60s %15s\n", "URL", "Speed" ); for( i = 0; i < j; i ++ ) printf( "%-70.70s %5i\n", search[i].url, search[i].speed ); printf( "\n" ); } axel = axel_new( conf, j, search ); free( search ); if( axel->ready == -1 ) { print_messages( axel ); axel_close( axel ); return( 1 ); } } else if( argc - optind == 1 ) { axel = axel_new( conf, 0, s ); if( axel->ready == -1 ) { print_messages( axel ); axel_close( axel ); return( 1 ); } } else { search = malloc( sizeof( search_t ) * ( argc - optind ) ); memset( search, 0, sizeof( search_t ) * ( argc - optind ) ); for( i = 0; i < ( argc - optind ); i ++ ) strncpy( search[i].url, argv[optind+i], MAX_STRING ); axel = axel_new( conf, argc - optind, search ); free( search ); if( axel->ready == -1 ) { print_messages( axel ); axel_close( axel ); return( 1 ); } } print_messages( axel ); if( s != argv[optind] ) { free( s ); } if( *fn ) { struct stat buf; if( stat( fn, &buf ) == 0 ) { if( S_ISDIR( buf.st_mode ) ) { size_t fnlen = strlen(fn); size_t axelfnlen = strlen(axel->filename); if (fnlen + 1 + axelfnlen + 1 > MAX_STRING) { fprintf( stderr, _("Filename too long!\n")); return ( 1 ); } fn[fnlen] = '/'; memcpy(fn+fnlen+1, axel->filename, axelfnlen); fn[fnlen + 1 + axelfnlen] = '\0'; } } sprintf( string, "%s.st", fn ); if( access( fn, F_OK ) == 0 ) if( 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 ) { printf( _("State file found, but no downloaded data. Starting from scratch.\n" ) ); unlink( string ); } strcpy( axel->filename, fn ); } else { /* Local file existence check */ i = 0; s = axel->filename + strlen( axel->filename ); while( 1 ) { sprintf( string, "%s.st", axel->filename ); if( access( axel->filename, F_OK ) == 0 ) { if( axel->conn[0].supported ) { if( access( string, F_OK ) == 0 ) break; } } else { if( access( string, F_OK ) ) break; } sprintf( s, ".%i", i ); i ++; } } if( !axel_open( axel ) ) { print_messages( axel ); return( 1 ); } print_messages( axel ); axel_start( axel ); print_messages( axel ); if( conf->alternate_output ) { putchar('\n'); } else { if( axel->bytes_done > 0 ) /* Print first dots if resuming */ { putchar( '\n' ); print_commas( axel->bytes_done ); } } axel->start_byte = axel->bytes_done; /* Install save_state signal handler for resuming support */ signal( SIGINT, stop ); signal( SIGTERM, stop ); while( !axel->ready && run ) { long long int prev, done; prev = axel->bytes_done; axel_do( axel ); if( conf->alternate_output ) { if( !axel->message && prev != axel->bytes_done ) print_alternate_output( axel ); } else { /* The infamous wget-like 'interface'.. ;) */ done = ( axel->bytes_done / 1024 ) - ( prev / 1024 ); if( done && conf->verbose > -1 ) { for( i = 0; i < done; i ++ ) { i += ( prev / 1024 ); if( ( i % 50 ) == 0 ) { if( prev >= 1024 ) printf( " [%6.1fKB/s]", (double) axel->bytes_per_second / 1024 ); if( axel->size < 10240000 ) printf( "\n[%3lld%%] ", min( 100, 102400 * i / axel->size ) ); else printf( "\n[%3lld%%] ", min( 100, i / ( axel->size / 102400 ) ) ); } else if( ( i % 10 ) == 0 ) { putchar( ' ' ); } putchar( '.' ); i -= ( prev / 1024 ); } fflush( stdout ); } } if( axel->message ) { if(conf->alternate_output==1) { /* clreol-simulation */ putchar( '\r' ); for( i = 0; i < 79; i++ ) /* linewidth known? */ putchar( ' ' ); putchar( '\r' ); } else { putchar( '\n' ); } print_messages( axel ); if( !axel->ready ) { if(conf->alternate_output!=1) print_commas( axel->bytes_done ); else print_alternate_output(axel); } } else if( axel->ready ) { putchar( '\n' ); } } strcpy( string + MAX_STRING / 2, size_human( axel->bytes_done - axel->start_byte ) ); printf( _("\nDownloaded %s in %s. (%.2f KB/s)\n"), string + MAX_STRING / 2, time_human( gettime() - axel->start_time ), (double) axel->bytes_per_second / 1024 ); i = axel->ready ? 0 : 2; axel_close( axel ); return( i ); } /* SIGINT/SIGTERM handler */ void stop( int signal ) { run = 0; } /* Convert a number of bytes to a human-readable form */ char *size_human( long long int value ) { if( value == 1 ) 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 ); return( string ); } /* Convert a number of seconds to a human-readable form */ char *time_human( int value ) { if( value == 1 ) sprintf( string, _("%i second"), value ); else if( value < 60 ) sprintf( string, _("%i seconds"), value ); else if( value < 3600 ) sprintf( string, _("%i:%02i seconds"), value / 60, value % 60 ); else sprintf( string, _("%i:%02i:%02i seconds"), value / 3600, ( value / 60 ) % 60, value % 60 ); return( string ); } /* Part of the infamous wget-like interface. Just put it in a function because I need it quite often.. */ void print_commas( long long int bytes_done ) { int i, j; printf( " " ); j = ( bytes_done / 1024 ) % 50; if( j == 0 ) j = 50; for( i = 0; i < j; i ++ ) { if( ( i % 10 ) == 0 ) putchar( ' ' ); putchar( ',' ); } fflush( stdout ); } static void print_alternate_output(axel_t *axel) { long long int done=axel->bytes_done; long long int total=axel->size; int i,j=0; double now = gettime(); printf("\r[%3ld%%] [", min(100,(long)(done*100./total+.5) ) ); for(i=0;iconf->num_connections;i++) { for(;j<((double)axel->conn[i].currentbyte/(total+1)*50)-1;j++) putchar('.'); if(axel->conn[i].currentbyteconn[i].lastbyte) { if(now <= axel->conn[i].last_transfer + axel->conf->connection_timeout/2 ) putchar(i+'0'); else putchar('#'); } else putchar('.'); j++; for(;j<((double)axel->conn[i].lastbyte/(total+1)*50);j++) putchar(' '); } if(axel->bytes_per_second > 1048576) printf( "] [%6.1fMB/s]", (double) axel->bytes_per_second / (1024*1024) ); else if(axel->bytes_per_second > 1024) printf( "] [%6.1fKB/s]", (double) axel->bytes_per_second / 1024 ); else printf( "] [%6.1fB/s]", (double) axel->bytes_per_second ); if(donefinish_time - now; minutes=seconds/60;seconds-=minutes*60; hours=minutes/60;minutes-=hours*60; days=hours/24;hours-=days*24; if(days) printf(" [%2dd%2d]",days,hours); else if(hours) printf(" [%2dh%02d]",hours,minutes); else printf(" [%02d:%02d]",minutes,seconds); } fflush( stdout ); } void print_help() { #ifdef NOGETOPTLONG printf( _("Usage: axel [options] url1 [url2] [url...]\n" "\n" "-s x\tSpecify maximum speed (bytes per second)\n" "-n x\tSpecify maximum number of connections\n" "-o f\tSpecify local output file\n" "-S [x]\tSearch for mirrors and download from x servers\n" "-H x\tAdd header string\n" "-U x\tSet user agent\n" "-N\tJust don't use any proxy server\n" "-q\tLeave stdout alone\n" "-v\tMore status information\n" "-a\tAlternate progress indicator\n" "-h\tThis information\n" "-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n") ); #else printf( _("Usage: axel [options] url1 [url2] [url...]\n" "\n" "--max-speed=x\t\t-s x\tSpecify maximum speed (bytes per second)\n" "--num-connections=x\t-n x\tSpecify maximum number of connections\n" "--output=f\t\t-o f\tSpecify local output file\n" "--search[=x]\t\t-S [x]\tSearch for mirrors and download from x servers\n" "--header=x\t\t-H x\tAdd header string\n" "--user-agent=x\t\t-U x\tSet user agent\n" "--no-proxy\t\t-N\tJust don't use any proxy server\n" "--quiet\t\t\t-q\tLeave stdout alone\n" "--verbose\t\t-v\tMore status information\n" "--alternate\t\t-a\tAlternate progress indicator\n" "--help\t\t\t-h\tThis information\n" "--version\t\t-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n") ); #endif } void print_version() { printf( _("Axel version %s (%s)\n"), AXEL_VERSION_STRING, ARCH ); printf( "\nCopyright 2001-2002 Wilmer van der Gaast.\n" ); } /* Print any message in the axel structure */ void print_messages( axel_t *axel ) { message_t *m; while( axel->message ) { printf( "%s\n", axel->message->text ); m = axel->message; axel->message = axel->message->next; free( m ); } } axel-2.4/axel.h0000644000175000001440000000554211175762441012613 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* Main include file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" #include #include #include #include #include #include #ifndef NOGETOPTLONG #define _GNU_SOURCE #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* Internationalization */ #ifdef I18N #define PACKAGE "axel" #define _( x ) gettext( x ) #include #include #else #define _( x ) x #endif /* Compiled-in settings */ #define MAX_STRING 1024 #define MAX_ADD_HEADERS 10 #define MAX_REDIR 5 #define AXEL_VERSION_STRING "2.4" #define DEFAULT_USER_AGENT "Axel " AXEL_VERSION_STRING " (" ARCH ")" typedef struct { void *next; char text[MAX_STRING]; } message_t; typedef message_t url_t; typedef message_t if_t; #include "conf.h" #include "tcp.h" #include "ftp.h" #include "http.h" #include "conn.h" #include "search.h" #define min( a, b ) ( (a) < (b) ? (a) : (b) ) #define max( a, b ) ( (a) > (b) ? (a) : (b) ) typedef struct { conn_t *conn; conf_t conf[1]; char filename[MAX_STRING]; double start_time; int next_state, finish_time; long long bytes_done, start_byte, size; int bytes_per_second; int delay_time; int outfd; int ready; message_t *message; url_t *url; } axel_t; axel_t *axel_new( conf_t *conf, int count, void *url ); int axel_open( axel_t *axel ); void axel_start( axel_t *axel ); void axel_do( axel_t *axel ); void axel_close( axel_t *axel ); double gettime(); axel-2.4/conf.h0000644000175000001440000000334411175337327012606 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* Configuration handling include file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ typedef struct { char default_filename[MAX_STRING]; char http_proxy[MAX_STRING]; char no_proxy[MAX_STRING]; int strip_cgi_parameters; int save_state_interval; int connection_timeout; int reconnect_delay; int num_connections; int buffer_size; int max_speed; int verbose; int alternate_output; if_t *interfaces; int search_timeout; int search_threads; int search_amount; int search_top; int add_header_count; char add_header[MAX_ADD_HEADERS][MAX_STRING]; char user_agent[MAX_STRING]; } conf_t; int conf_loadfile( conf_t *conf, char *file ); int conf_init( conf_t *conf ); axel-2.4/conn.h0000644000175000001440000000363111175337327012615 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* Connection stuff */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define PROTO_FTP 1 #define PROTO_HTTP 2 #define PROTO_DEFAULT PROTO_FTP typedef struct { conf_t *conf; int proto; int port; int proxy; char host[MAX_STRING]; char dir[MAX_STRING]; char file[MAX_STRING]; char user[MAX_STRING]; char pass[MAX_STRING]; ftp_t ftp[1]; http_t http[1]; long long int size; /* File size, not 'connection size'.. */ long long int currentbyte; long long int lastbyte; int fd; int enabled; int supported; int last_transfer; char *message; char *local_if; int state; pthread_t setup_thread[1]; } conn_t; int conn_set( conn_t *conn, char *set_url ); char *conn_url( conn_t *conn ); void conn_disconnect( conn_t *conn ); int conn_init( conn_t *conn ); int conn_setup( conn_t *conn ); int conn_exec( conn_t *conn ); int conn_info( conn_t *conn ); axel-2.4/ftp.h0000644000175000001440000000317311175337327012452 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* FTP control include file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define FTP_PASSIVE 1 #define FTP_PORT 2 typedef struct { char cwd[MAX_STRING]; char *message; int status; int fd; int data_fd; int ftp_mode; char *local_if; } ftp_t; int ftp_connect( ftp_t *conn, char *host, int port, char *user, char *pass ); void ftp_disconnect( ftp_t *conn ); int ftp_wait( ftp_t *conn ); int ftp_command( ftp_t *conn, char *format, ... ); int ftp_cwd( ftp_t *conn, char *cwd ); int ftp_data( ftp_t *conn ); long long int ftp_size( ftp_t *conn, char *file, int maxredir ); axel-2.4/http.h0000644000175000001440000000356411175337327012644 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* HTTP control include file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define MAX_QUERY 2048 /* Should not grow larger.. */ typedef struct { char host[MAX_STRING]; char auth[MAX_STRING]; char request[MAX_QUERY]; char headers[MAX_QUERY]; int proto; /* FTP through HTTP proxies */ int proxy; long long int firstbyte; long long int lastbyte; int status; int fd; char *local_if; } http_t; int http_connect( http_t *conn, int proto, char *proxy, char *host, int port, char *user, char *pass ); void http_disconnect( http_t *conn ); void http_get( http_t *conn, char *lurl ); void http_addheader( http_t *conn, char *format, ... ); int http_exec( http_t *conn ); char *http_header( http_t *conn, char *header ); long long int http_size( http_t *conn ); void http_encode( char *s ); void http_decode( char *s ); axel-2.4/search.h0000644000175000001440000000267611175337327013135 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* filesearching.com searcher include file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ typedef struct { char url[MAX_STRING]; double speed_start_time; int speed, size; pthread_t speed_thread[1]; conf_t *conf; } search_t; int search_makelist( search_t *results, char *url ); int search_getspeeds( search_t *results, int count ); void search_sortlist( search_t *results, int count ); axel-2.4/tcp.h0000644000175000001440000000235111175337327012444 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* TCP control include file */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ int tcp_connect( char *hostname, int port, char *local_if ); int get_if_ip( char *iface, char *ip ); axel-2.4/de.po0000644000175000001440000001754411175337327012447 0ustar appajiusersmsgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-04-27 13:21+0530\n" "PO-Revision-Date: 2008-09-15 22:08+0200\n" "Last-Translator: Hermann J. Beckers \n" "Language-Team: deutsch \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.4\n" #: axel.c:55 msgid "Buffer resized for this speed." msgstr "Buffer für diese Geschwindigkeit angepasst." #: axel.c:91 msgid "Could not parse URL.\n" msgstr "Kann URL nicht parsen.\n" #: axel.c:126 #, fuzzy, c-format msgid "File size: %lld bytes" msgstr "Dateigröße: %i Bytes" #: axel.c:143 #, c-format msgid "Opening output file %s" msgstr "Öffne Ausgabedatei: %s" #: axel.c:152 msgid "Server unsupported, starting from scratch with one connection." msgstr "Server versteht REST nicht, Neustart mit einer Verbindung." #: axel.c:171 #, fuzzy, c-format msgid "State file found: %lld bytes downloaded, %lld to go." msgstr "Status-Datei gefunden: %i Bytes übertragen, %i verbleiben." #: axel.c:178 axel.c:190 msgid "Error opening local file" msgstr "Fehler beim Öffnen der lokalen Datei" #: axel.c:202 msgid "Crappy filesystem/OS.. Working around. :-(" msgstr "Schlechtes Datei-/Betriebssystem, Umgehung.." #: axel.c:235 msgid "Starting download" msgstr "Starte Abruf" #: axel.c:242 axel.c:401 #, c-format msgid "Connection %i downloading from %s:%i using interface %s" msgstr "Verbindung %i: Abruf von %s:%i über Schnittstelle %s" #: axel.c:249 axel.c:411 msgid "pthread error!!!" msgstr "pthread Fehler!!!" #: axel.c:317 #, c-format msgid "Error on connection %i! Connection closed" msgstr "Fehler bei Verbindung %i! Verbindung getrennt" #: axel.c:331 #, c-format msgid "Connection %i unexpectedly closed" msgstr "Verbindung %i unerwartet getrennt" #: axel.c:335 axel.c:352 #, c-format msgid "Connection %i finished" msgstr "Verbindung %i beendet" #: axel.c:364 msgid "Write error!" msgstr "Schreibfehler!" #: axel.c:376 #, c-format msgid "Connection %i timed out" msgstr "Time-out bei Verbindung %i" #: conf.c:107 #, c-format msgid "Error in %s line %i.\n" msgstr "Fehler in %s Zeile %i.\n" #: conn.c:349 ftp.c:124 #, c-format msgid "Too many redirects.\n" msgstr "Zu viele Weiterleitungen (redirects).\n" #: conn.c:368 #, c-format msgid "Unknown HTTP error.\n" msgstr "Unbekannter HTTP-Fehler.\n" #: ftp.c:35 http.c:60 #, c-format msgid "Unable to connect to server %s:%i\n" msgstr "Keine Verbindung mit %s:%i möglich\n" #: ftp.c:91 #, c-format msgid "Can't change directory to %s\n" msgstr "Kann nicht in Verzeichnis %s wechseln\n" #: ftp.c:117 ftp.c:177 #, c-format msgid "File not found.\n" msgstr "Datei nicht gefunden.\n" #: ftp.c:179 #, c-format msgid "Multiple matches for this URL.\n" msgstr "Mehrere Treffer für diese URL.\n" #: ftp.c:250 ftp.c:256 #, c-format msgid "Error opening passive data connection.\n" msgstr "Fehler beim Öffnen der Passiv-Verbindung.\n" #: ftp.c:286 #, c-format msgid "Error writing command %s\n" msgstr "Fehler beim Schreiben des Befehls %s\n" #: ftp.c:311 http.c:150 #, c-format msgid "Connection gone.\n" msgstr "Verbindung geschlossen.\n" #: http.c:45 #, c-format msgid "Invalid proxy string: %s\n" msgstr "Ungültige Proxy-Angabe: %s\n" #: text.c:154 #, c-format msgid "Can't redirect stdout to /dev/null.\n" msgstr "Kann Standardausgabe nicht nach /dev/null umleiten.\n" #: text.c:176 #, c-format msgid "Error when trying to read URL (Too long?).\n" msgstr "Fehler beim Lesen der URL (Zu lang?).\n" #: text.c:185 #, c-format msgid "Can't handle URLs of length over %d\n" msgstr "Kann URLs mit mehr als %d Zeichen nicht nutzen\n" #: text.c:190 #, c-format msgid "Initializing download: %s\n" msgstr "Starte Abruf: %s\n" #: text.c:197 #, c-format msgid "Doing search...\n" msgstr "Suche gestartet...\n" #: text.c:201 #, c-format msgid "File not found\n" msgstr "Datei nicht gefunden\n" #: text.c:205 #, c-format msgid "Testing speeds, this can take a while...\n" msgstr "Teste Geschwindigkeiten, das kann etwas dauern...\n" #: text.c:210 #, c-format msgid "%i usable servers found, will use these URLs:\n" msgstr "%i benutzbare Server gefunden, werde diese URLs benutzen:\n" #: text.c:269 #, c-format msgid "Filename too long!\n" msgstr "Dateiname zu lang!\n" #: text.c:281 #, c-format msgid "No state file, cannot resume!\n" msgstr "Keine Status-Datei, Fortsetzung nicht möglich!\n" #: text.c:286 #, c-format msgid "State file found, but no downloaded data. Starting from scratch.\n" msgstr "Status-Datei gefunden, aber noch nichts übertragen. Neustart.\n" #: text.c:417 #, c-format msgid "" "\n" "Downloaded %s in %s. (%.2f KB/s)\n" msgstr "" "\n" "%s abgerufen in %s. (%.2f KB/s)\n" #: text.c:439 #, fuzzy, c-format msgid "%lld byte" msgstr "%i Byte" #: text.c:441 #, fuzzy, c-format msgid "%lld bytes" msgstr "%i Bytes" #: text.c:443 #, c-format msgid "%.1f kilobytes" msgstr "%.1f Kilobytes" #: text.c:445 #, c-format msgid "%.1f megabytes" msgstr "%.1f Megabytes" #: text.c:454 #, c-format msgid "%i second" msgstr "%i Sekunde" #: text.c:456 #, c-format msgid "%i seconds" msgstr "%i Sekunden" #: text.c:458 #, c-format msgid "%i:%02i seconds" msgstr "%i:%02i Sekunden" #: text.c:460 #, c-format msgid "%i:%02i:%02i seconds" msgstr "%i:%02i:%02i Sekunden" #: text.c:540 #, c-format msgid "" "Usage: axel [options] url1 [url2] [url...]\n" "\n" "-s x\tSpecify maximum speed (bytes per second)\n" "-n x\tSpecify maximum number of connections\n" "-o f\tSpecify local output file\n" "-S [x]\tSearch for mirrors and download from x servers\n" "-H x\tAdd header string\n" "-U x\tSet user agent\n" "-N\tJust don't use any proxy server\n" "-q\tLeave stdout alone\n" "-v\tMore status information\n" "-a\tAlternate progress indicator\n" "-h\tThis information\n" "-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n" msgstr "" "Aufruf: axel [Optionen] url1 [url2] [url...]\n" "\n" "-s x\tMaximale Geschwindigkeit (Bytes pro Sekunde)\n" "-n x\tmaximale gleichzeitige Verbindungen\n" "-o f\tlokale Ausgabe-Datei\n" "-S [x]\tSuche nach Spiegelservern und Abruf von x Servern\n" "-H x\tSende HTTP-Header\n" "-U x\tSetze Browser-Kennung\n" "-N\tkeinen Proxy-Server benutzen\n" "-q\tkeine Meldungen auf Standard-Ausgabe\n" "-v\tzusätzliche Status-Information\n" "-h\tdiese Information\n" "-V\tVersions-Information\n" "\n" "Fehler an lintux@lintux.cx melden.\n" #: text.c:557 #, c-format msgid "" "Usage: axel [options] url1 [url2] [url...]\n" "\n" "--max-speed=x\t\t-s x\tSpecify maximum speed (bytes per second)\n" "--num-connections=x\t-n x\tSpecify maximum number of connections\n" "--output=f\t\t-o f\tSpecify local output file\n" "--search[=x]\t\t-S [x]\tSearch for mirrors and download from x servers\n" "--header=x\t\t-H x\tAdd header string\n" "--user-agent=x\t\t-U x\tSet user agent\n" "--no-proxy\t\t-N\tJust don't use any proxy server\n" "--quiet\t\t\t-q\tLeave stdout alone\n" "--verbose\t\t-v\tMore status information\n" "--alternate\t\t-a\tAlternate progress indicator\n" "--help\t\t\t-h\tThis information\n" "--version\t\t-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n" msgstr "" "Aufruf: axel [Optionen] url1 [url2] [url...]\n" "\n" "--max-speed=x\t\t-s x\tmaximale Geschwindigkeit (Bytes pro Sekunde)\n" "--num-connections=x\t-n x\tmaximale gleichzeitige Verbindungen\n" "--output=f\t\t-o f\tlokale Ausgabe-Datei\n" "--search=[x]\t\t-S [x] Suche nach Spiegelservern und Abruf von x Servern\n" "--header=x\t\t-H x\tSende HTTP-Header\n" "--user-agent=x\t\t-U x\tSetze Browser-Kennung\n" "--no-proxy\t\t-N\tkeinen Proxy-Server benutzen\n" "--quiet\t\t\t-q\tkeine Meldungen auf Standard-Ausgabe\n" "--verbose\t\t-v\tzusätzliche Status-Information\n" "--help\t\t\t-h\tdiese Information\n" "--version\t\t-V\tVersions-Information\n" "\n" "Fehler an lintux@lintux.cx melden.\n" #: text.c:578 #, c-format msgid "Axel version %s (%s)\n" msgstr "Axel Version %s (%s)\n" axel-2.4/nl.po0000644000175000001440000001674611175337327012473 0ustar appajiusersmsgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-04-27 13:21+0530\n" "PO-Revision-Date: 2001-11-14 15:22+0200\n" "Last-Translator: Wilmer van der Gaast \n" "Language-Team: Dutch \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8-bit\n" #: axel.c:55 msgid "Buffer resized for this speed." msgstr "Buffer verkleind voor deze snelheid." #: axel.c:91 msgid "Could not parse URL.\n" msgstr "Kan URL niet verwerken.\n" #: axel.c:126 #, fuzzy, c-format msgid "File size: %lld bytes" msgstr "Bestandsgrootte: %i bytes" #: axel.c:143 #, c-format msgid "Opening output file %s" msgstr "Openen uitvoerbestand %s" #: axel.c:152 msgid "Server unsupported, starting from scratch with one connection." msgstr "Server niet ondersteund, opnieuw beginnen met 1 verbinding." #: axel.c:171 #, fuzzy, c-format msgid "State file found: %lld bytes downloaded, %lld to go." msgstr ".st bestand gevonden: %i bytes gedownload, %i te gaan." #: axel.c:178 axel.c:190 msgid "Error opening local file" msgstr "Fout bij openen lokaal bestand" #: axel.c:202 msgid "Crappy filesystem/OS.. Working around. :-(" msgstr "Niet-fatale fout in OS/bestandssysteem, omheen werken.." #: axel.c:235 msgid "Starting download" msgstr "Begin download" #: axel.c:242 axel.c:401 #, c-format msgid "Connection %i downloading from %s:%i using interface %s" msgstr "Verbinding %i gebruikt server %s:%i via interface %s" #: axel.c:249 axel.c:411 msgid "pthread error!!!" msgstr "pthread fout!!!" #: axel.c:317 #, c-format msgid "Error on connection %i! Connection closed" msgstr "Fout op verbinding %i! Verbinding gesloten" #: axel.c:331 #, c-format msgid "Connection %i unexpectedly closed" msgstr "Verbinding %i onverwachts gesloten" #: axel.c:335 axel.c:352 #, c-format msgid "Connection %i finished" msgstr "Verbinding %i klaar" #: axel.c:364 msgid "Write error!" msgstr "Schrijffout!" #: axel.c:376 #, c-format msgid "Connection %i timed out" msgstr "Time-out op verbinding %i" #: conf.c:107 #, c-format msgid "Error in %s line %i.\n" msgstr "Fout in %s regel %i.\n" #: conn.c:349 ftp.c:124 #, c-format msgid "Too many redirects.\n" msgstr "Te veel redirects.\n" #: conn.c:368 #, c-format msgid "Unknown HTTP error.\n" msgstr "Onbekende HTTP fout.\n" #: ftp.c:35 http.c:60 #, c-format msgid "Unable to connect to server %s:%i\n" msgstr "Kan niet verbinden met server %s:%i\n" #: ftp.c:91 #, c-format msgid "Can't change directory to %s\n" msgstr "" #: ftp.c:117 ftp.c:177 #, c-format msgid "File not found.\n" msgstr "Bestand niet gevonden.\n" #: ftp.c:179 #, c-format msgid "Multiple matches for this URL.\n" msgstr "Meerdere bestanden passen bij deze URL.\n" #: ftp.c:250 ftp.c:256 #, c-format msgid "Error opening passive data connection.\n" msgstr "Fout bij het openen van een data verbinding.\n" #: ftp.c:286 #, c-format msgid "Error writing command %s\n" msgstr "Fout bij het schrijven van commando %s\n" #: ftp.c:311 http.c:150 #, c-format msgid "Connection gone.\n" msgstr "Verbinding gesloten.\n" #: http.c:45 #, c-format msgid "Invalid proxy string: %s\n" msgstr "Ongeldige proxy string: %s\n" #: text.c:154 #, c-format msgid "Can't redirect stdout to /dev/null.\n" msgstr "Fout bij het afsluiten van stdout.\n" #: text.c:176 #, c-format msgid "Error when trying to read URL (Too long?).\n" msgstr "" #: text.c:185 #, c-format msgid "Can't handle URLs of length over %d\n" msgstr "" #: text.c:190 #, c-format msgid "Initializing download: %s\n" msgstr "Begin download: %s\n" #: text.c:197 #, c-format msgid "Doing search...\n" msgstr "Zoeken...\n" #: text.c:201 #, c-format msgid "File not found\n" msgstr "Bestand niet gevonden\n" #: text.c:205 #, c-format msgid "Testing speeds, this can take a while...\n" msgstr "Snelheden testen, dit kan even duren...\n" #: text.c:210 #, c-format msgid "%i usable servers found, will use these URLs:\n" msgstr "%i bruikbare servers gevonden, de volgende worden gebruikt:\n" #: text.c:269 #, c-format msgid "Filename too long!\n" msgstr "" #: text.c:281 #, c-format msgid "No state file, cannot resume!\n" msgstr "Geen .st bestand, kan niet resumen!\n" #: text.c:286 #, c-format msgid "State file found, but no downloaded data. Starting from scratch.\n" msgstr ".st bestand gevonden maar geen uitvoerbestand. Opnieuw beginnen.\n" #: text.c:417 #, c-format msgid "" "\n" "Downloaded %s in %s. (%.2f KB/s)\n" msgstr "" "\n" "%s gedownload in %s. (%.2f KB/s)\n" #: text.c:439 #, fuzzy, c-format msgid "%lld byte" msgstr "%i byte" #: text.c:441 #, fuzzy, c-format msgid "%lld bytes" msgstr "%i bytes" #: text.c:443 #, c-format msgid "%.1f kilobytes" msgstr "%.1f kilobytes" #: text.c:445 #, c-format msgid "%.1f megabytes" msgstr "%.1f megabytes" #: text.c:454 #, c-format msgid "%i second" msgstr "%i seconde" #: text.c:456 #, c-format msgid "%i seconds" msgstr "%i seconden" #: text.c:458 #, c-format msgid "%i:%02i seconds" msgstr "%i:%02i seconden" #: text.c:460 #, c-format msgid "%i:%02i:%02i seconds" msgstr "%i:%02i:%02i seconden" #: text.c:540 #, fuzzy, c-format msgid "" "Usage: axel [options] url1 [url2] [url...]\n" "\n" "-s x\tSpecify maximum speed (bytes per second)\n" "-n x\tSpecify maximum number of connections\n" "-o f\tSpecify local output file\n" "-S [x]\tSearch for mirrors and download from x servers\n" "-H x\tAdd header string\n" "-U x\tSet user agent\n" "-N\tJust don't use any proxy server\n" "-q\tLeave stdout alone\n" "-v\tMore status information\n" "-a\tAlternate progress indicator\n" "-h\tThis information\n" "-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n" msgstr "" "Gebruik: axel [opties] url1 [url2] [url...]\n" "\n" "-s x\tMaximale snelheid (bytes per seconde)\n" "-n x\tMaximale aantal verbindingen\n" "-o f\tLokaal uitvoerbestand\n" "-S [x]\tMirrors opzoeken en x mirrors gebruiken\n" "-N\tGeen proxy server gebruiken\n" "-q\tGeen uitvoer naar stdout\n" "-v\tMeer status informatie\n" "-a\tAlternatieve voortgangs indicator\n" "-h\tDeze informatie\n" "-V\tVersie informatie\n" "\n" "Bugs melden aan lintux@lintux.cx\n" #: text.c:557 #, fuzzy, c-format msgid "" "Usage: axel [options] url1 [url2] [url...]\n" "\n" "--max-speed=x\t\t-s x\tSpecify maximum speed (bytes per second)\n" "--num-connections=x\t-n x\tSpecify maximum number of connections\n" "--output=f\t\t-o f\tSpecify local output file\n" "--search[=x]\t\t-S [x]\tSearch for mirrors and download from x servers\n" "--header=x\t\t-H x\tAdd header string\n" "--user-agent=x\t\t-U x\tSet user agent\n" "--no-proxy\t\t-N\tJust don't use any proxy server\n" "--quiet\t\t\t-q\tLeave stdout alone\n" "--verbose\t\t-v\tMore status information\n" "--alternate\t\t-a\tAlternate progress indicator\n" "--help\t\t\t-h\tThis information\n" "--version\t\t-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n" msgstr "" "Gebruik: axel [opties] url1 [url2] [url...]\n" "\n" "--max-speed=x\t\t-s x\tMaximale snelheid (bytes per seconde)\n" "--num-connections=x\t-n x\tMaximale aantal verbindingen\n" "--output=f\t\t-o f\tLokaal uitvoerbestand\n" "--search[=x]\t\t-S [x]\tMirrors opzoeken en x mirrors gebruiken\n" "--no-proxy\t\t-N\tGeen proxy server gebruiken\n" "--quiet\t\t\t-q\tGeen uitvoer naar stdout\n" "--verbose\t\t-v\tMeer status informatie\n" "--alternate\t\t-a\tAlternatieve voortgangs indicator\n" "--help\t\t\t-h\tDeze informatie\n" "--version\t\t-V\tVersie informatie\n" "\n" "Bugs melden aan lintux@lintux.cx\n" #: text.c:578 #, c-format msgid "Axel version %s (%s)\n" msgstr "Axel versie %s (%s)\n" axel-2.4/ru.po0000644000175000001440000002250511175337327012476 0ustar appajiusersmsgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-04-27 13:21+0530\n" "Last-Translator: newhren \n" "Language-Team: Russian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" #: axel.c:55 msgid "Buffer resized for this speed." msgstr "Размер буфера изменен Ð´Ð»Ñ Ñтой ÑкороÑти." #: axel.c:91 msgid "Could not parse URL.\n" msgstr "Ðевозможно обработать URL.\n" #: axel.c:126 #, c-format msgid "File size: %lld bytes" msgstr "Размер файла: %lld байта(ов)" #: axel.c:143 #, c-format msgid "Opening output file %s" msgstr "ОткрываетÑÑ Ð²Ñ‹Ñ…Ð¾Ð´Ð½Ð¾Ð¹ файл %s" #: axel.c:152 msgid "Server unsupported, starting from scratch with one connection." msgstr "Сервер не поддерживаетÑÑ, начинаем заново Ñ Ð¾Ð´Ð½Ð¸Ð¼ Ñоединением." #: axel.c:171 #, c-format msgid "State file found: %lld bytes downloaded, %lld to go." msgstr "Ðайден файл ÑоÑтоÑниÑ: %lld байта(ов) Ñкачано, %lld оÑталоÑÑŒ." #: axel.c:178 axel.c:190 msgid "Error opening local file" msgstr "Ошибка при открытии локального файла" #: axel.c:202 msgid "Crappy filesystem/OS.. Working around. :-(" msgstr "" "Ошибки в файловой ÑиÑтеме или операционной ÑиÑтеме.. Пробуем иÑправить :-(" #: axel.c:235 msgid "Starting download" msgstr "Ðачинаем Ñкачивание" #: axel.c:242 axel.c:401 #, c-format msgid "Connection %i downloading from %s:%i using interface %s" msgstr "Соединение %i Ñкачивает Ñ %s:%i через Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ %s" #: axel.c:249 axel.c:411 msgid "pthread error!!!" msgstr "ошибка pthread!!!" #: axel.c:317 #, c-format msgid "Error on connection %i! Connection closed" msgstr "Ошибка в Ñоединении %i! Соединение закрыто" #: axel.c:331 #, c-format msgid "Connection %i unexpectedly closed" msgstr "Соединение %i неожиданно закрылоÑÑŒ" #: axel.c:335 axel.c:352 #, c-format msgid "Connection %i finished" msgstr "Соединение %i закончилоÑÑŒ" #: axel.c:364 msgid "Write error!" msgstr "Ошибка запиÑи!" #: axel.c:376 #, c-format msgid "Connection %i timed out" msgstr "Ð’Ñ€ÐµÐ¼Ñ ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ %i вышло" #: conf.c:107 #, c-format msgid "Error in %s line %i.\n" msgstr "Ошибка в файле %s Ð»Ð¸Ð½Ð¸Ñ %i.\n" #: conn.c:349 ftp.c:124 #, c-format msgid "Too many redirects.\n" msgstr "Слишком много перенаправлений.\n" #: conn.c:368 #, c-format msgid "Unknown HTTP error.\n" msgstr "ÐеизвеÑÑ‚Ð½Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ° HTTP.\n" #: ftp.c:35 http.c:60 #, c-format msgid "Unable to connect to server %s:%i\n" msgstr "Ðевозможно подÑоединитьÑÑ Ðº Ñерверу %s:%i\n" #: ftp.c:91 #, c-format msgid "Can't change directory to %s\n" msgstr "Ðевозможно Ñменить директорию на %s\n" #: ftp.c:117 ftp.c:177 #, c-format msgid "File not found.\n" msgstr "Файл не найден.\n" #: ftp.c:179 #, c-format msgid "Multiple matches for this URL.\n" msgstr "ÐеÑколько Ñовпадений Ð´Ð»Ñ Ñтого URL.\n" #: ftp.c:250 ftp.c:256 #, c-format msgid "Error opening passive data connection.\n" msgstr "Ошибка Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ð¿Ð°ÑÑивного ÑоединениÑ.\n" #: ftp.c:286 #, c-format msgid "Error writing command %s\n" msgstr "Ошибка запиÑи команды %s\n" #: ftp.c:311 http.c:150 #, c-format msgid "Connection gone.\n" msgstr "Соединение пропало.\n" #: http.c:45 #, c-format msgid "Invalid proxy string: %s\n" msgstr "ÐÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ñтока прокÑи: %s\n" #: text.c:154 #, c-format msgid "Can't redirect stdout to /dev/null.\n" msgstr "Ðевозможно перенаправить stdout в /dev/null.\n" #: text.c:176 #, c-format msgid "Error when trying to read URL (Too long?).\n" msgstr "" #: text.c:185 #, c-format msgid "Can't handle URLs of length over %d\n" msgstr "URLs длинной больше %d не поддерживаютÑÑ\n" #: text.c:190 #, c-format msgid "Initializing download: %s\n" msgstr "Ðачинаю Ñкачивание: %s\n" #: text.c:197 #, c-format msgid "Doing search...\n" msgstr "Ищем...\n" #: text.c:201 #, c-format msgid "File not found\n" msgstr "Файл не найден\n" #: text.c:205 #, c-format msgid "Testing speeds, this can take a while...\n" msgstr "Пробуем ÑкороÑти, Ñто может занÑть некоторое времÑ...\n" #: text.c:210 #, c-format msgid "%i usable servers found, will use these URLs:\n" msgstr "Ðайдено %i полезных Ñерверов, будут иÑпользованы Ñледующие URLs:\n" #: text.c:269 #, c-format msgid "Filename too long!\n" msgstr "" #: text.c:281 #, c-format msgid "No state file, cannot resume!\n" msgstr "Файл ÑоÑтоÑÐ½Ð¸Ñ Ð½Ðµ найден, возобновление невозможно!\n" #: text.c:286 #, c-format msgid "State file found, but no downloaded data. Starting from scratch.\n" msgstr "" "Файл ÑоÑтоÑÐ½Ð¸Ñ Ð½Ð°Ð¹Ð´ÐµÐ½, но предварительно Ñкачанные данные отÑутÑтвуют. " "Ðачинаем заново.\n" #: text.c:417 #, c-format msgid "" "\n" "Downloaded %s in %s. (%.2f KB/s)\n" msgstr "" "\n" "%s Ñкачано за %s. (%.2f КБ/Ñ)\n" #: text.c:439 #, c-format msgid "%lld byte" msgstr "%lld байт" #: text.c:441 #, c-format msgid "%lld bytes" msgstr "%lld байта(ов)" #: text.c:443 #, c-format msgid "%.1f kilobytes" msgstr "%.1f килобайта(ов)" #: text.c:445 #, c-format msgid "%.1f megabytes" msgstr "%.1f мегабайта(ов)" #: text.c:454 #, c-format msgid "%i second" msgstr "%i Ñекунда" #: text.c:456 #, c-format msgid "%i seconds" msgstr "%i Ñекунд(Ñ‹)" #: text.c:458 #, c-format msgid "%i:%02i seconds" msgstr "%i:%02i Ñекунд(Ñ‹)" #: text.c:460 #, c-format msgid "%i:%02i:%02i seconds" msgstr "%i:%02i:%02i Ñекунд(Ñ‹)" #: text.c:540 #, fuzzy, c-format msgid "" "Usage: axel [options] url1 [url2] [url...]\n" "\n" "-s x\tSpecify maximum speed (bytes per second)\n" "-n x\tSpecify maximum number of connections\n" "-o f\tSpecify local output file\n" "-S [x]\tSearch for mirrors and download from x servers\n" "-H x\tAdd header string\n" "-U x\tSet user agent\n" "-N\tJust don't use any proxy server\n" "-q\tLeave stdout alone\n" "-v\tMore status information\n" "-a\tAlternate progress indicator\n" "-h\tThis information\n" "-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n" msgstr "" "ИÑпользование: axel [опции] url1 [url2] [url...]\n" "\n" "-s x\tМакÑÐ¸Ð¼Ð°Ð»ÑŒÐ½Ð°Ñ ÑкороÑть (байт в Ñекунду)\n" "-n x\tМакÑимальное чиÑло Ñоединений\n" "-o f\tЛокальный выходной файл\n" "-S [x]\tПоиÑкать зеркала и Ñкачивать Ñ x Ñерверов\n" "-N\tÐе иÑпользовать прокÑи-Ñервера\n" "-q\tÐичего не выводить на stdout\n" "-v\tБольше информации о ÑтатуÑе\n" "-a\tÐльтернативный индикатор прогреÑÑа\n" "-h\tЭта информациÑ\n" "-V\tÐ˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¾ верÑии\n" "\n" "Об ошибках Ñообщайте на http://axel.alioth.debian.org/\n" #: text.c:557 #, fuzzy, c-format msgid "" "Usage: axel [options] url1 [url2] [url...]\n" "\n" "--max-speed=x\t\t-s x\tSpecify maximum speed (bytes per second)\n" "--num-connections=x\t-n x\tSpecify maximum number of connections\n" "--output=f\t\t-o f\tSpecify local output file\n" "--search[=x]\t\t-S [x]\tSearch for mirrors and download from x servers\n" "--header=x\t\t-H x\tAdd header string\n" "--user-agent=x\t\t-U x\tSet user agent\n" "--no-proxy\t\t-N\tJust don't use any proxy server\n" "--quiet\t\t\t-q\tLeave stdout alone\n" "--verbose\t\t-v\tMore status information\n" "--alternate\t\t-a\tAlternate progress indicator\n" "--help\t\t\t-h\tThis information\n" "--version\t\t-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n" msgstr "" "ИÑпользование: axel [опции] url1 [url2] [url...]\n" "\n" "--max-speed=x\t\t-s x\tМакÑÐ¸Ð¼Ð°Ð»ÑŒÐ½Ð°Ñ ÑкороÑть (байт в Ñекунду)\n" "--num-connections=x\t-n x\tМакÑимальное чиÑло Ñоединений\n" "--output=f\t\t-o f\tЛокальный выходной файл\n" "--search[=x]\t\t-S [x]\tПоиÑкать зеркала и Ñкачивать Ñ x Ñерверов\n" "--no-proxy\t\t-N\tÐе иÑпользовать прокÑи-Ñервера\n" "--quiet\t\t\t-q\tÐичего не выводить на stdout\n" "--verbose\t\t-v\tБольше информации о ÑтатуÑе\n" "--alternate\t\t-a\tÐльтернативный индикатор прогреÑÑа\n" "--help\t\t\t-h\tЭта информациÑ\n" "--version\t\t-V\tÐ˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¾ верÑии\n" "\n" "Об ошибках Ñообщайте на http://axel.alioth.debian.org/\n" #: text.c:578 #, c-format msgid "Axel version %s (%s)\n" msgstr "Axel, верÑÐ¸Ñ %s (%s)\n" axel-2.4/zh_CN.po0000644000175000001440000001732611175337327013056 0ustar appajiusersmsgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-04-27 13:21+0530\n" "PO-Revision-Date: 2008-11-08 22:40+0700\n" "Last-Translator: Shuge Lee \n" "Language-Team: Simplified Chinese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Last-Revision: Li Jin \n" #: axel.c:55 msgid "Buffer resized for this speed." msgstr "为这个速率调整缓冲区大å°ã€‚" #: axel.c:91 msgid "Could not parse URL.\n" msgstr "无法解æžURL\n" #: axel.c:126 #, fuzzy, c-format msgid "File size: %lld bytes" msgstr "文件大å°: %i 字节" #: axel.c:143 #, c-format msgid "Opening output file %s" msgstr "打开输出文件 %s" #: axel.c:152 msgid "Server unsupported, starting from scratch with one connection." msgstr "æœåС噍䏿”¯æŒï¼Œå¼€å§‹ä¸€ä¸ªè¿žæŽ¥ã€‚" #: axel.c:171 #, fuzzy, c-format msgid "State file found: %lld bytes downloaded, %lld to go." msgstr "æ‰¾åˆ°çŠ¶æ€æ–‡ä»¶ï¼š %i 字节已下载,继续下载 %i 字节。" #: axel.c:178 axel.c:190 msgid "Error opening local file" msgstr "打开本地文件错误" #: axel.c:202 msgid "Crappy filesystem/OS.. Working around. :-(" msgstr "" "糟糕的文件系统或æ“作系统……Working around……(译注德国写的å¥å­ï¼Œå®žåœ¨ä¸çŸ¥é“如何" "翻译……):-(" #: axel.c:235 msgid "Starting download" msgstr "开始下载" #: axel.c:242 axel.c:401 #, c-format msgid "Connection %i downloading from %s:%i using interface %s" msgstr "连接 %i 从 %s:%i é€šè¿‡æŽ¥å£ %s 下载" #: axel.c:249 axel.c:411 msgid "pthread error!!!" msgstr "线程错误ï¼ï¼ï¼" #: axel.c:317 #, c-format msgid "Error on connection %i! Connection closed" msgstr "连接 %i æœ‰é”™è¯¯ï¼ è¿žæŽ¥ä¸­æ–­" #: axel.c:331 #, c-format msgid "Connection %i unexpectedly closed" msgstr "连接 %i 被异常中断" #: axel.c:335 axel.c:352 #, c-format msgid "Connection %i finished" msgstr "连接 %i 结æŸ" #: axel.c:364 msgid "Write error!" msgstr "写错误ï¼" #: axel.c:376 #, c-format msgid "Connection %i timed out" msgstr "连接超时 %i" #: conf.c:107 #, c-format msgid "Error in %s line %i.\n" msgstr "%s %i 行有错误。\n" #: conn.c:349 ftp.c:124 #, c-format msgid "Too many redirects.\n" msgstr "太多é‡å®šå‘。\n" #: conn.c:368 #, c-format msgid "Unknown HTTP error.\n" msgstr "未知 HTTP 错误。\n" #: ftp.c:35 http.c:60 #, c-format msgid "Unable to connect to server %s:%i\n" msgstr "ä¸èƒ½è¿žæŽ¥åˆ°æœåС噍 %s:%i\n" #: ftp.c:91 #, c-format msgid "Can't change directory to %s\n" msgstr "ä¸èƒ½å˜æ›´ç›®å½•到 %s\n" #: ftp.c:117 ftp.c:177 #, c-format msgid "File not found.\n" msgstr "找ä¸åˆ°æ–‡ä»¶ã€‚\n" #: ftp.c:179 #, c-format msgid "Multiple matches for this URL.\n" msgstr "这个 URL 有多个匹é…。\n" #: ftp.c:250 ftp.c:256 #, c-format msgid "Error opening passive data connection.\n" msgstr "打开主动数æ®è¿žæŽ¥é”™è¯¯ã€‚\n" #: ftp.c:286 #, c-format msgid "Error writing command %s\n" msgstr "写命令出错 %s\n" #: ftp.c:311 http.c:150 #, c-format msgid "Connection gone.\n" msgstr "连接继续。\n" #: http.c:45 #, c-format msgid "Invalid proxy string: %s\n" msgstr "代ç†å­—符串无效: %s\n" #: text.c:154 #, c-format msgid "Can't redirect stdout to /dev/null.\n" msgstr "stdout ä¸èƒ½é‡å®šå‘到 /dev/null 。\n" #: text.c:176 #, c-format msgid "Error when trying to read URL (Too long?).\n" msgstr "" #: text.c:185 #, c-format msgid "Can't handle URLs of length over %d\n" msgstr "ä¸èƒ½å¤„ç†é•¿åº¦è¶…过 %d çš„URLs\n" #: text.c:190 #, c-format msgid "Initializing download: %s\n" msgstr "åˆå§‹åŒ–下载: %s\n" #: text.c:197 #, c-format msgid "Doing search...\n" msgstr "进行æœç´¢ä¸­...\n" #: text.c:201 #, c-format msgid "File not found\n" msgstr "文件找ä¸åˆ°\n" #: text.c:205 #, c-format msgid "Testing speeds, this can take a while...\n" msgstr "c测试速度,这å¯èƒ½æœ‰ç‚¹è´¹æ—¶â€¦â€¦\n" #: text.c:210 #, c-format msgid "%i usable servers found, will use these URLs:\n" msgstr "%i å¯ç”¨çš„æœåŠ¡å™¨æ²¡æœ‰æ‰¾åˆ°ï¼Œå°†ä½¿ç”¨è¿™äº› URLs :\n" #: text.c:269 #, c-format msgid "Filename too long!\n" msgstr "" #: text.c:281 #, c-format msgid "No state file, cannot resume!\n" msgstr "æ²¡æœ‰çŠ¶æ€æ–‡ä»¶ï¼Œæ— æ³•æ¢å¤ï¼\n" #: text.c:286 #, c-format msgid "State file found, but no downloaded data. Starting from scratch.\n" msgstr "æ‰¾åˆ°çŠ¶æ€æ–‡ä»¶ï¼Œä½†æ²¡æœ‰å·²ä¸‹è½½æ•°æ®ã€‚釿–°å¼€å§‹ã€‚\n" #: text.c:417 #, c-format msgid "" "\n" "Downloaded %s in %s. (%.2f KB/s)\n" msgstr "" "\n" "%s 已下载,用时 %s。(%.2f åƒå­—节/秒)\n" #: text.c:439 #, fuzzy, c-format msgid "%lld byte" msgstr "%i 字节" #: text.c:441 #, fuzzy, c-format msgid "%lld bytes" msgstr "%i 字节" #: text.c:443 #, c-format msgid "%.1f kilobytes" msgstr "%.1f åƒå­—节" #: text.c:445 #, c-format msgid "%.1f megabytes" msgstr "%.1f 兆字节" #: text.c:454 #, c-format msgid "%i second" msgstr "%i ç§’" #: text.c:456 #, c-format msgid "%i seconds" msgstr "%i ç§’" #: text.c:458 #, c-format msgid "%i:%02i seconds" msgstr "%i:%02i ç§’" #: text.c:460 #, c-format msgid "%i:%02i:%02i seconds" msgstr "%i:%02i:%02i ç§’" #: text.c:540 #, fuzzy, c-format msgid "" "Usage: axel [options] url1 [url2] [url...]\n" "\n" "-s x\tSpecify maximum speed (bytes per second)\n" "-n x\tSpecify maximum number of connections\n" "-o f\tSpecify local output file\n" "-S [x]\tSearch for mirrors and download from x servers\n" "-H x\tAdd header string\n" "-U x\tSet user agent\n" "-N\tJust don't use any proxy server\n" "-q\tLeave stdout alone\n" "-v\tMore status information\n" "-a\tAlternate progress indicator\n" "-h\tThis information\n" "-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n" msgstr "" "用法: axel [选项] 地å€1 [地å€2] [地å€...]\n" "\n" "-s x\t指定最大速率(字节 / 秒)\n" "-n x\t指定最大连接数\n" "-o f\t指定本地输出文件\n" "-S [x]\tæœç´¢é•œåƒå¹¶ä»Ž X æœåŠ¡å™¨ä¸‹è½½\n" "-N\tä¸ä½¿ç”¨ä»»ä½•ä»£ç†æœåС噍\n" "-q\t使用输出简å•ä¿¡æ¯æ¨¡å¼\n" "-v\t更多状æ€ä¿¡æ¯\n" "-a\t文本å¼è¿›åº¦æŒ‡ç¤ºå™¨\n" "-h\t帮助信æ¯\n" "-V\t版本信æ¯\n" "\n" "è¯·å‘ shuge.lee@gmail.com æäº¤ç¿»è¯‘é”™è¯¯ï¼Œè¯·å‘ http://axel.alioth.debian.org/ æ" "äº¤ç¨‹åºæ¼æ´ž\n" #: text.c:557 #, fuzzy, c-format msgid "" "Usage: axel [options] url1 [url2] [url...]\n" "\n" "--max-speed=x\t\t-s x\tSpecify maximum speed (bytes per second)\n" "--num-connections=x\t-n x\tSpecify maximum number of connections\n" "--output=f\t\t-o f\tSpecify local output file\n" "--search[=x]\t\t-S [x]\tSearch for mirrors and download from x servers\n" "--header=x\t\t-H x\tAdd header string\n" "--user-agent=x\t\t-U x\tSet user agent\n" "--no-proxy\t\t-N\tJust don't use any proxy server\n" "--quiet\t\t\t-q\tLeave stdout alone\n" "--verbose\t\t-v\tMore status information\n" "--alternate\t\t-a\tAlternate progress indicator\n" "--help\t\t\t-h\tThis information\n" "--version\t\t-V\tVersion information\n" "\n" "Visit http://axel.alioth.debian.org/ to report bugs\n" msgstr "" "用法: axel [选项] 地å€1 [地å€2] [地å€...]\n" "\n" "--max-speed=x\t\t-s x\t指定最大速率(字节 / 秒)\n" "--num-connections=x\t-n x\t指定最大连接数\n" "--output=f\t\t-o f\t指定本地输出文件\n" "--search[=x]\t\t-S [x]\tæœç´¢é•œåƒå¹¶ä»Ž X æœåŠ¡å™¨ä¸‹è½½\n" "--no-proxy\t\t-N\tä¸ä½¿ç”¨ä»»ä½•ä»£ç†æœåС噍\n" "--quiet\t\t\t-q\t使用输出简å•ä¿¡æ¯æ¨¡å¼\n" "--verbose\t\t-v\t更多状æ€ä¿¡æ¯\n" "--alternate\t\t-a\t文本å¼è¿›åº¦æŒ‡ç¤ºå™¨\n" "--help\t\t\t-h\t帮助信æ¯\n" "--version\t\t-V\t版本信æ¯\n" "\n" "è¯·å‘ shuge.lee@gmail.com æäº¤ç¿»è¯‘é”™è¯¯ï¼Œè¯·å‘ http://axel.alioth.debian.org/ æ" "äº¤ç¨‹åºæ¼æ´ž\n" #: text.c:578 #, c-format msgid "Axel version %s (%s)\n" msgstr "Axel 版本 %s (%s)\n" axel-2.4/axel.10000644000175000001440000001116311175337327012521 0ustar appajiusers.\" .\"man-page for Axel .\" .\"Derived from the man-page example in the wonderful book called Beginning .\"Linux Programming, written by Richard Stone and Neil Matthew. .\" .TH AXEL 1 .SH NAME \fBAxel\fP \- A light download accelerator for Linux. .SH SYNOPSIS .B axel [\fIOPTIONS\fP] \fIurl1\fP [\fIurl2\fP] [\fIurl...\fP] .SH DESCRIPTION Axel is a program that downloads a file from a FTP or HTTP server through multiple connection, each connection downloads its own part of the file. Unlike most other programs, Axel downloads all the data directly to the destination file, using one single thread. It just saves some time at the end because the program doesn't have to concatenate all the downloaded parts. .SH OPTIONS .PP One argument is required, the URL to the file you want to download. When downloading from FTP, the filename may contain wildcards and the program will try to resolve the full filename. Multiple URL's can be specified as well and the program will use all those URL's for the download. Please note that the program does not check whether the files are equal. .PP Other options: .TP \fB\-\-max\-speed=x\fP, \fB\-s\ x\fP You can specify a speed (bytes per second) here and Axel will try to keep the average speed around this speed. Useful if you don't want the program to suck up all of your bandwidth. .TP \fB\-\-num\-connections=x\fP, \fB\-n\ x\fP You can specify an alternative number of connections here. .TP \fB\-\-output=x\fP, \fB\-o\ x\fP Downloaded data will be put in a local file with the same name, unless you specify a different name using this option. You can specify a directory as well, the program will append the filename. .TP \fB\-\-search[=x]\fP, \fB-S[x]\fP Axel can do a search for mirrors using the filesearching.com search engine. This search will be done if you use this option. You can specify how many different mirrors should be used for the download as well. The search for mirrors can be time\-consuming because the program tests every server's speed, and it checks whether the file's still available. .TP \fB\-\-no\-proxy\fP, \fB\-N\fP Don't use any proxy server to download the file. Not possible when a transparent proxy is active somewhere, of course. .TP \fB\-\-verbose\fP If you want to see more status messages, you can use this option. Use it more than once if you want to see more. .TP \fB\-\-quiet\fP, \fB-q\fP No output to stdout. .TP \fB\-\-alternate\fP, \fB-a\fP This will show an alternate progress indicator. A bar displays the progress and status of the different threads, along with current speed and an estimate for the remaining download time. .TP \fB\-\-header=x\fP, \fB\-H\ x\fP Add an additional HTTP header. This option should be in the form "Header: Value". See RFC 2616 section 4.2 and 14 for details on the format and standardized headers. .TP \fB\-\-user-agent=x\fP, \fB\-U\ x\fP Set the HTTP user agent to use. Some websites serve different content based upon this parameter. The default value will include "Axel", its version and the platform. .TP \fB\-\-help\fP, \fB\-h\fP A brief summary of all the options. .TP \fB\-\-version\fP, \fB\-V\fP Get version information. .SH NOTE Long (double dash) options are supported only if your platform knows about the getopt_long call. If it does not (like *BSD), only the short options can be used. .SH RETURN VALUE The program returns 0 when the download was succesful, 1 if something really went wrong and 2 if the download was interrupted. If something else comes back, it must be a bug.. .SH EXAMPLES .nf axel ftp://ftp.{be,nl,uk,de}.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 .fi This will use the Belgian, Dutch, English and German kernel.org mirrors to download a Linux 2.4.17 kernel image. .nf axel \-S4 ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 .fi This will do a search for the linux-2.4.17.tar.bz2 file on filesearching.com and it'll use the four (if possible) fastest mirrors for the download. (Possibly including ftp.kernel.org) (Of course, the commands are a single line, but they're too long to fit on one line in this page.) .SH FILES .PP \fI/etc/axelrc\fP System-wide configuration file. Note that development versions place this file in /usr/local/etc. .PP \fI~/.axelrc\fP Personal configuration file .PP These files are not documented in a man\-page, but the example file which comes with the program contains enough information, I hope. The position of the system-wide configuration file might be different. .SH COPYRIGHT Axel is Copyright 2001-2002 Wilmer van der Gaast. .SH BUGS Please report bugs at https://alioth.debian.org/tracker/?group_id=100070&atid=413085. .SH AUTHORS Wilmer van der Gaast. axel-2.4/axel_zh_CN.10000644000175000001440000001072211175337327013602 0ustar appajiusers.\" .\" Axel 手册页 .\" .\" èµ·æºäºŽä¸€æœ¬ç”±Richard Stoneå’ŒNeil Matthew写的ã€å为《Linux程åºè®¾è®¡ã€‹çš„书的手册页样本。 .\" .\" 翻译于08-10-17 .\" 校对于08-11-11 .\" .TH AXEL 1 .SH åç§° \fBAxel\fP \- Linux 下轻é‡çš„下载加速器。 .SH 总览 .B axel [\fI选项\fP] \fIurl1\fP [\fIurl2\fP] [\fIurl...\fP] .SH æè¿° Axel\ 是一个通过多个连接从一个\ HTTP\ 或\ FTP\ æœåŠ¡å™¨ä¸‹è½½æ–‡ä»¶çš„ç¨‹åºï¼Œæ¯ä¸ªè¿žæŽ¥ä¸‹è½½æ–‡ä»¶çš„一部分。 跟其它程åºä¸ä¸€æ ·ï¼Œ\ Axel\ 会使用å•一线程直接下载所有数æ®åˆ°ç›®æ ‡æ–‡ä»¶ã€‚ 这样正好å¯ä»¥èŠ‚çœæ—¶é—´ï¼Œå› ä¸ºç¨‹åºæ²¡æœ‰å¿…è¦å¦‚é”链般连接到所有è¦ä¸‹è½½çš„部分。 .SH 选项 .PP å¿…éœ€è¦æœ‰ä¸€ä¸ªå‚æ•°--您想下载的文件的\ URL\ 。\ 当从\ FTP\ 下载,文件åå¯èƒ½åŒ…å«é€šé…符,程åºä¼šå°è¯•è§£æžå®Œæ•´çš„æ–‡ä»¶å。 也å¯ä»¥æŒ‡å®šå¤šä¸ª\ URL\ ,程åºå°†ä¼šé€šè¿‡é‚£äº›åœ°å€ä¸‹è½½ã€‚\ 请注æ„,程åºä¸ä¼šæ£€æŸ¥æ–‡ä»¶æ˜¯å¦ç›¸åŒã€‚ .PP 其它选项: .TP \fB\-\-max\-speed=x\fP, \fB\-s\ x\fP 您å¯ä»¥åœ¨è¿™é‡ŒæŒ‡å®šä¸€ä¸ªé€ŸçŽ‡ï¼ˆæ¯ç§’字节,B/s),\ Axel\ 将会å°è¯•ä¿æŒå¹³å‡é€ŸçŽ‡åœ¨è¿™ä¸ªé€ŸçŽ‡é™„è¿‘ã€‚\ å®ƒå¾ˆæœ‰ç”¨â”€â”€å¦‚æžœæ‚¨ä¸æƒ³ç¨‹åºåƒæŽ‰æ‚¨æ‰€æœ‰çš„带宽。 .TP \fB\-\-num\-connections=x\fP, \fB\-n\ x\fP 您å¯ä»¥åœ¨è¿™é‡ŒæŒ‡å®šä¸€ä¸ªæœ€ç»ˆè¿žæŽ¥æ•°ã€‚ .TP \fB\-\-output=x\fP, \fB\-o\ x\fP 下载的数æ®å°†ä¼šè¢«ä¿å­˜ä¸ºä¸€ä¸ªè·Ÿ\ URL\ åœ°å€æ–‡ä»¶ååŒå的本地文件,\ é™¤éžæ‚¨ä½¿ç”¨è¿™ä¸ªé€‰é¡¹æŒ‡å®šä½¿ç”¨ä¸€ä¸ªä¸ä¸€æ ·çš„å字。 您也å¯ä»¥æŒ‡å®šä¸€ä¸ªç›®å½•,程åºå°†ä¼šè¿½åŠ æ–‡ä»¶å。 .TP \fB\-\-search[=x]\fP, \fB-S[x]\fP Axel\ 能使用\ filesearching.com\ æœç´¢å¼•æ“Žï¼Œå¯¹é•œåƒæ‰§è¡Œæœç´¢ã€‚您使用这个选项它æ‰ä¼šè¿™ä¹ˆåšã€‚ 您也å¯ä»¥æŒ‡å®šåº”该使用多少个ä¸åŒçš„é•œåƒæ¥ä¸‹è½½ã€‚ å¯¹é•œåƒæœç´¢éžå¸¸è€—时,因为程åºä¼šæµ‹è¯•æ¯ä¸ªæœåŠ¡å™¨çš„é€ŸçŽ‡ï¼Œä¸ŽåŠæ–‡ä»¶æ˜¯å¦ä»ç„¶æœ‰æ•ˆã€‚ .TP \fB\-\-no\-proxy\fP, \fB\-N\fP ä¸ä½¿ç”¨ä»£ç†æœåŠ¡å™¨ä¸‹è½½æ–‡ä»¶ã€‚å½“ç„¶ï¼Œå½“ä¸€ä¸ªé€æ˜Žä»£ç†æ˜¯æœ‰æ•ˆæ—¶ï¼Œè¿™æ˜¯ä¸å¯èƒ½çš„。 .TP \fB\-\-verbose\fP 如果您想看到更多的状æ€ä¿¡æ¯ï¼Œæ‚¨å¯ä»¥ä½¿ç”¨è¿™ä¸ªé€‰é¡¹ã€‚如果您想看到更多,就使用它多几次。 .TP \fB\-\-quiet\fP, \fB-q\fP ä¸è¾“出到标准输出(stdout)。 .TP \fB\-\-alternate\fP, \fB-a\fP 这将会显示一个文本进度指示器。一个显示ä¸åŒçº¿ç¨‹è¿›åº¦å’Œçжæ€ï¼Œå½“å‰é€ŸçŽ‡å’Œè¯„ä¼°å‰©ä½™ä¸‹è½½æ—¶é—´çš„æ£’å½¢å›¾ã€‚ .TP \fB\-\-help\fP, \fB\-h\fP ä¸€ä¸ªå¯¹æ‰€æœ‰é€‰é¡¹çš„ç®€æ´æ‘˜è¦ã€‚ .TP \fB\-\-version\fP, \fB\-V\fP 获å–版本信æ¯ã€‚ .SH æ³¨æ„ å¦‚æžœæ‚¨çš„å¹³å°è¯†åˆ«\ getopt_lang\ 调用,长(两æ ç ´æŠ˜å·ï¼‰é€‰é¡¹æ‰ä¼šè¢«æ”¯æŒã€‚\ å¦åˆ™ï¼ˆåƒ\ *BSD\ ),åªèƒ½ä½¿ç”¨çŸ­é€‰é¡¹ã€‚ .SH 返回值 当下载æˆåŠŸï¼Œç¨‹åºè¿”回0,如果真的出错返回1,如果下载被中断返回2,如果返回其它,它肯定是一个臭虫…… .SH ä¾‹å­ .nf axel\ ftp://ftp.{be,nl,uk,de}.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 .fi 它将会使用\ Belgian\ ã€\ Dutch\ ã€\ English\ å’Œ\ German\ çš„\ kenel.org\ 镜åƒä¸‹è½½\ Linux\ 2.4.17\ kernel\ 映象。 .nf axel\ \-S4\ ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 .fi 它将会在\ filesearching.com\ æœç´¢\ linux-2.4.17.tar.bz2\ 文件,\ ç„¶åŽä»Žå››ä¸ª(如果å¯èƒ½çš„è¯)最快的镜åƒä¸­ä¸‹è½½ï¼ˆå¯èƒ½åŒ…括\ ftp.kernel.org\ )。 (当然,这个命令是一个独立行,但他们太长而ä¸èƒ½åœ¨è¿™ä¸ªé¡µé¢å†…显示为一行。) 让\ Gentoo\ GNU/Linux\ çš„\ Portage\ 软件包管ç†å™¨è°ƒç”¨\ Axel\ æ¥ä¸‹è½½ï¼ŒæŠŠä¸‹é¢çš„命令添加进\ /etc/make.conf\ 。 .nf FETCHCOMMAND='/usr/bin/axel -a -o "${DISTDIR}/${FILE}.axel" "${URI}" && mv "${DISTDIR}/${FILE}.axel" "${DISTDIR}/${FILE}"' RESUMECOMMAND="${FETCHCOMMAND}" .fi .SH 文件 .PP \fI/etc/axelrc\fP 系统全局é…置文件 .PP \fI~/.axelrc\fP 个人é…置文件 .PP 这些文件正文ä¸ä¼šåœ¨ä¸€ä¸ªæ‰‹å†Œé¡µå†…显示,但我希望跟程åºä¸€èµ·å®‰è£…的样本文件包å«è¶³å¤Ÿçš„ä¿¡æ¯ã€‚ é…置文件在ä¸åŒç³»ç»Ÿçš„ä½ç½®å¯èƒ½ä¸ä¸€æ ·ã€‚ .SH ç‰ˆæƒ Axel is Copyright 2001-2002 Wilmer van der Gaast. .SH 臭虫 .PP 我åšä¿¡åœ¨æŸäº›åœ°æ–¹ä»ç„¶ä¼šæœ‰è‡­è™«ï¼Œè¯·å‘Šè¯‰æˆ‘,我会å°è¯•ä¿®å¤å®ƒä»¬ã€‚ 已知臭虫是当使用上百个连接下载时,程åºä¼šå‘生异常。您应该é¿å…它。 .SH 作者 Wilmer van der Gaast. .SH 翻译 è ¡\ Shuge\ Lee\ .SH 校对 æŽè¿›\ Li\ Jin\ .\" æœ€åŽæ›´æ–°09-02-06 axel-2.4/configure0000755000175000001440000001370411175337327013420 0ustar appajiusers#!/bin/sh ########################### ## Configurer for Axel ## ## ## ## Copyright 2001 Lintux ## ########################### prefix='/usr/local' bindir='$prefix/bin' etcdir='$prefix/etc' sharedir='$prefix/share' mandir='$sharedir/man' locale='$sharedir/locale' i18n=1 debug=0 strip=1 arch=`uname -s` while [ -n "$1" ]; do e="`expr "$1" : '--\(.*=.*\)'`" if [ -z "$e" ]; then cat<Makefile.settings ## Axel settings, generated by configure PREFIX=$prefix BINDIR=$bindir ETCDIR=$etcdir SHAREDIR=$sharedir MANDIR=$mandir LOCALE=$locale OUTFILE=axel ARCH=$arch DESTDIR= LFLAGS= EOF cat<config.h /* Axel settings, generated by configure */ #define _REENTRANT #define _THREAD_SAFE #define ETCDIR "$etcdir" #define LOCALE "$locale" #define ARCH "$arch" EOF if [ "$i18n" = "1" ]; then if type msgfmt > /dev/null 2> /dev/null; then :;else echo 'WARNING: Internationalization disabled, you don'\''t have the necessary files' echo ' installed.' echo '' i18n=0; fi; fi echo "CFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os ${CFLAGS}" >> Makefile.settings if [ "$debug" = "1" ]; then echo 'CFLAGS+=-g' >> Makefile.settings echo 'DEBUG=1' >> Makefile.settings echo '#define DEBUG' >> config.h; fi if [ "$i18n" = "1" ]; then echo 'I18N=1' >> Makefile.settings echo '#define I18N' >> config.h if cat /usr/local/include/libintl.h > /dev/null 2> /dev/null; then echo 'CFLAGS+=-I/usr/local/include' >> Makefile.settings echo 'LFLAGS+=-L/usr/local/lib' >> Makefile.settings; fi; fi if [ "${CC}" != "" ]; then echo "CC=${CC}" >> Makefile.settings; elif type gcc > /dev/null 2> /dev/null; then echo "CC=gcc" >> Makefile.settings; elif type cc > /dev/null 2> /dev/null; then echo "CC=cc" >> Makefile.settings; else echo 'Cannot find a C compiler, aborting.' exit 1; fi if [ "$strip" = 0 ]; then echo "STRIP=\# skip strip" >> Makefile.settings; else echo 'The strip option is enabled. This should not be a problem usually, but on some' echo 'systems it breaks stuff.' echo if [ "$debug" = 1 ]; then echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' echo echo 'STRIP=\# skip strip' >> Makefile.settings strip=0; elif type strip > /dev/null 2> /dev/null; then echo "STRIP=strip" >> Makefile.settings; elif /bin/test -x /usr/ccs/bin/strip; then echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings; else echo 'No strip utility found, cannot remove unnecessary parts from executable.' echo '' echo 'STRIP=\# skip strip' >> Makefile.settings strip=0; fi; fi case "$arch" in FreeBSD ) echo '#define NOGETOPTLONG' >> config.h echo 'LFLAGS+=-pthread' >> Makefile.settings if [ "$i18n" = "1" ]; then echo 'LFLAGS+=-lintl' >> Makefile.settings; fi echo 'Please keep in mind that you need GNU make to make Axel!' echo '' ;; OpenBSD ) echo '#define NOGETOPTLONG' >> config.h echo 'LFLAGS+=-pthread' >> Makefile.settings if [ "$i18n" = "1" ]; then echo 'LFLAGS+=-lintl' >> Makefile.settings; fi echo 'Please keep in mind that you need GNU make to make Axel!' echo '' ;; NetBSD ) echo 'WARNING: NetBSD not tested! Using OpenBSD settings.' echo ' Please send me your results so I can update this!' echo '' echo '#define NOGETOPTLONG' >> config.h echo 'LFLAGS+=-pthread' >> Makefile.settings if [ "$i18n" = "1" ]; then echo 'LFLAGS+=-lintl' >> Makefile.settings; fi echo 'Please keep in mind that you need GNU make to make Axel!' echo '' ;; Darwin ) echo '#define NOGETOPTLONG' >> config.h echo 'LFLAGS+=-lpthread' >> Makefile.settings if [ "$i18n" = "1" ]; then echo 'LFLAGS+=-lintl' >> Makefile.settings; fi echo '#define DARWIN' >> config.h echo 'Please keep in mind that you need GNU make to make Axel!' echo '' ;; Linux | GNU/kFreeBSD) echo 'LFLAGS+=-lpthread' >> Makefile.settings ;; SunOS ) echo '#define NOGETOPTLONG' >> config.h echo '#define BSD_COMP' >> config.h echo 'LFLAGS+=-lpthread -lsocket -lnsl' >> Makefile.settings if [ "$i18n" = "1" ]; then echo 'LFLAGS+=-lintl' >> Makefile.settings; fi echo 'Please keep in mind that you need GNU make to make Axel!' echo '' ;; CYGWIN_* ) echo 'LFLAGS+=-lpthread' >> Makefile.settings if [ "$i18n" = "1" ]; then echo 'LFLAGS+=-lintl' >> Makefile.settings; fi echo 'OUTFILE=axel.exe' >> Makefile.settings ;; * ) echo 'LFLAGS+=-lpthread' >> Makefile.settings echo '#define NOGETOPTLONG' >> config.h if [ "$i18n" = "1" ]; then echo 'LFLAGS+=-lintl' >> Makefile.settings; fi echo 'WARNING: This architecture is unknown!' echo '' echo 'That does not mean Axel will not work, it just means I'\''ve never had the chance' echo 'to test Axel on it. It'\''d be a great help if you could send me more information' echo 'about your platform so I can add it to the build tools.' echo 'You can try to build the program now, if you wish, this default setup might' echo 'just work.' echo '' ;; esac echo 'Configuration done:' if [ "$i18n" = "1" ]; then echo ' Internationalization enabled.'; else echo ' Internationalization disabled.'; fi if [ "$debug" = "1" ]; then echo ' Debugging enabled.'; else echo ' Debugging disabled.'; fi if [ "$strip" = "1" ]; then echo ' Binary stripping enabled.'; else echo ' Binary stripping disabled.'; fi axel-2.4/Makefile0000644000175000001440000000443011175337327013145 0ustar appajiusers########################### ## Makefile for Axel ## ## ## ## Copyright 2001 Lintux ## ########################### ### DEFINITIONS -include Makefile.settings .SUFFIXES: .po .mo # Add your translation here.. MOFILES = nl.mo de.mo ru.mo zh_CN.mo all: $(OUTFILE) install: install-bin install-etc install-man uninstall: uninstall-bin uninstall-etc uninstall-man ifdef I18N all: $(MOFILES) install: install-i18n uninstall: uninstall-i18n endif clean: rm -f *.o $(OUTFILE) search core *.mo distclean: clean rm -f Makefile.settings config.h axel-*.tar axel-*.tar.gz axel-*.tar.bz2 install-man: mkdir -p $(DESTDIR)$(MANDIR)/man1/ cp axel.1 $(DESTDIR)$(MANDIR)/man1/axel.1 mkdir -p $(DESTDIR)$(MANDIR)/zh_CN/man1/ cp axel_zh_CN.1 $(DESTDIR)$(MANDIR)/zh_CN/man1/axel.1 uninstall-man: rm -f $(MANDIR)/man1/axel.1 rm -f $(MANDIR)/zh_CN/man1/axel.1 install-etc: mkdir -p $(DESTDIR)$(ETCDIR)/ cp axelrc.example $(DESTDIR)$(ETCDIR)/axelrc uninstall-etc: rm -f $(ETCDIR)/axelrc ### MAIN PROGRAM $(OUTFILE): axel.o conf.o conn.o ftp.o http.o search.o tcp.o text.o $(CC) *.o -o $(OUTFILE) $(LFLAGS) ifndef DEBUG -$(STRIP) $(OUTFILE) endif .c.o: $(CC) -c $*.c -o $*.o -Wall $(CFLAGS) install-bin: mkdir -p $(DESTDIR)$(BINDIR)/ cp $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE) uninstall-bin: rm -f $(BINDIR)/$(OUTFILE) tar: version=$$(sed -n 's/#define AXEL_VERSION_STRING[ \t]*"\([^"]*\)"/\1/p' < axel.h) && \ tar --create --transform "s#^#axel-$${version}/#" "--file=axel-$${version}.tar" --exclude-vcs -- *.c *.h *.po *.1 configure Makefile axelrc.example gui API CHANGES COPYING CREDITS README && \ gzip --best < "axel-$${version}.tar" > "axel-$${version}.tar.gz" && \ bzip2 --best < "axel-$${version}.tar" > "axel-$${version}.tar.bz2" ### I18N FILES %.po: -@mv $@ $@.bak xgettext -k_ -o$@ *.[ch] @if [ -e $@.bak ]; then \ echo -n Merging files...; \ msgmerge -vo $@.combo $@.bak $@; \ rm -f $@ $@.bak; \ mv $@.combo $@; \ fi .po.mo: $@.po msgfmt -vo $@ $*.po install-i18n: @echo Installing locale files... @for i in $(MOFILES); do \ mkdir -p $(DESTDIR)$(LOCALE)/`echo $$i | cut -d. -f1`/LC_MESSAGES/; \ cp $$i $(DESTDIR)$(LOCALE)/`echo $$i | cut -d. -f1`/LC_MESSAGES/axel.mo; \ done uninstall-i18n: cd $(LOCALE); find . -name axel.mo -exec 'rm' '{}' ';' axel-2.4/axelrc.example0000644000175000001440000000727211175337327014347 0ustar appajiusers############################################################################ ## ## ## Example configuration file for Axel - A light download accelerator ## ## ## ############################################################################ # reconnect_delay sets the number of seconds before trying again to build # a new connection to the server. # # reconnect_delay = 20 # You can set a maximum speed (bytes per second) here, Axel will try to be # at most 5% faster or 5% slower. # # max_speed = 0 # You can set the maximum number of connections Axel will try to set up # here. There's a value precompiled in the program too, setting this too # high requires recompilation. PLEASE respect FTP server operators and other # users: Don't set this one too high!!! 4 is enough in most cases. # # num_connections = 4 # If no data comes from a connection for this number of seconds, abort (and # resume) the connection. # # connection_timeout = 45 # Set proxies. no_proxy is a comma-separated list of domains which are # local, axel won't use any proxy for them. You don't have to specify full # hostnames there. # # Note: If the HTTP_PROXY environment variable is set correctly already, # you don't have to set it again here. The setting should be in the same # format as the HTTP_PROXY var, like 'http://host.domain.com:8080/', # although a string like 'host.domain.com:8080' should work too.. # # Sometimes HTTP proxies support FTP downloads too, so the proxy you # configure here will be used for FTP downloads too. # # If you have to use a SOCKS server for some reason, the program should # work perfectly through socksify without even knowing about that server. # I haven't tried it myself, so I would love to hear from you about the # results. # # http_proxy = # no_proxy = # Keep CGI arguments in the local filename? # # strip_cgi_parameters = 1 # When downloading a HTTP directory/index page, (like http://localhost/~me/) # what local filename do we have to store it in? # # default_filename = default # Save state every x seconds. Set this to 0 to disable state saving during # download. State files will always be saved when the program terminates # (unless the download is finished, of course) so this is only useful to # protect yourself against sudden system crashes. # # save_state_interval = 10 # Buffer size: Maximum amount of bytes to read from a connection. One single # buffer is used for all the connections (no separate per-connection buffer). # A smaller buffer might improve the accuracy of the speed limiter, but a # larger buffer is a better choice for fast connections. # # buffer_size = 5120 # By default some status messages about the download are printed. You can # disable this by setting this one to zero. # # verbose = 1 # FTP searcher # # search_timeout - Maximum time (seconds) to wait for a speed test # search_threads - Maximum number of speed tests at once # search_amount - Number of URL's to request from filesearching.com # search_top - Number of different URL's to use for download # # search_timeout = 10 # search_threads = 3 # search_amount = 15 # search_top = 3 # If you have multiple interfaces to the Internet, you can make Axel use all # of them by listing them here (interface name or IP address). If one of the # interfaces is faster than the other(s), you can list it more than once and # it will be used more often. # # This option is blank by default, which means Axel uses the first match in # the routing table. # # interfaces = # If you don't like the wget-alike interface, you can set this to 1 to get # a scp-alike interface. # # alternate_output = 1 axel-2.4/gui/0000755000175000001440000000000011175337326012267 5ustar appajiusersaxel-2.4/gui/kapt/0000755000175000001440000000000011175337326013226 5ustar appajiusersaxel-2.4/gui/kapt/axel-kapt.10000644000175000001440000000145711175337326015205 0ustar appajiusers.\" .\"man-page for axel-kapt .\" .\"Derived from axel, which is derived from the man-page example in the .\"wonderful book called Beginning "Linux Programming", written by Richard .\"Stone and Neil Matthew. .\" .TH AXEL-KAPT 1 .SH NAME \fBaxel\-kapt\fP \- Axel front\-end .SH SYNOPSIS .B axel\-kapt \fIurl1\fP [\fIurl2\fP] [\fIurl...\fP] .SH DESCRIPTION Axel is a program that downloads a file from a FTP or HTTP server through multiple connection, each connection downloads its own part of the file. This program is a KDE front\-end to Axel. .SH CONFIGURATION The program is a Python script which generates a Kaptain grammar on the fly. .SH "SEE ALSO" axel(1) .SH COPYRIGHT Axel\-kapt is Copyright 2001 Paul Evans. Axel is Copyright 2001 Wilmer van der Gaast. .SH AUTHORS Paul Evans (pevans@catholic.org) axel-2.4/gui/kapt/axel-kapt0000755000175000001440000000543511175337326015051 0ustar appajiusers#!/usr/bin/env python # Copyright 2001 by Paul Evans # Sat Oct 20 01:15:11 2001 Paul Evans # v 0.3 # This grammar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, # or (at your option) any later version. # This grammar is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have a copy of the GNU General Public License. # Probably you have *many* of them... # If not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # To use this grammar you need Kaptain. The primary web site for # Kaptain is http://kaptain.sourceforge.net. You can download the # latest version, documentation and other Kaptain grammars there. # # You may need to specify the location of your kaptain binary. import sys, os, string a = ''' start :framed "Axel-Kapt Download Accelerator" -> info url config local buttons filler; info :horizontal -> txt ico; txt -> @text(x%axel -V%); ico -> @icon("connect_creating.png"); url "Url (you can add mirrors)" -> @string()="''' b = '''"; config :horizontal "OPTIONS" -> checks term max connex search; checks :horizontal -> proxy verb quiet; proxy "No Proxy" -> @|" -N "; verb "Verbose" -> @|" --verbose "; quiet "Quiet" -> @|" -q "; term "Terminal Type" -> @string()="xterm"; max "Max bps"-> @integer()=0; connex :horizontal "Connections" -> @integer()=4; search :framed "ftp Search" -> numsites | ! @ ; numsites -> " --search=" @integer()=3; local -> file | ! @ ; file "Save as (optional). Choose a directory and type a filename..." -> " --output=" @directory(); buttons :horizontal "Actions" -> help mail doit quit; help -> @preview(helpstr,"Close")="Help"; mail -> @preview(bug,"Close")="Bug Report"; doit -> @exec(axel)="Start"; #doit -> @echo(axel)="Start"; quit -> @close="Exit"; filler -> @fill(); #sometimes the bottom is obscured.. #not just in kaptain. Some other qt apps too helpstr -> "Axel is a program that downloads a file from a FTP or HTTP \ server through multiple connection, each connection downloads its own \ part of the file. Read the manual page - axel(1) for various options"; bug -> "Please visit http://axel.alioth.debian.org/ to report bugs on axel-kapt"; axel -> term " -e axel -s " max " -n "connex proxy verb quiet search " " local " " url; ''' try: c = string.join(sys.argv[1:]) except: c = "" cmd = "echo '" + a + "'" + c + "'" + b + "'" + " | kaptain" os.system(cmd) axel-2.4/gui/kapt/Makefile0000644000175000001440000000051511175337326014667 0ustar appajiusersinclude ../../Makefile.settings all: install: mkdir -p $(DESTDIR)$(BINDIR) install -m 0755 axel-kapt $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(MANDIR)/man1/ install -m 0644 axel-kapt.1 $(DESTDIR)$(MANDIR)/man1/ mkdir -p $(DESTDIR)$(SHAREDIR)/applications/ install -m 0644 axel-kapt.desktop $(DESTDIR)$(SHAREDIR)/applications/ axel-2.4/gui/kapt/axel-kapt.desktop0000644000175000001440000000042611175337326016511 0ustar appajiusers[Desktop Entry] Version=1.0 Name=Axel GenericName=Axel Front-end Comment=Front-end for Axel - a light download accelerator Type=Application Exec=axel-kapt %f MimeType=text/html; Icon=connect_creating Terminal=false X-KDE-SubstituteUID=false Categories=Network;FileTransfer;KDE; axel-2.4/API0000644000175000001440000002201711175337327012042 0ustar appajiusers /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * \********************************************************************/ /* Short API description */ Until version 0.97, a lot of Axel downloading code was 'stuck' in main(). This made the development of alternate (ie graphical) interfaces to the program quite difficult. That's why Axel 0.97 is a major redesign: All the downloading code is out of main() now. Writing your own downloader which uses Axel should not be too difficult now. This document contains basic instructions on how to write a program which uses the Axel >=0.97 code to download data. Some work needs to be done before I can convert axel into a library. I don't know whether I'll do it at all.. So this API description is only useful if you want to create an alternate interface for the program, at the moment. Later on, I might change this. A Perl port of Axel would be nice too. :-) /* The structures */ If you want to use Axel, you should have all the *.[ch] files in your program's directory (or subdir, whatever you want...) and include the axel.h file into your program. Then, the following structures and functions will be available: typedef struct { conn_t *conn; conf_t conf[1]; char filename[MAX_STRING]; double start_time; int next_state, finish_time; int bytes_done, start_byte, size; int bytes_per_second; int delay_time; int outfd; int ready; message_t *message; url_t *url; } axel_t; This is probably the most important structure.. Each axel structure can handle a separate download, each with a variable amount of connections. There is no maximum amount of connections hard-coded into the program anymore, by the way. The way conn_t and conf_t structures work is not very important for most people, it's mainly important for internal use. You /can/ use those structures, if you want, they're not that complex... The filename string is set correctly by axel_new(). If you want data to be put into a different file, you can change the variable /after/ calling axel_new(), and /before/ calling axel_open(). The string can also include a full pathname. start_time contains the time at which the download started. Not very interesting for you, probably. Neither should next_state be very important, it just contains the time at which the next state file should be saved. (State files are important for resuming support, as described in the README file..) finish_time might be interesting, though. It contains the estimated time at which the download should be finished. bytes_done contains the number of bytes downloaded for this file, size contains the total file size. start_byte should be zero, usually, unless you're resuming a download. The code also calculates the average speed. This speed is put in the bytes_per_second variable. delay_time is not interesting at all. It's just used for the code which tries to slow down the download. You shouldn't really touch outfd either, it contains the file descriptor of the local file. ready is set to non-zero as soon as all data is downloaded, or as soon as something goes wrong. You shouldn't call axel_do() anymore, when ready is set. Last but not least, message. This is a linked list of messages to the user. You, as the programmer, may decide what to do with them. You can just destroy them (don't just ignore them, the messages do eat memory!) or you can log/display them. The structure is very simple, and I hope this is clear enough: typedef struct { void *next; char text[MAX_STRING]; } message_t; Just don't forget to free() the message structures after printing them, and set axel->message to NULL to prevent crashes. See the print_messages() function in text.c for an example. message used to be the last, but I added url. It's a linked list as well, and in fact url_t == message_t. Not really of any importance, though. This element contains a number of URL's that'll be used by Axel for the download. The program can use multiple mirrors at the same time. This structure is filled in by axel_new, you shouldn't touch it yourself. /* The functions */ int conf_init( conf_t *conf ); Axel needs some settings. Your program has to allocate a conf_t structure and initialize it using this function. It sets some defaults, and then it scans your environment variables for some settings, and it tries to read a system-wide and personal user configuration file. axel_t *axel_new( conf_t *conf, char count, char *url ); axel_t *axel_new( conf_t *conf, char count, search_t *urls ); axel_new() allocates a new axel_t structure. You should pass a configuration structure and an URL. A pointer to a new axel_t structure will be returned. axel->filename is set now. You can change it, if you want data to be stored to a different file. Changing axel->filename after calling axel_open does not make sense, so be quick. :-) If you want axel to download from more than one mirror at once, you can use the second syntax. A search_t structure can be generated by the search_* functions. If you use the second syntax, count should contain the number of mirrors to be used from the structure. If you just want to pass a string with one URL (first syntax), count should be zero. Please note that all the mirrors passed to axel_new() should support acceleration. The support check should be done before downloading, which isn't much of a problem because search_getspeeds does it automatically. The ready element of the returned structure is set to one if nothing goes wrong. If it's zero, you shouldn't use the returned structure for anything else than displaying the error message(s) and closing it. int axel_open( axel_t *axel ); axel_open() opens a local file to store downloaded data. Returns non-zero if nothing goes wrong. If anything goes wrong, you should still call axel_close() to clean things up. This is not done automatically, so that you can read any message still left in the structure. void axel_start( axel_t *axel ); axel_start() starts the actual downloading. Normally, nothing should go wrong during this call, so it does not return anything. void axel_do( axel_t *axel ); axel_do() should be called regularly (ie as often as possible...) to handle any incoming data. You don't have to do anything else, all data is stored in the local file automatically. You should stop calling this one as soon as axel->ready is set. Or you can stop calling it yourself, that's possible. Just don't forget to call axel_close()! void axel_close( axel_t *axel ); If you want to stop downloading (ie if the download is complete) you should deallocate the axel_t structure using this function. Any connection still open will be closed and deallocated, all messages in the structure are deleted. You should always call this one when you're ready, if you don't want to waste memory. double gettime(); This one is just a 'bonus'... I use it myself in text.c and axel.c, so I decided to make it global. It just returns the actual time, but with more precision. /* filesearcher.com interface */ If you want to search for a faster mirror to download your file, or if you want to download from more than one server at once, you can use this interface. It's quite simple. You should create an array of this type: typedef struct { char url[MAX_STRING]; double speed_start_time; int speed, size; pthread_t speed_thread[1]; conf_t *conf; } search_t; And it's wise to memset() it to zero before you start, btw. You also have to set the conf pointer for the first index of the array. Other fields will be filled in by these functions: int search_makelist( search_t *results, char *url ); This function checks your URL, fetches the file size (needed for the search) and queries the ftpsearcher.com server for any mirror of this file. This one is finished in a few seconds on my system. It returns the number of mirrors found. Please note that, after calling this function, the first index of your search_t array contains the URL you used as an argument to this function. The speed field is filled in already for that one. int search_getspeeds( search_t *results, int count ); This is quite time consuming. It tries all the URL's from the list, and checks the speed. URL's which do not exist, or URL's on non-supported servers are marked as bad, they can't be used. This is more time-consuming than a simple ping (it takes about twenty seconds on my system, but it heavily depends on the connection and your settings), but it makes sure only usable URL's are passed to the downloader. The function returns the number of not-bad servers. void search_sortlist( search_t *results, int count ); It's very wise to sort the list of mirrors using this function before passing it to axel_new(). The fastest URL will be put on top of the list, bad URL's will be put at the bottom. Please note that count has to be the total number of servers, returned by search_makelist(), and not just the number of not-bad servers returned by search_getspeed(). axel-2.4/CHANGES0000644000175000001440000002636311175337327012511 0ustar appajiusersVersion 2.4 - Fix a buffer overflow caused by wrong size limits when copying strings (Closes: #311569), thanks Michael Schwendt and the Fedora project members - Fix thread hangups due to incorrect synchronization (Closes: #311469), thanks Yao Shi - Removed Fedora packaging file. axel will be available in the Fedora repositories soon. - Use /etc/ instead of /usr/etc/ as the default system-wide configuration location. - Respect environment CFLAGS in configure. - Allow special characters in arguments to configure. - Add MimeType and fix Categories in the desktop file. Version 2.3 - Wait for thread termination in axel.c:axel_do (Closes: #311255), thanks John Ripa - New Chinese translation and manpage, thanks Shuge Lee - Fix LFS support for FTP (Closes: #311320) - Fix LFS support (Closes: #311324), thanks Rodrigue Le Bayon Version 2.2: - Fix a buffer overflow in http.c:http_encode. Version 2.1: - Fix version string. 2.0 still reported 1.1, thanks Ajay R Ramjatan - Fix new MB/s display (was showing B/s). Thanks Philipp Hagemeister Version 2.0: - Large file support thanks thanks David Turnbull - Custom Header Support thanks Eli Yukelzon - New russian translation thanks newhren - Fix segfault in -H option thanks Philipp Hagemeister - Honour http_proxy and prefer it over HTTP_PROXY - Add new RPM spec file thanks bbbush Finished Sep 12 2008 Version 1.1: - Compilation for GNU/kFreeBSD, thanks to Cyril Brulebois - Use simple pop-ups for Help and Bug Report buttons - Use strncpy instead of strcpy for length sensitive copies - Always compile with -g, disable -O3 - Translation updates: de.po thanks Hermann J. Beckers - Update manpages axel.1 and axel-kapt.1 - Prevent crash and raise error if FTP CWD fails - Prevent crash on long URLs and increase max length of URL to 1024 - Fix segfaults on HTTP404 and HTTP401 responses Finished Jan 18 2008 Version 1.0b: - Removed spaces between -S[x] in man-pages, etc. They mess things up. - Fixed configure for OpenBSD. - Fixed configuration bug: s/alternate_interface/alternate_output/ in axelrc.example, thanks to CLOTILDE Guy Daniel for the bug report! - Fixed weird behaviour when downloading from an unsupported server. - Fixed buffer overflow in conn.c. (CAN-2005-0390) Finished Apr 06 2005 Version 1.0a: - gstrip on Solaris/SPARC breaks the binary, so stripping is made optional (but enabled by default!) and /usr/ccs/bin/strip is used instead of gstrip. - Fixed a small (not harmful) errorcode interpretation bug in the ftp_size code. - Downloading from unsupported sites works better now. - Added support for downloading using more than one local network interface. - Fixed a potential SIGSEGV bug. Would only happen with about more than 64 connections usually. Still strange things can happen with too many connections when using Linux.. - Hopefully fixed the problem with downloading from forwarding URL's. - HTTP %-escapes are handled now. - Alternate progress indicator with estimation of remaining download time - Changed the return-code a bit, see man-page for details. Finished Feb 19 2002 Version 1.0: - Fixed a reconnect problem: Check for stalled connections was skipped by previous versions if there is no active connection. - Solaris does not have www in /etc/services which confused Axel. Fixed. - Created a new build system. - install utility not used anymore: Solaris' install does weird things. - Added support for Cygwin and Solaris. - Corrected a little problem in de.po. - Thrown out the packaging stuff. Finished Dec 6 2001 Version 0.99b brings you: - Debian package bugfix. - Restored i18n support. Finished Nov 16 2001 Version 0.99a brings you: - Small bugfix for dumb HTTP bug. Finished Nov 10 2001 Version 0.99 brings you: - Improved speed limiter. (For low speeds a smaller buffer works better, so the buffer is resized automatically for low speeds.) - Some FTP servers don't ask for a password which confused ftp.c. Fixed. - Some HTTP servers send chunked data when using HTTP/1.1. So I went back to HTTP/1.0.. (This also fixes the occasional filesearching.com problem) - Even more problems with FTP server reply codes, but they must be fixed now, Axel's RFC compliant. - For HTTP downloads a Range: header is not sent when downloading starting at byte 0. This is just a work-around for a problem with a weird webserver which sends corrupted data when a Range: header is sent. It's just a work-around for a rare problem, it does not really fix anything. - RPM package for axel-kapt added. Finished Nov 9 2001 Version 0.98 brings you: - Fixed the weird percentage indicator bug. (Was buggy for large files, did not affect the downloaded data.) - For single connection downloads from Apache: Apache returns a 200 result code when the specified file range is the complete file. Axel handles this correctly now. - Roxen FTP servers return the address and port number without brackets after a passive command. This is RFC-compliant but quite unique. But now handled correctly. - Fixed some things to make it work on Darwin again. - 'Upgraded' HTTP requests to HTTP/1.1. Tried this to fix a download corruption bug for downloads from archive.progeny.com, but it did not work. wget's resume has exactly the same problem. But using HTTP/1.1 is more compliant (because in fact HTTP/1.0 does not support Ranges) so I'll keep it this way.. - Previous version used to delete the statefile in some cases. Fixed. Finished Nov 3 2001 Version 0.97 (Bitcrusher) brings you: - Major redesign: Moved a lot of code from main() to separate functions, it should make it easier to create different interfaces for the program. - All those ifdefs were a mess, they don't exist anymore. Separate threads for setting up connections are used by default now. Version 0.96 will not disappear, by the way. - HTTP HEAD request not used anymore: Squid's headers are incorrect when using the HEAD request. - conn_disconnect did not work for FTP connections through HTTP proxies. - Documentation fix, sort of: The example configuration file still said proxies are unsupported. But they are supported for quite some time already. - Wrote a small (Small? Larger than any other doc.. :-) description of the Axel API. - Added finish_time code. (Credits to sjoerd@huiswerkservice.nl) - Calling conn_setup without calling conn_init first also works when using a proxy now. - A client for filesearching.com. You can use it to search for mirrors and download from more than mirror at once. - Fixed another segfault bug which did not show up on my own system... Also fixed by 0.96a. - Global error string is gone. Unusable in threaded programs. - The -V switch stopped working some time ago because I forgot to put it in the getopt string. Now it's back, alive and kickin'... - TYPE I should be done quite early. Some servers return weird file sizes when still in ASCII mode. - ftp.c (ftp_wait) sometimes resized conn->message to below MAX_STRING which is Not Good(tm). - I18N support is a bit broken at this time, it'll be fixed later. - Tidied up the man-page a bit. - Removed config.h file, -D flags used again. - Added axel-kapt interface. - Changed syntax: Local file must be specified using the -o option now. This allows the user to specify more than one URL and all of them will be used for the download. A local directory can be passed as well, the program will append the correct filename. - Fixed a bug which caused the program not to be able to download files for which only one byte has to be downloaded for one of the connections. - Why bitcrusher? Just because I liked to have a code name for this release... Bit crusher is a name of a musical group here in the Netherlands, and it's a nice name for a downloader as well, I hope... Finished Oct 25 2001 Version 0.96 brings you: - Fixed a terrible bug which caused any FTP download to corrupt. I promise I will test the program before any next release. :-(( HTTP did work in 0.95. Finished Aug 14 2001 (Why is this fix so late? Because the actual release of version 0.95 was only last Friday/Saturday...) And yes, I tested it now. It works now. HTTP and FTP. Version 0.95 brings you: - An important bugfix: When bringing up the connection failed, the program used to be unable to reconnect. :( - Small changes to make the program compile on FreeBSD and Darwin. - Support check for FTP servers is done only once now. - SIZE command is really used now. - Fixed a SIGINT-does-not-abort problem. Btw: Ctrl-\ (SIGQUIT) always works! - Connection status messages are not displayed by default. You can enable them with the verbose-option. Finished Aug 7 2001 Version 0.94 brings you: - 'make install' uses install instead of mkdir/cp now. - Added 'make uninstall' option. - Added more explanations to axelrc.example. - It uses the HTTP HEAD request now. Didn't know that one before. :) - Debian packaging stuff and RPM .spec file included by default. - select() problem now really understood... The real point was, that sometimes select() was called with an empty fd set. Now I solved the problem in a more 'useful' way. Finished Jun 26 2001 Version 0.93 brings you: - A compile-time option to remove all the multi-connection stuff. Program works without state files then, and it's a bit smaller, just in case you need a very small program and if you don't believe in acceleration. :) - The SIZE command is now used as long as the URL does not contain wildcards. Because FTP servers are just too different. :( - You can do FTP downloads through HTTP proxies now. - The weird initial 1-second delay which happened sometimes does not exist anymore: It was because of select(), which does not return immediately if there's data on a socket before the call starts. My first solution is using a lower timeout, I hope there's a better solution available... - Local file existence check. - Small bug fixed in conf.c. Finished May 22 2001 Version 0.92 brings you: - A credits file!! ;) - A German translation. Herrman J. Beckers: Thanks a lot! - ftp.c should understand weird Macintosh FTP servers too, now. - Connections are initialized in a different thread because then the program can go on downloading data from other connections while setting up. Quick hack, but it works. - config.h contains the configuration definitions now. - A URL - can be specified. The program will read a URL from stdin. Might be useful if you don't want other people to see the URL in the 'ps aux' output. (Think about passwords in URLs...) Finished May 11 2001 Version 0.91 brings you: - A man page. - A quiet mode. - A Debian package. (0.9 .deb exists too, but that was after the 'official' 0.9 release..) - Made the sizes/times displayed after downloading more human-readable. - Corrected some stupid things in the nl.po file. - No bug in ftp_wait anymore, (or at least one bug less ;) the program was a bit too late with the realloc() sometimes. I just hate those multi-line replies.. :( - HTTP proxy support. no_proxy configuration flag also in use. - Support for empty configuration strings. - URL parser understands wrongly formatted URLs like slashdot.org. (instead of the correct http://slashdot.org/) Finished Apr 30 2001 Version 0.9 brings you: - See the README for all the old features. - Internationalization support. - Clearer error messages. - Probably some bug fixes too. - A highly sophisticated Makefile.. ;) Finished Apr 22 2001 axel-2.4/COPYING0000644000175000001440000004310311175337327012540 0ustar appajiusers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. axel-2.4/CREDITS0000644000175000001440000000276011175337327012531 0ustar appajiusersAn not-quite-sorted list of people who helped somehow: - Philipp Hagemeister Bug triage and patches to fix bugs - bbbush RPM spec file - newhren Russian translation - Eli Yukelzon Custom Header Support - David Turnbull Large file support - Hermann J. Beckers German translation. - Martin Herrman Requested the human-readable time/size values. Advertising in the Dutch Linux User's Manual. (http://2mypage.cjb.net/) - Marten Klencke Early tester. - Danny Oude Bos For having an iMac with a very badly-behaving FTP server... - Ralph Slooten For creating the initial native RPM packages instead of my alienated .debs. - Robert For patching the program to make it work on FreeBSD and Darwin. For finding some very stupid bugs. - Sjoerd Hemminga For adding the finish_time feature. It's not yet in the user interface, though... For writing axelq. - Paul Evans For being a very good beta tester. For creating axel-kapt. - Justin A For some testing and for the new (multi-URL) syntax idea. - Sebastian Ritterbusch For some interesting ideas for the new versions. For writing the alternate progress indicator. axel-2.4/README0000644000175000001440000000376711175337327012401 0ustar appajiusersAxel Home: See http://axel.alioth.debian.org/ for latest information on axel /*************************\ * Supported architectures * \*************************/ Should compile on any decent Linux system. Additionaly, it should compile (and run) on BSD, Solaris, Darwin (Mac OS X) and Win32 (Cygwin) systems. If the configure script does weird things on your system, please do warn me! I test it on as many machines and OS'es as possible, but still anything can go wrong. /********************\ * How to install/use * \********************/ Run the configure script (you can supply some options if you want, try './configure --help' for more info) and then run make. The program should compile then. There are no special requirements for Axel. You can install the program using 'make install' or you can just run it from the current directory. You can copy the axelrc.example file to ~/.axelrc then, if you want to change some of the settings. Run the program like this: axel ftp://ftp.nl.kernel.org/pub/linux/kernel/v2.2/linux-2.2.20.tar.bz2 For a simple single-server-multiple-connection download, or: axel ftp://ftp.{nl,be,de}.kernel.org/pub/linux/kernel/v2.2/linux-2.2.20.tar.bz2 If you want to use those three servers for the download. The program can do an automatic search for FTP mirrors as well (filesearching.com), but that's not yet perfect... Just try the -S option. (The line above should at least work with the Bash shell. You can type all the mirrors by hand as well, if you really want to, and/or of necessary...) Just one other thing you should keep in mind when using this program: Some FTP operators don't like people who use download accelerators. To quote an administrator at Progeny.Com in a mail to me: Additionally, I should mention that accelerated downloads are discouraged as I consider them abusive. And he certainly has a point.. Using more than one server at once is a fine solution IMHO, so please use this feature if possible! Wilmer van der Gaast.