version_usage.cc 21 KB

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