pax_global_header00006660000000000000000000000064126155133210014511gustar00rootroot0000000000000052 comment=7993512ca6b259cf04e9011541205db403ea1846 axel-2.5/000077500000000000000000000000001261551332100123105ustar00rootroot00000000000000axel-2.5/API000066400000000000000000000220171261551332100126460ustar00rootroot00000000000000 /********************************************************************\ * 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.5/CHANGES000066400000000000000000000337161261551332100133150ustar00rootroot00000000000000Version 2.5, 2015-11-01 [ Joao Eriberto Mota Filho ] 2015-11-01 * Changed the homepage of the project in several files. * axel.h: bumped to 2.5 version. * configure: - Changed the default prefix to /usr. - Changed the default etc path to /etc. - Changed CFLAGS and LDFLAGS definition lines to allow external values, as GCC hardening sent by Debian. * gui/: removed. The binary axel-kapt depended on kaptain that is no longer available for QT5 (dead upstream development). For details, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=789819 * http.c: fix a possible buffer overflow. * Makefile: disabled the .po regeneration/merge actions to avoid changes in source code when building. I will try to fix it in future. * manpage: - Moved to man/ directory. - Using txt2man to generate the manpage. - Updated the manpage. - Removed some typos. - Dropped the Chinese manpage (outdated now). * README.md: added to be the main file for GitHub. * README.to-contribute: added to explain how to contribute. [ Barry deFreese ] 2009-06-11 * Added Hurd (GNU) to configure file. It will allow Axel to build over GNU/Hurd. This change was provided by Barry deFreese , as a patch to Debian project, on 11 Jun 2009. For details, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532793 [ Mark Smith ] 2010-07-03 * Added a support to IPv6. This change was provided by Mark Smith , as a patch to Debian project, on 03 Jul 2010. For details, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525290 [ unknown person ] 2010-08-19 * Fixed incorrect unit of time in download summary. For details see https://alioth.debian.org/tracker/index.php?func=detail&aid=312669&group_id=100070&atid=413085 [ unknown person ] 2011-04-12 * Fixed an issue that produces a Bad HTTP Request when 302 redirected link is longer than 255 chars (like youtube). For details, see https://alioth.debian.org/tracker/index.php?func=detail&aid=313080&group_id=100070&atid=413085 [ Osamu Aoki ] 2012-03-10 * Added the translation to Japanese. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663286 and https://alioth.debian.org/tracker/index.php?func=detail&aid=313565&group_id=100070&atid=413085 * Changed the configure file to honor the noopt when building. So, was removed the '-Os' option. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=645271 [ From original authors ] * Releasing this old block (written after 2.4 and before 2.5 versions): - Make axel build on HP-UX, thanks Ciro Iriarte - Fix Solaris support (Closes: #312092), thanks Sebastian Kayser - Add PO-Revision-Date header to ru.po Version 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.5/COPYING000066400000000000000000000431031261551332100133440ustar00rootroot00000000000000 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.5/CREDITS000066400000000000000000000035021261551332100133300ustar00rootroot000000000000002.5 version: - Barry deFreese Build over GNU/Hurd. - Mark Smith IPv6 support. - Osamu Aoki Added translation to Japanese. Honor noopt when buildind. Up to the 2.4 version: An 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. (deprected in 2.5 version, see the CHANGES file) - 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.5/Makefile000066400000000000000000000045311261551332100137530ustar00rootroot00000000000000########################### ## 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 ja.mo all: $(OUTFILE) install: install-bin install-etc install-man uninstall: uninstall-bin uninstall-etc uninstall-man 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 man/axel.1 $(DESTDIR)$(MANDIR)/man1/axel.1 uninstall-man: rm -f $(MANDIR)/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) $(LDFLAGS) $(CPPFLAGS) $(STRIP) $(OUTFILE) .c.o: $(CC) -c $*.c -o $*.o $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) 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 --numeric-owner --owner 0 --group 0 --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 # The following target is generating changes in original source code when # building. It will be temporally disabled. I will fix/change/optimize it # in future. # #%.po: $(wildcard *.c *.h) # -@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 i18n-mofiles: $(MOFILES) 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.5/README000066400000000000000000000037761261551332100132050ustar00rootroot00000000000000Axel Home: See https://github.com/eribertomota/axel for latest information on axel /*************************\ * Supported architectures * \*************************/ Should compile on any decent Linux system. Additionally, 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. axel-2.5/README.md000066400000000000000000000031231261551332100135660ustar00rootroot00000000000000# AXEL **Light command line download accelerator for Linux and Unix**

