version_usage.cc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2006 Tatsuhiro Tsujikawa
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of portions of this program with the
  23. * OpenSSL library under certain conditions as described in each
  24. * individual source file, and distribute linked combinations
  25. * including the two.
  26. * You must obey the GNU General Public License in all respects
  27. * for all of the code used other than OpenSSL. If you modify
  28. * file(s) with this exception, you may extend this exception to your
  29. * version of the file(s), but you are not obligated to do so. If you
  30. * do not wish to do so, delete this exception statement from your
  31. * version. If you delete this exception statement from all source
  32. * files in the program, then also delete it here.
  33. */
  34. /* copyright --> */
  35. #include "common.h"
  36. #include "FeatureConfig.h"
  37. #include "messageDigest.h"
  38. void showVersion() {
  39. cout << PACKAGE << _(" version ") << PACKAGE_VERSION << endl;
  40. cout << "**Configuration**" << endl;
  41. cout << FeatureConfig::getInstance()->getConfigurationSummary();
  42. #ifdef ENABLE_MESSAGE_DIGEST
  43. cout << "message digest algorithms: " << MessageDigestContext::getSupportedAlgoString() << endl;
  44. #endif // ENABLE_MESSAGE_DIGEST
  45. cout << endl;
  46. cout << "Copyright (C) 2006, 2007 Tatsuhiro Tsujikawa" << endl;
  47. cout << endl;
  48. cout <<
  49. _("This program is free software; you can redistribute it and/or modify\n"
  50. "it under the terms of the GNU General Public License as published by\n"
  51. "the Free Software Foundation; either version 2 of the License, or\n"
  52. "(at your option) any later version.\n"
  53. "\n"
  54. "This program is distributed in the hope that it will be useful,\n"
  55. "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
  56. "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
  57. "GNU General Public License for more details.\n"
  58. "\n"
  59. "You should have received a copy of the GNU General Public License\n"
  60. "along with this program; if not, write to the Free Software\n"
  61. "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n");
  62. cout << endl;
  63. cout << _("Contact Info:") << endl;
  64. cout << "Tatsuhiro Tsujikawa <tujikawa at users dot sourceforge dot net>" << endl;
  65. cout << endl;
  66. }
  67. void showUsage() {
  68. printf(_("Usage: %s [options] URL ...\n"), PACKAGE_NAME);
  69. #ifdef ENABLE_BITTORRENT
  70. printf(_(" %s [options] -T TORRENT_FILE URL ...\n"), PACKAGE_NAME);
  71. #endif // ENABLE_BITTORRENT
  72. #ifdef ENABLE_METALINK
  73. printf(_(" %s [options] -M METALINK_FILE\n"), PACKAGE_NAME);
  74. #endif // ENABLE_METALINK
  75. cout << endl;
  76. cout << _("Options:") << endl;
  77. cout << _(" -d, --dir=DIR The directory to store the downloaded file.") << endl;
  78. cout << _(" -o, --out=FILE The file name of the downloaded file.") << endl;
  79. cout << _(" -l, --log=LOG The file name of the log file. If '-' is\n"
  80. " specified, log is written to stdout.") << endl;
  81. #ifdef HAVE_DAEMON
  82. cout << _(" -D, --daemon Run as daemon.") << endl;
  83. #endif // HAVE_DAEMON
  84. cout << _(" -s, --split=N Download a file using N connections. N must be\n"
  85. " between 1 and 5. This option affects all URLs.\n"
  86. " Thus, aria2 connects to each URL with\n"
  87. " N connections.\n"
  88. " Default: 1") << endl;
  89. cout << _(" --retry-wait=SEC Set the seconds to wait to retry after an error\n"
  90. " has occured. Specify a value between 0 and 60.\n"
  91. " Default: 5") << endl;
  92. cout << _(" -t, --timeout=SEC Set timeout in seconds. Default: 60") << endl;
  93. cout << _(" -m, --max-tries=N Set number of tries. 0 means unlimited.\n"
  94. " Default: 5") << endl;
  95. /*
  96. cout << _(" --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
  97. " K or M(1K = 1024, 1M = 1024K). This\n"
  98. " value must be greater than or equal to\n"
  99. " 1024. Default: 1M") << endl;
  100. */
  101. cout << _(" --http-proxy=HOST:PORT Use HTTP proxy server. This affects all URLs.") << endl;
  102. cout << _(" --http-user=USER Set HTTP user. This affects all URLs.") << endl;
  103. cout << _(" --http-passwd=PASSWD Set HTTP password. This affects all URLs.") << endl;
  104. cout << _(" --http-proxy-user=USER Set HTTP proxy user. This affects all URLs.") << endl;
  105. cout << _(" --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects all URLs.") << endl;
  106. cout << _(" --http-proxy-method=METHOD Set the method to use in proxy request.\n"
  107. " METHOD is either 'get' or 'tunnel'.\n"
  108. " Default: tunnel") << endl;
  109. cout << _(" --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, basic\n"
  110. " is the only supported scheme.\n"
  111. " Default: basic") << endl;
  112. cout << _(" --referer=REFERER Set Referer. This affects all URLs.") << endl;
  113. cout << _(" --ftp-user=USER Set FTP user. This affects all URLs.\n"
  114. " Default: anonymous") << endl;
  115. cout << _(" --ftp-passwd=PASSWD Set FTP password. This affects all URLs.\n"
  116. " Default: ARIA2USER@") << endl;
  117. cout << _(" --ftp-type=TYPE Set FTP transfer type. TYPE is either 'binary'\n"
  118. " or 'ascii'.\n"
  119. " Default: binary") << endl;
  120. cout << _(" -p, --ftp-pasv Use passive mode in FTP.") << endl;
  121. cout << _(" --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' or\n"
  122. " 'tunnel'.\n"
  123. " Default: tunnel") << endl;
  124. cout << _(" --lowest-speed-limit=SPEED Close connection if download speed is lower than\n"
  125. " or equal to this value(bytes per sec).\n"
  126. " 0 means aria2 does not have a lowest speed limit.\n"
  127. " You can append K or M(1K = 1024, 1M = 1024K).\n"
  128. " This option does not affect BitTorrent downloads.\n"
  129. " Default: 0") << endl;
  130. cout << _(" --max-download-limit=SPEED Set max download speed in bytes per sec.\n"
  131. " 0 means unrestricted.\n"
  132. " You can append K or M(1K = 1024, 1M = 1024K).\n"
  133. " Default: 0") << endl;
  134. cout << _(" --file-allocation=METHOD Specify file allocation method. METHOD is either\n"
  135. " 'none' or 'prealloc'. 'none' doesn't pre-allocate\n"
  136. " file space. 'prealloc' pre-allocates file space\n"
  137. " before download begins. This may take some time\n"
  138. " depending on the size of the file.\n"
  139. " Default: prealloc") << endl;
  140. cout << _(" --no-file-allocation-limit=SIZE No file allocation is made for files whose\n"
  141. " size is smaller than SIZE.\n"
  142. " You can append K or M(1K = 1024, 1M = 1024K).\n"
  143. " BitTorrent downloads ignore this option.\n"
  144. " Default: 5M") << endl;
  145. cout << _(" --allow-overwrite=true|false If false, aria2 doesn't download a file which\n"
  146. " already exists but the corresponding .aria2 file\n"
  147. " doesn't exist.\n"
  148. " Default: false") << endl;
  149. cout << _(" -Z, --force-sequential[=true|false] Fetch URIs in the command-line sequentially\n"
  150. " and download each URI in a separate session, like\n"
  151. " the usual command-line download utilities.\n"
  152. " Default: false") << endl;
  153. cout << _(" --auto-file-renaming[=true|false] Rename file name if the same file already\n"
  154. " exists. This option works only in http(s)/ftp\n"
  155. " download.\n"
  156. " The new file name has a dot and a number(1..9999)\n"
  157. " appended.\n"
  158. " Default: true") << endl;
  159. cout << _(" -P, --parameterized-uri[=true|false] Enable parameterized URI support.\n"
  160. " You can specify set of parts:\n"
  161. " http://{sv1,sv2,sv3}/foo.iso\n"
  162. " Also you can specify numeric sequences with step\n"
  163. " counter:\n"
  164. " http://host/image[000-100:2].img\n"
  165. " A step counter can be omitted.\n"
  166. " If all URIs do not point to the same file, such\n"
  167. " as the second example above, -Z option is\n"
  168. " required.\n"
  169. " Default: false") << endl;
  170. cout << _(" --enable-http-keep-alive[=true|false] Enable HTTP/1.1 persistant connection.\n"
  171. " Default: false") << endl;
  172. cout << _(" --enable-http-pipelining[=true|false] Enable HTTP/1.1 pipelining.\n"
  173. " Default: false") << endl;
  174. #ifdef ENABLE_MESSAGE_DIGEST
  175. cout << _(" --check-integrity=true|false Check file integrity by validating piece hash.\n"
  176. " This option only affects in BitTorrent downloads\n"
  177. " and Metalink downloads with chunk checksums.\n"
  178. " Use this option to re-download a damaged portion\n"
  179. " of a file.\n"
  180. " You may need to specify --allow-overwrite=true\n"
  181. " if the .aria2 file doesn't exist.\n"
  182. " Default: false") << endl;
  183. cout << _(" --realtime-chunk-checksum=true|false Validate chunk checksum while\n"
  184. " downloading a file in Metalink mode. This option\n"
  185. " on affects Metalink mode with chunk checksums.\n"
  186. " Default: true") << endl;
  187. #endif // ENABLE_MESSAGE_DIGEST
  188. cout << _(" -c, --continue Continue downloading a partially downloaded\n"
  189. " file. Use this option to resume a download\n"
  190. " started by a web browser or another program\n"
  191. " which downloads files sequentially from the\n"
  192. " beginning. Currently this option is only\n"
  193. " applicable to http(s)/ftp downloads.") << endl;
  194. cout << _(" -U, --user-agent=USER_AGENT Set user agent for http(s) downloads.") << endl;
  195. cout << _(" -n, --no-netrc Disables netrc support.") << endl;
  196. cout << _(" -i, --input-file=FILE Downloads URIs found in FILE. You can specify\n"
  197. " multiple URIs for a single entity: separate\n"
  198. " URIs on a single line using the TAB character.\n"
  199. " Reads input from stdin when '-' is specified.") << endl;
  200. cout << _(" -j, --max-concurrent-downloads=N Set maximum number of concurrent downloads.\n"
  201. " It should be used with the -i option.\n"
  202. " Default: 5") << endl;
  203. cout << _(" --load-cookies=FILE Load cookies from FILE. The format of FILE is\n"
  204. " the same used by Netscape and Mozilla.") << endl;
  205. #if defined ENABLE_BITTORRENT || ENABLE_METALINK
  206. cout << _(" -S, --show-files Print file listing of .torrent or .metalink file\n"
  207. " and exit.") << endl;
  208. cout << _(" --select-file=INDEX... Set file to download by specifing its index.\n"
  209. " You can find the file index using the\n"
  210. " --show-files option. Multiple indexes can be\n"
  211. " specified by using ',', for example: \"3,6\".\n"
  212. " You can also use '-' to specify a range: \"1-5\".\n"
  213. " ',' and '-' can be used together.\n"
  214. " When used with the -M option, index may vary\n"
  215. " depending on the query(see --metalink-* options).") << endl;
  216. #endif // ENABLE_BITTORRENT || ENABLE_METALINK
  217. #ifdef ENABLE_BITTORRENT
  218. cout << _(" -T, --torrent-file=TORRENT_FILE The path to the .torrent file.") << endl;
  219. cout << _(" --follow-torrent=true|false Set to false to prevent aria2 from\n"
  220. " entering BitTorrent mode even if the filename of\n"
  221. " the downloaded file ends with .torrent.\n"
  222. " Default: true") << endl;
  223. cout << _(" --direct-file-mapping=true|false Directly read from and write to each file\n"
  224. " mentioned in .torrent file.\n"
  225. " Default: true") << endl;
  226. cout << _(" --listen-port=PORT Set TCP port number for BitTorrent downloads.\n"
  227. " Default: 6881-6999") << endl;
  228. cout << _(" --max-upload-limit=SPEED Set max upload speed in bytes per sec.\n"
  229. " 0 means unrestricted.\n"
  230. " You can append K or M(1K = 1024, 1M = 1024K).\n"
  231. " Default: 0") << endl;
  232. cout << _(" --seed-time=MINUTES Specify seeding time in minutes. Also see the\n"
  233. " --seed-ratio option.") << endl;
  234. cout << _(" --seed-ratio=RATIO Specify share ratio. Seed completed torrents\n"
  235. " until share ratio reaches RATIO. 1.0 is\n"
  236. " encouraged. If --seed-time option is specified\n"
  237. " along with this option, seeding ends when at\n"
  238. " least one of the conditions is satisfied.") << endl;
  239. cout << _(" --peer-id-prefix=PEERI_ID_PREFIX Specify the prefix of peer ID. The peer ID in\n"
  240. " in BitTorrent is 20 byte length. If more than 20\n"
  241. " bytes are specified, only first 20\n"
  242. " bytes are used. If less than 20 bytes are\n"
  243. " specified, the random alphabet characters are\n"
  244. " added to make it's length 20 bytes.\n"
  245. " Default: -aria2-") << endl;
  246. #endif // ENABLE_BITTORRENT
  247. #ifdef ENABLE_METALINK
  248. cout << _(" -M, --metalink-file=METALINK_FILE The file path to the .metalink file.") << endl;
  249. cout << _(" -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n"
  250. " simultaneously.\n"
  251. " Default: 5") << endl;
  252. cout << _(" --metalink-version=VERSION The version of the file to download.") << endl;
  253. cout << _(" --metalink-language=LANGUAGE The language of the file to download.") << endl;
  254. cout << _(" --metalink-os=OS The operating system of the file to download.") << endl;
  255. cout << _(" --metalink-location=LOCATION The location of the prefered server.") << endl;
  256. cout << _(" --follow-metalink=true|false Set to false to prevent aria2 from\n"
  257. " entering Metalink mode even if the filename of\n"
  258. " the downloaded file ends with .metalink.\n"
  259. " Default: true") << endl;
  260. #endif // ENABLE_METALINK
  261. cout << _(" -v, --version Print the version number and exit.") << endl;
  262. cout << _(" -h, --help Print this message and exit.") << endl;
  263. cout << endl;
  264. cout << "URL:" << endl;
  265. cout << _(" You can specify multiple URLs. All URLs must point to the same file\n"
  266. " or downloading will fail.") << endl;
  267. cout << endl;
  268. cout << _("Examples:") << endl;
  269. cout << _(" Download a file using 1 connection:") << endl;
  270. cout << " aria2c http://AAA.BBB.CCC/file.zip" << endl;
  271. cout << _(" Download a file using 2 connections:") << endl;
  272. cout << " aria2c -s 2 http://AAA.BBB.CCC/file.zip" << endl;
  273. cout << _(" Download a file using 2 connections, each connects to a different server:") << endl;
  274. cout << " aria2c http://AAA.BBB.CCC/file.zip http://DDD.EEE.FFF/GGG/file.zip" << endl;
  275. cout << _(" You can mix up different protocols:") << endl;
  276. cout << " aria2c http://AAA.BBB.CCC/file.zip ftp://DDD.EEE.FFF/GGG/file.zip" << endl;
  277. cout << _(" Parameterized URI:") << endl;
  278. cout << " aria2c -P http://{server1,server2,server3}/file.iso" << endl;
  279. cout << _(" Parameterized URI. -Z option is required in this case:") << endl;
  280. cout << " aria2c -P -Z http://host/file[001-100:2].img" << endl;
  281. #ifdef ENABLE_BITTORRENT
  282. cout << endl;
  283. cout << _(" Download a torrent:") << endl;
  284. cout << " aria2c -o test.torrent http://AAA.BBB.CCC/file.torrent" << endl;
  285. cout << _(" Download a torrent using a local .torrent file:") << endl;
  286. cout << " aria2c -T test.torrent" << endl;
  287. cout << _(" Download only selected files:") << endl;
  288. cout << " aria2c -T test.torrent dir/file1.zip dir/file2.zip" << endl;
  289. cout << _(" Print file listing of .torrent file:") << endl;
  290. cout << " aria2c -T test.torrent -S" << endl;
  291. #endif // ENABLE_BITTORRENT
  292. #ifdef ENABLE_METALINK
  293. cout << endl;
  294. cout << _(" Metalink downloading:") << endl;
  295. cout << " aria2c http://AAA.BBB.CCC/file.metalink" << endl;
  296. cout << _(" Download a file using local .metalink file:") << endl;
  297. cout << " aria2c -M test.metalink" << endl;
  298. cout << _(" Metalink downloading with preferences:") << endl;
  299. cout << " aria2c -M test.metalink --metalink-version=1.1.1 --metalink-language=en-US" << endl;
  300. cout << _(" Download only selected files:") << endl;
  301. cout << " aria2c -M test.metalink --metalink-language=en-US dir/file1.zip dir/file2.zip" << endl;
  302. cout << _(" Download only selected files using index:") << endl;
  303. cout << " aria2c -M test.metalink --metalink-language=en-US --select-file 1,3-5" << endl;
  304. cout << _(" Print file listing of .metalink file:") << endl;
  305. cout << " aria2c -M test.metalink -S --metalink-language=en-US" << endl;
  306. #endif // ENABLE_METALINK
  307. cout << endl;
  308. printf(_("Report bugs to %s"), "<tujikawa at users dot sourceforge dot net>");
  309. cout << endl;
  310. }