**1. HELP THIS PROJECT**
**2. WHAT IS AXEL?** -------------------- 1. HELP THIS PROJECT -------------------- Axel needs your help. **If you are a programmer** and if you wants to help a nice project, this is your opportunity. My name is Eriberto and **I am not a C developer**. I imported Axel from its old repository[1] to GitHub (the original homepage and developers are inactive). After this, I applied all patches found in Debian project and other places for this program. All my initial work was registered in CHANGES file (version 2.5). I also maintain Axel packaged in Debian[2]. If you are interested to help Axel, read the README.to-contribute[3] file. [1] https://alioth.debian.org/projects/axel
[2] https://packages.qa.debian.org/a/axel.html
[3] https://github.com/eribertomota/axel/blob/master/README.to-contribute ---------------- 2. WHAT IS AXEL? ---------------- Axel tries to accelerate the downloading process by using multiple connections for one file, similar to DownThemAll and other famous programs. It can also use multiple mirrors for one download. Using Axel, you will get files faster from Internet. So, Axel can speed up a download up to 60% (approximately, according to some tests). Axel tries to be as light as possible, so it might be useful as a wget clone (and other console based programs) on byte-critical systems. Axel was originally developed by Wilmer van der Gaast. Thanks for your efforts. Over time, Axel got several contributions from people. Please, see the file CREDITS. axel-2.5/README.to-contribute000066400000000000000000000017111261551332100157650ustar00rootroot00000000000000 HOW TO CONTRIBUTE TO AXEL DEVELOPMENT If you are interested to contribute to axel development, please, follow these steps: 1. Send a patch that fix an issue or that implement a new feature. 2. Ask for join to the Axel project in GitHub, if you want to work officially. Note that this second step isn't compulsory. To find issues and bugs to fix, you can check these addresses: - https://github.com/eribertomota/axel/issues - https://alioth.debian.org/tracker/?atid=413085&group_id=100070&func=browse (ALIOTH IS THE OLD HOMEPAGE, BUT HAS OPENED BUGS) - https://bugs.debian.org/cgi-bin/pkgreport.cgi?dist=unstable;package=axel - https://bugs.launchpad.net/ubuntu/+source/axel/+bugs - https://apps.fedoraproject.org/packages/axel/bugs - https://bugs.archlinux.org/?project=5&cat[]=33&string=axel - https://bugs.gentoo.org/buglist.cgi?quicksearch=net-misc%2Faxel If you want to join, please contact me: eriberto at eriberto.pro.br axel-2.5/ROADMAP000066400000000000000000000113421261551332100133170ustar00rootroot00000000000000Roadmap for Axel v2 =================== * Check if strrstr is provided by environment * Use SI prefixes Roadmap for Axel v3 =================== Note: This document provides only a rough overview what to do next. Refer to the bugtracker ( https://github.com/eribertomota/axel/issues ) for detailled information. Pre-release version numbers of Axel 3 will start with 2.99. Starting with the 3.x series, the following version scheme will be adopted: x.y.z x: Complete overhaul of the code structure y: New features and/or speed/size improvements z: Bug fixed Features ======== * HTTP authentication (#310785) This is actually already implemented and should be documented. Using -H is possible, too. * Metalink (#310625) Basic Metalink support should not be that difficult. However, it will only be compiled if METALINK is defined. Metalink support will require libxml2. As libmetalink is currently unusable for us (private symbols), we'll implement the format ourselves. * .netrc (#310635) There are lots of GPLed implementations flying around. To minimize code size, it shouldn't be compiled in by default if the code exceeds a couple of bytes. Anyway, it's just one call from Axel's point of view. * Prevent connection to same server (#310638) See tcp.c below for the implementation (aside from a flag in the configuration and a cli flag). * Force overriding state file (#311022) Shouldn't be difficult and take more than a couple of bytes. * SSL protocols (HTTPS, FTPS) (#311163) * Parse Content-Disposition header (#311101) Look if the specific problem mentioned in the bug is fixed by this. Code structure ============== * conn.c needs cleanup, possibly even elimination. Most functions look like if (ftp && !proxy) { // ... do FTP stuff (15 lines) } else { // ... do HTTP stuff (20 lines) } We should at least abstract the switch between HTTP and FTP and look what can be done about simplifiying and documenting the functions here. Furthermore, redirecting should be cached somehow/done only once lest we reach the redirect limit because it's less than -n. * tcp.c should be checked. The functions look a little bit obscure to me. But maybe, that's just me. Before we implement #310638, we should include some round-robin trickery in here. * Removing MAX_STRING(#311085) and MAX_ADD_HEADERS. These are arbitrary restrictions and may hide a number of strange bugs. Furthermore, statically sized fields are a waste of memory. * Add die messages: Axel must not exit with != 0 without telling why. * Add debugging messages: When compiled with DEBUG, Axel could be more verbose. This won't harm anything and may serve as comments. * Some functions could use a little bit of documentation. * Remove all logic from text.c * Ensure correct synchronization of thread state (volatile?) * Cleanup AXEL_LEGACY * rewrite axel-kapt to be sane (probably sh, or even #!/usr/bin/env kaptain suffices) or remove it in favor of a sane GUI Bugs ==== We're gonna fix them all! #310979 seems pretty vague. Check spaces in FTP and HTTP URLs (User) Documentation ==================== * As previously mentioned, authentication should be documented. * Update API 3.1 === * Cookies (#310835) Can be implemented via -H. The bug called for reading the Netcape-style cookies.txt (Wget's --load--cokies option). Domain-specific cookies could be rather complex to implement. If the implementation of this feature costs more than 100B, it should be deselectable. * Rate-limit status messages (#TODO) * Don't discard first HTTP connection, but use it adaptively (start requests from the end, RST as soon as first task is fullfilled) * A -1 option: Just make one request, and only one. * IPv6 support 3.2 === * Write a macro ERROR_MESSAGE(msg) (msg), enclose all _("some long error message") and offer a compilation option for a single error message, see if that yields any size improvements * Check compilation with dietlibc(http://www.fefe.de/dietlibc/) and uclibc(http://www.uclibc.org/): · How to compile with these libraries · Does this actually improve the binary size? · Check warnings/suggestions * valgrind and friends * Test very large -n values. Check pthread thread stack size. Future/Ideas ============ * Real FTPS (AUTH)? * Allow downloading to /dev/null for debugging or speed test purposes (Statefile in memory or so) * Desktop integration, look who likes download accelerators * Check the syscalls we make. Check whether timing and read() calls can be optimized * Write automated tests to test all these nifty corner cases. Either a test webserver or LD_PRELOAD injection of all syscalls (see libfake*) * Write a helper script that displays the final binary size for different configurations to determine what a particular feature costs * Document and implement coding conventions, versioning scheme axel-2.5/UPDATE-CHECK000066400000000000000000000001551261551332100140310ustar00rootroot00000000000000When updating, change these files (if needed): - AUTHORS - CHANGES - CREDITS - axel.h (AXEL_VERSION_STRING) axel-2.5/axel.c000066400000000000000000000405401261551332100134100ustar00rootroot00000000000000 /********************************************************************\ * 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.5/axel.h000066400000000000000000000055421261551332100134200ustar00rootroot00000000000000 /********************************************************************\ * 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.5" #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.5/axelrc.example000066400000000000000000000072721261551332100151530ustar00rootroot00000000000000############################################################################ ## ## ## 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.5/conf.c000066400000000000000000000132071261551332100134040ustar00rootroot00000000000000 /********************************************************************\ * 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.5/conf.h000066400000000000000000000033441261551332100134120ustar00rootroot00000000000000 /********************************************************************\ * 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.5/configure000077500000000000000000000147101261551332100142220ustar00rootroot00000000000000#!/bin/sh ######################################################################## ## Configurer for Axel ## ## ## ## Copyright 2001 Lintux (Wilmer van der Gaast ## ## Copyright 2009 Barry deFreese ## ## Copyrigth 2012 Osamu Aoki ## ## Copyright 2015 Joao Eriberto Mota Filho ## ######################################################################## prefix='/usr' bindir='$prefix/bin' etcdir='/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= EOF cat<config.h /* Axel settings, generated by configure */ #define _REENTRANT #define _THREAD_SAFE #define ETCDIR "$etcdir" #define LOCALE "$locale" #define ARCH "$arch" EOF AXEL_LFLAGS=${LFLAGS} 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; echo "all: i18n-mofiles" >> Makefile.settings echo "install: install-i18n" >> Makefile.settings echo "uninstall: uninstall-i18n" >> Makefile.settings fi AXEL_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 ${CFLAGS}" if [ "$debug" = "1" ]; then AXEL_CFLAGS="${AXEL_CFLAGS} -g" 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 [ -f /usr/local/include/libintl.h ]; then AXEL_CFLAGS="${AXEL_CFLAGS} -I/usr/local/include" AXEL_LFLAGS="${AXEL_LFLAGS} -L/usr/local/lib" elif [ -f /opt/csw/include/libintl.h ]; then AXEL_CFLAGS="${AXEL_CFLAGS} -I/opt/csw/include" AXEL_LFLAGS="${AXEL_LFLAGS} -L/opt/csw/lib" elif [ -f "${prefix}/include/libintl.h" ]; then AXEL_CFLAGS="${AXEL_CFLAGS} -I${prefix}/include" AXEL_LFLAGS="${AXEL_LFLAGS} -L${prefix}/lib" fi fi if [ "${CC}" != "" ]; then echo "CC=${CC}" >> Makefile.settings; elif type gcc > /dev/null 2> /dev/null; then echo "CC=gcc" >> Makefile.settings; AXEL_CFLAGS="${AXEL_CFLAGS} -Wall" 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 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 [ -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 AXEL_LFLAGS="${AXEL_LFLAGS} -pthread" if [ "$i18n" = "1" ]; then AXEL_LFLAGS="${AXEL_LFLAGS} -lintl" fi ;; OpenBSD ) echo '#define NOGETOPTLONG' >> config.h AXEL_LFLAGS="${AXEL_LFLAGS} -pthread" if [ "$i18n" = "1" ]; then AXEL_LFLAGS="${AXEL_LFLAGS} -lintl" fi ;; NetBSD ) echo 'WARNING: NetBSD not tested! Using OpenBSD settings.' echo '#define NOGETOPTLONG' >> config.h AXEL_LFLAGS="${AXEL_LFLAGS} -pthread" if [ "$i18n" = "1" ]; then AXEL_LFLAGS="${AXEL_LFLAGS} -lintl" fi ;; Darwin ) echo '#define NOGETOPTLONG' >> config.h AXEL_LFLAGS="${AXEL_LFLAGS} -pthread" if [ "$i18n" = "1" ]; then AXEL_LFLAGS="${AXEL_LFLAGS} -lintl" fi echo '#define DARWIN' >> config.h ;; Linux | GNU/kFreeBSD | GNU) AXEL_LFLAGS="${AXEL_LFLAGS} -pthread" ;; SunOS ) echo '#define NOGETOPTLONG' >> config.h echo '#define BSD_COMP' >> config.h AXEL_LFLAGS="${AXEL_LFLAGS} -pthread -lsocket -lnsl" if [ "$i18n" = "1" ]; then AXEL_LFLAGS="${AXEL_LFLAGS} -lintl" fi ;; HP-UX ) echo '#define NOGETOPTLONG' >> config.h if [ "$i18n" = "1" ]; then if [ -d /usr/local/lib/hpux32 ]; then AXEL_LFLAGS="${AXEL_LFLAGS} -L/usr/local/lib/hpux32" fi AXEL_LFLAGS="${AXEL_LFLAGS} -lintl" fi AXEL_LFLAGS="${AXEL_LFLAGS} -lpthread" ;; CYGWIN_* ) AXEL_LFLAGS="${AXEL_LFLAGS} -pthread" if [ "$i18n" = "1" ]; then AXEL_LFLAGS="${AXEL_LFLAGS} -lintl" fi echo 'OUTFILE=axel.exe' >> Makefile.settings ;; * ) AXEL_LFLAGS="${AXEL_LFLAGS} -pthread" echo '#define NOGETOPTLONG' >> config.h if [ "$i18n" = "1" ]; then AXEL_LFLAGS="${AXEL_LFLAGS} -lintl"; fi echo 'WARNING: This architecture is unknown!' echo '' echo 'That does not mean Axel will not work, it just means Axel is not tested on it.' echo 'It'\''d be a great help if you could send me more information' echo 'about your platform so that it can be addedto 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 "CFLAGS+=${AXEL_CFLAGS}" >> Makefile.settings echo "LFLAGS+=${AXEL_LFLAGS}" >> Makefile.settings 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.5/conn.c000066400000000000000000000210001261551332100134020ustar00rootroot00000000000000 /********************************************************************\ * 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@axel.project" ); } 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, "%1000s", 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.5/conn.h000066400000000000000000000036311261551332100134210ustar00rootroot00000000000000 /********************************************************************\ * 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.5/de.po000066400000000000000000000176001261551332100132440ustar00rootroot00000000000000msgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-03-11 00:56+0900\n" "PO-Revision-Date: 2008-09-15 22:08+0200\n" "Last-Translator: Hermann J. Beckers \n" "Language-Team: deutsch \n" "Language: \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 fr diese Geschwindigkeit angepasst." #: axel.c:91 msgid "Could not parse URL.\n" msgstr "Kann URL nicht parsen.\n" #: axel.c:126 #, c-format msgid "File size: %lld bytes" msgstr "Dateigre: %lld 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 #, c-format msgid "State file found: %lld bytes downloaded, %lld to go." msgstr "Status-Datei gefunden: %lld bytes bertragen, %lld 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 mglich\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 fr 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 "Ungltige 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 mglich!\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 #, c-format msgid "%lld byte" msgstr "%lld byte" #: text.c:441 #, c-format msgid "%.1f Kilobyte" msgstr "%.1f Kilobytes" #: text.c:443 #, c-format msgid "%.1f Megabyte" msgstr "%.1f Megabytes" #: text.c:445 #, c-format msgid "%.1f Gigabyte" msgstr "%.1f Gigabytes" #: 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 https://github.com/eribertomota/axel/issues 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\tzustzliche 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 https://github.com/eribertomota/axel/issues 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\tzustzliche 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.5/ftp.c000066400000000000000000000200621261551332100132450ustar00rootroot00000000000000 /********************************************************************\ * 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.5/ftp.h000066400000000000000000000031731261551332100132560ustar00rootroot00000000000000 /********************************************************************\ * 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.5/http.c000066400000000000000000000136441261551332100134430ustar00rootroot00000000000000 /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * * Copyright 2015 Joao Eriberto Mota Filho * * \********************************************************************/ /* 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 - strlen(conn->headers) - 1 ); } #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.5/http.h000066400000000000000000000035641261551332100134500ustar00rootroot00000000000000 /********************************************************************\ * 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.5/ja.po000066400000000000000000000215151261551332100132460ustar00rootroot00000000000000# Japanese messages for axel # Copyright (C) 2012 Osamu Aoki # This file is distributed under the same license as the axcel package. msgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-03-11 00:56+0900\n" "PO-Revision-Date: 2012-03-11 00:03+0900\n" "Last-Translator: Osamu Aoki \n" "Language-Team: debian-japanese@lists.debian.org\n" "Language: \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 "ファイルシステム/OSがイマイチ。回避します。 :-(" #: 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 "標準出力を /dev/null にリディレクトできません。\n" #: text.c:176 #, c-format msgid "Error when trying to read URL (Too long?).\n" msgstr "URL を読もうとした際に(長すぎ?)エラー。\n" #: text.c:185 #, c-format msgid "Can't handle URLs of length over %d\n" msgstr "%d を超える長さの URL は取り扱えません\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 つ見つかりましたので、以下の URL を使用します:\n" #: text.c:269 #, c-format msgid "Filename too long!\n" msgstr "ファイル名が長すぎます!\n" #: 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 KB/s)\n" #: text.c:439 #, c-format msgid "%lld byte" msgstr "%lld バイト" #: text.c:441 #, c-format msgid "%.1f Kilobyte" msgstr "%.1f キロバイト" #: text.c:443 #, c-format msgid "%.1f Megabyte" msgstr "%.1f メガバイト" #: text.c:445 #, c-format msgid "%.1f Gigabyte" 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 #, 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" "" msgstr "" "使用法: axel [options] url1 [url2] [url...]\n" "\n" "-s x\t最大速度を指定 (毎秒のバイト数)\n" "-n x\t最大接続数を指定\n" "-o f\tローカルの出力ファイルを指定\n" "-S [x]\tミラーを探し x サーバーからダウンロード\n" "-H x\tヘッダーストリングを追加\n" "-U x\tユーザーエージェントを設定\n" "-N\tプロキシサーバーを一切使用しなくする\n" "-q\t標準出力を使用しない\n" "-v\t状態情報を増加させる\n" "-a\t代替のプログレスインディケーター\n" "-h\tこの情報\n" "-V\tバージョン情報\n" "\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" "" msgstr "" "使用法: axel [options] url1 [url2] [url...]\n" "\n" "-max-speed=x\t\t-s x\t最大速度を指定 (毎秒のバイト数)\n" "--num-connections=x\t\t-n x\t最大接続数を指定\n" "--output=f\t\t-o f\tローカルの出力ファイルを指定\n" "--search[=x]\t\t-S [x]\tミラーを探し x サーバーからダウンロード\n" "--header=x\t\t-H x\tヘッダーストリングを追加\n" "--user-agent=x\t\t-U x\tユーザーエージェントを設定\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" "" #: text.c:578 #, c-format msgid "Axel version %s (%s)\n" msgstr "Axel バージョン %s (%s)\n" axel-2.5/man/000077500000000000000000000000001261551332100130635ustar00rootroot00000000000000axel-2.5/man/axel.1000066400000000000000000000110571261551332100141020ustar00rootroot00000000000000.TH axel "1" "Nov 2015" "AXEL 2.5" "light command line download accelerator" .\" Text automatically generated by txt2man .SH NAME \fBaxel \fP- light command line download accelerator \fB .SH SYNOPSIS .nf .fam C \fBaxel\fP [\fIOPTIONS\fP] \fIurl1\fP [\fIurl2\fP] [url\.\.\.] .fam T .fi .fam T .fi .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. .PP 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 does not have to concatenate all the downloaded parts. .SH OPTIONS 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 .B \fB--max-speed\fP=x, \fB-s\fP x Specify a speed (bytes per second) to try to keep the average speed around this speed. This is useful if you do not want the program to suck up all of your bandwidth. .TP .B \fB--num-connections\fP=x, \fB-n\fP x Specify an alternative number of connections. .TP .B \fB--output\fP=x, \fB-o\fP x 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 .B \fB--search\fP[=x], \fB-S\fP[x] 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 .B \fB--no-proxy\fP, \fB-N\fP Do not use any proxy server to download the file. Not possible when a transparent proxy is active somewhere, of course. .TP .B \fB--verbose\fP, \fB-v\fP Show more status messages. Use it more than once to see more details. .TP .B \fB--quiet\fP, \fB-q\fP No output to stdout. .TP .B \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 .B \fB--header\fP=x, \fB-H\fP x 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 .B \fB--user-agent\fP=x, \fB-U\fP x 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 .B \fB--help\fP, \fB-h\fP A brief summary of all the options. .TP .B \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 successful, 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 This will use the Belgian, Dutch, English and German kernel.org mirrors to download a Linux 2.4.17 kernel image. .PP .nf .fam C axel ftp://ftp.{be,nl,uk,de}.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 .fam T .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. .PP .nf .fam C axel -S4 ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 .fam T .fi .SH FILES .TP .B /etc/axelrc System-wide configuration file. .TP .B ~/.axelrc Personal configuration file .PP These files are not documented in a manpage, but the example file which comes with the program contains enough information. The position of the system-wide configuration file might be different. .SH COPYRIGHT Axel was originally written by Wilmer van der Gaast and other authors over time. Please, see the CREDITS file. .PP The current Axel homepage (since 2015) is https://github.com/eribertomota/\fBaxel\fP .SH HELP THIS PROJECT If you intent to help, please, read the README.to-contribute file. axel-2.5/man/axel.header000066400000000000000000000001151261551332100151630ustar00rootroot00000000000000.TH axel "1" "Nov 2015" "AXEL 2.5" "light command line download accelerator" axel-2.5/man/axel.txt000066400000000000000000000105431261551332100145600ustar00rootroot00000000000000NAME axel - light command line download accelerator SYNOPSIS axel [OPTIONS] url1 [url2] [url...] 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 does not have to concatenate all the downloaded parts. OPTIONS 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. Other options: --max-speed=x, -s x Specify a speed (bytes per second) to try to keep the average speed around this speed. This is useful if you do not want the program to suck up all of your bandwidth. --num-connections=x, -n x Specify an alternative number of connections. --output=x, -o x 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. --search[=x], -S[x] 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. --no-proxy, -N Do not use any proxy server to download the file. Not possible when a transparent proxy is active somewhere, of course. --verbose, -v Show more status messages. Use it more than once to see more details. --quiet, -q No output to stdout. --alternate, -a 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. --header=x, -H x 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. --user-agent=x, -U x 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. --help, -h A brief summary of all the options. --version, -V Get version information. 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. RETURN VALUE The program returns 0 when the download was successful, 1 if something really went wrong and 2 if the download was interrupted. If something else comes back, it must be a bug. EXAMPLES This will use the Belgian, Dutch, English and German kernel.org mirrors to download a Linux 2.4.17 kernel image. axel ftp://ftp.{be,nl,uk,de}.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 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. axel -S4 ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 FILES /etc/axelrc System-wide configuration file. ~/.axelrc Personal configuration file These files are not documented in a manpage, but the example file which comes with the program contains enough information. The position of the system-wide configuration file might be different. COPYRIGHT Axel was originally written by Wilmer van der Gaast and other authors over time. Please, see the CREDITS file. The current Axel homepage (since 2015) is https://github.com/eribertomota/axel HELP THIS PROJECT If you intent to help, please, read the README.to-contribute file. axel-2.5/man/genallman.sh000077500000000000000000000010651261551332100153620ustar00rootroot00000000000000#!/bin/bash # Generate several manpages at the same time. # Copyright (C) 2015 Joao Eriberto Mota Filho # v0.3, available at https://github.com/eribertomota/genallman # # Inside the Axel, this file is under GPL-2+ license. [ -f /usr/bin/txt2man ] || { echo "ERROR: txt2man not found."; exit; } for NAME in $(ls | grep header | cut -d'.' -f1) do LEVEL=$(cat $NAME.header | cut -d" " -f3 | tr -d '"') cat $NAME.header > $NAME.$LEVEL txt2man $NAME.txt | grep -v '^.TH ' >> $NAME.$LEVEL echo "Generated $NAME.$LEVEL." done axel-2.5/nl.po000066400000000000000000000166731261551332100132760ustar00rootroot00000000000000msgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-03-11 00:56+0900\n" "PO-Revision-Date: 2001-11-14 15:22+0200\n" "Last-Translator: Wilmer van der Gaast \n" "Language-Team: Dutch \n" "Language: nl\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 #, c-format msgid "File size: %lld bytes" msgstr "Bestandsgrootte: %illd 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 #, c-format msgid "State file found: %lld bytes downloaded, %lld to go." msgstr ".st bestand gevonden: %illd bytes gedownload, %lld 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 #, c-format msgid "%lld byte" msgstr "%lld byte" #: text.c:441 #, c-format msgid "%.1f Kilobyte" msgstr "%.1f Kilobytes" #: text.c:443 #, c-format msgid "%.1f Megabyte" msgstr "%.1f Megabytes" #: text.c:445 #, c-format msgid "%.1f Gigabyte" msgstr "%.1f Gigabytes" #: 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 #, 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 https://github.com/eribertomota/axel/issues 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" "" #: 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 https://github.com/eribertomota/axel/issues 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" "" #: text.c:578 #, c-format msgid "Axel version %s (%s)\n" msgstr "Axel versie %s (%s)\n" axel-2.5/ru.po000066400000000000000000000224061261551332100133020ustar00rootroot00000000000000msgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-03-11 00:56+0900\n" "PO-Revision-Date: 2009-04-02 00:05+0200\n" "Last-Translator: newhren \n" "Language-Team: Russian \n" "Language: ru\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 "%.1f Kilobyte" msgstr "%.1f килобайта(ов)" #: text.c:443 #, c-format msgid "%.1f Megabyte" msgstr "%.1f мегабайта(ов)" #: text.c:445 #, fuzzy, c-format msgid "%.1f Gigabyte" 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 #, 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 https://github.com/eribertomota/axel/issues 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" "" #: 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 https://github.com/eribertomota/axel/issues 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" "" #: text.c:578 #, c-format msgid "Axel version %s (%s)\n" msgstr "Axel, версия %s (%s)\n" axel-2.5/search.c000066400000000000000000000152701261551332100137260ustar00rootroot00000000000000 /********************************************************************\ * 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 *axel_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 = axel_strrstr( s1, "ai_family, gai_result->ai_socktype, gai_result->ai_protocol); if (sock_fd != -1) { if (gai_result->ai_family == AF_INET) { if (local_if && *local_if) { ret = bind(sock_fd, (struct sockaddr *) &local_addr, sizeof(local_addr)); if (ret == -1) { close(sock_fd); sock_fd = -1; gai_result = gai_result->ai_next; } } } if (sock_fd != -1) { ret = connect(sock_fd, gai_result->ai_addr, gai_result->ai_addrlen); if (ret == -1) { close(sock_fd); sock_fd = -1; gai_result = gai_result->ai_next; } } } } freeaddrinfo(gai_results); return sock_fd; } int get_if_ip( char *iface, char *ip ) { struct ifreq ifr; int fd = socket( PF_INET, SOCK_DGRAM, IPPROTO_IP ); memset( &ifr, 0, sizeof( struct ifreq ) ); strcpy( ifr.ifr_name, iface ); ifr.ifr_addr.sa_family = AF_INET; if( ioctl( fd, SIOCGIFADDR, &ifr ) == 0 ) { struct sockaddr_in *x = (struct sockaddr_in *) &ifr.ifr_addr; strcpy( ip, inet_ntoa( x->sin_addr ) ); return( 1 ); } else { return( 0 ); } } axel-2.5/tcp.h000066400000000000000000000023511261551332100132500ustar00rootroot00000000000000 /********************************************************************\ * 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.5/text.c000066400000000000000000000337271261551332100134540ustar00rootroot00000000000000 /********************************************************************\ * Axel -- A lighter download accelerator for Linux and other Unices. * * * * Copyright 2001 Wilmer van der Gaast * * Copyright 2015 Joao Eriberto Mota Filho * \********************************************************************/ /* 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 && access( string, F_OK ) != 0 ) { fprintf( stderr, _("No state file, cannot resume!\n") ); return( 1 ); } if( access( string, F_OK ) == 0 && access( fn, F_OK ) != 0 ) { printf( _("State file found, but no downloaded data. Starting from scratch.\n" ) ); unlink( string ); } 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 < 1024 ) sprintf( string, _("%lld byte"), value ); else if( value < 1024 * 1024 ) sprintf( string, _("%.1f Kilobyte"), (float) value / 1024 ); else if( value < 1024 * 1024 * 1024 ) sprintf( string, _("%.1f Megabyte"), (float) value / (1024 * 1024) ); else sprintf( string, _("%.1f Gigabyte"), (float) value / (1024 * 1024 * 1024) ); return( string ); } /* 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 minute(s)"), value / 60, value % 60 ); else sprintf( string, _("%i:%02i:%02i hour(s)"), 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 https://github.com/eribertomota/axel/issues\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 https://github.com/eribertomota/axel/issues to report bugs\n") ); #endif } void print_version() { printf( _("\nAxel version %s (%s)\n"), AXEL_VERSION_STRING, ARCH ); printf( "\nCopyright 2001-2007 Wilmer van der Gaast," ); printf( "\n 2015 Joao Eriberto Mota Filho," ); printf( "\n and others." ); printf ("\nPlease, see the CREDITS file.\n\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.5/zh_CN.po000066400000000000000000000170351261551332100136570ustar00rootroot00000000000000msgid "" msgstr "" "Project-Id-Version: Axel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-03-11 00:56+0900\n" "PO-Revision-Date: 2008-11-08 22:40+0700\n" "Last-Translator: Shuge Lee \n" "Language-Team: Simplified Chinese \n" "Language: \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 #, 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 "" "糟糕的文件系统或操作系统……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 #, c-format msgid "%lld byte" msgstr "%lld 字节" #: text.c:441 #, c-format msgid "%.1f Kilobyte" msgstr "%.1f 千字节" #: text.c:443 #, fuzzy, c-format msgid "%.1f Megabyte" msgstr "%.1f 兆字节" #: text.c:445 #, fuzzy, c-format msgid "%.1f Gigabyte" 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 #, 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 https://github.com/eribertomota/axel/issues 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" "" "" #: 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 https://github.com/eribertomota/axel/issues 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" "" "" #: text.c:578 #, c-format msgid "Axel version %s (%s)\n" msgstr "Axel 版本 %s (%s)\n"