浏览代码

2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Use constants defined in prefs.h
	* src/option_processing.cc
Tatsuhiro Tsujikawa 17 年之前
父节点
当前提交
a8eeb81883
共有 2 个文件被更改,包括 69 次插入64 次删除
  1. 5 0
      ChangeLog
  2. 64 64
      src/option_processing.cc

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2008-02-21  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Use constants defined in prefs.h
+	* src/option_processing.cc
+
 2008-02-21  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	* test/AllTest.cc: Added OpenSSL, GNUTLS initialization code.

+ 64 - 64
src/option_processing.cc

@@ -153,49 +153,49 @@ Option* option_processing(int argc, char* const argv[])
     int lopt;
     static struct option longOpts[] = {
 #ifdef HAVE_DAEMON
-      { "daemon", no_argument, NULL, 'D' },
+      { PREF_DAEMON, no_argument, NULL, 'D' },
 #endif // HAVE_DAEMON
-      { "dir", required_argument, NULL, 'd' },
-      { "out", required_argument, NULL, 'o' },
-      { "log", required_argument, NULL, 'l' },
-      { "split", required_argument, NULL, 's' },
-      { "timeout", required_argument, NULL, 't' },
-      { "max-tries", required_argument, NULL, 'm' },
-      { "http-proxy", required_argument, &lopt, 1 },
-      { "http-user", required_argument, &lopt, 2 },
-      { "http-passwd", required_argument, &lopt, 3 },
-      { "http-proxy-user", required_argument, &lopt, 4 },
-      { "http-proxy-passwd", required_argument, &lopt, 5 },
-      { "http-auth-scheme", required_argument, &lopt, 6 },
-      { "referer", required_argument, &lopt, 7 },
-      { "retry-wait", required_argument, &lopt, 8 },
-      { "ftp-user", required_argument, &lopt, 9 },
-      { "ftp-passwd", required_argument, &lopt, 10 },
-      { "ftp-type", required_argument, &lopt, 11 },
-      { "ftp-pasv", no_argument, NULL, 'p' },
-      { "ftp-via-http-proxy", required_argument, &lopt, 12 },
-      //{ "min-segment-size", required_argument, &lopt, 13 },
-      { "http-proxy-method", required_argument, &lopt, 14 },
-      { "lowest-speed-limit", required_argument, &lopt, 200 },
-      { "max-download-limit", required_argument, &lopt, 201 },
-      { "file-allocation", required_argument, 0, 'a' },
-      { "allow-overwrite", required_argument, &lopt, 202 },
+      { PREF_DIR, required_argument, NULL, 'd' },
+      { PREF_OUT, required_argument, NULL, 'o' },
+      { PREF_LOG, required_argument, NULL, 'l' },
+      { PREF_SPLIT, required_argument, NULL, 's' },
+      { PREF_TIMEOUT, required_argument, NULL, 't' },
+      { PREF_MAX_TRIES, required_argument, NULL, 'm' },
+      { PREF_HTTP_PROXY, required_argument, &lopt, 1 },
+      { PREF_HTTP_USER, required_argument, &lopt, 2 },
+      { PREF_HTTP_PASSWD, required_argument, &lopt, 3 },
+      { PREF_HTTP_PROXY_USER, required_argument, &lopt, 4 },
+      { PREF_HTTP_PROXY_PASSWD, required_argument, &lopt, 5 },
+      { PREF_HTTP_AUTH_SCHEME, required_argument, &lopt, 6 },
+      { PREF_REFERER, required_argument, &lopt, 7 },
+      { PREF_RETRY_WAIT, required_argument, &lopt, 8 },
+      { PREF_FTP_USER, required_argument, &lopt, 9 },
+      { PREF_FTP_PASSWD, required_argument, &lopt, 10 },
+      { PREF_FTP_TYPE, required_argument, &lopt, 11 },
+      { PREF_FTP_PASV, no_argument, NULL, 'p' },
+      { PREF_FTP_VIA_HTTP_PROXY, required_argument, &lopt, 12 },
+      //{ PREF_MIN_SEGMENT_SIZE, required_argument, &lopt, 13 },
+      { PREF_HTTP_PROXY_METHOD, required_argument, &lopt, 14 },
+      { PREF_LOWEST_SPEED_LIMIT, required_argument, &lopt, 200 },
+      { PREF_MAX_DOWNLOAD_LIMIT, required_argument, &lopt, 201 },
+      { PREF_FILE_ALLOCATION, required_argument, 0, 'a' },
+      { PREF_ALLOW_OVERWRITE, required_argument, &lopt, 202 },
 #ifdef ENABLE_MESSAGE_DIGEST
-      { "check-integrity", required_argument, &lopt, 203 },
-      { "realtime-chunk-checksum", required_argument, &lopt, 204 },
+      { PREF_CHECK_INTEGRITY, required_argument, &lopt, 203 },
+      { PREF_REALTIME_CHUNK_CHECKSUM, required_argument, &lopt, 204 },
 #endif // ENABLE_MESSAGE_DIGEST
-      { "continue", no_argument, 0, 'c' },
-      { "user-agent", required_argument, 0, 'U' },
-      { "no-netrc", no_argument, 0, 'n' },
-      { "input-file", required_argument, 0, 'i' },
-      { "max-concurrent-downloads", required_argument, 0, 'j' },
-      { "load-cookies", required_argument, &lopt, 205 },
-      { "force-sequential", optional_argument, 0, 'Z' },
-      { "auto-file-renaming", optional_argument, &lopt, 206 },
-      { "parameterized-uri", optional_argument, 0, 'P' },
-      { "enable-http-keep-alive", optional_argument, &lopt, 207 },
-      { "enable-http-pipelining", optional_argument, &lopt, 208 },
-      { "no-file-allocation-limit", required_argument, &lopt, 209 },
+      { PREF_CONTINUE, no_argument, 0, 'c' },
+      { PREF_USER_AGENT, required_argument, 0, 'U' },
+      { PREF_NO_NETRC, no_argument, 0, 'n' },
+      { PREF_INPUT_FILE, required_argument, 0, 'i' },
+      { PREF_MAX_CONCURRENT_DOWNLOADS, required_argument, 0, 'j' },
+      { PREF_LOAD_COOKIES, required_argument, &lopt, 205 },
+      { PREF_FORCE_SEQUENTIAL, optional_argument, 0, 'Z' },
+      { PREF_AUTO_FILE_RENAMING, optional_argument, &lopt, 206 },
+      { PREF_PARAMETERIZED_URI, optional_argument, 0, 'P' },
+      { PREF_ENABLE_HTTP_KEEP_ALIVE, optional_argument, &lopt, 207 },
+      { PREF_ENABLE_HTTP_PIPELINING, optional_argument, &lopt, 208 },
+      { PREF_NO_FILE_ALLOCATION_LIMIT, required_argument, &lopt, 209 },
 #ifdef ENABLE_DIRECT_IO
       { PREF_ENABLE_DIRECT_IO, optional_argument, &lopt, 210 },
 #endif // ENABLE_DIRECT_IO
@@ -204,38 +204,38 @@ Option* option_processing(int argc, char* const argv[])
       { PREF_CONF_PATH, required_argument, &lopt, 213 },
       { PREF_STOP, required_argument, &lopt, 214 },
 #if defined ENABLE_BITTORRENT || ENABLE_METALINK
-      { "show-files", no_argument, NULL, 'S' },
-      { "select-file", required_argument, &lopt, 21 },
+      { PREF_SHOW_FILES, no_argument, NULL, 'S' },
+      { PREF_SELECT_FILE, required_argument, &lopt, 21 },
 #endif // ENABLE_BITTORRENT || ENABLE_METALINK
 #ifdef ENABLE_BITTORRENT
-      { "torrent-file", required_argument, NULL, 'T' },
-      { "listen-port", required_argument, &lopt, 15 },
-      { "follow-torrent", required_argument, &lopt, 16 },
-      { "no-preallocation", no_argument, &lopt, 18 },
-      { "direct-file-mapping", required_argument, &lopt, 19 },
+      { PREF_TORRENT_FILE, required_argument, NULL, 'T' },
+      { PREF_LISTEN_PORT, required_argument, &lopt, 15 },
+      { PREF_FOLLOW_TORRENT, required_argument, &lopt, 16 },
+      { PREF_NO_PREALLOCATION, no_argument, &lopt, 18 },
+      { PREF_DIRECT_FILE_MAPPING, required_argument, &lopt, 19 },
       // TODO remove upload-limit.
       //{ "upload-limit", required_argument, &lopt, 20 },
-      { "seed-time", required_argument, &lopt, 22 },
-      { "seed-ratio", required_argument, &lopt, 23 },
-      { "max-upload-limit", required_argument, &lopt, 24 },
-      { "peer-id-prefix", required_argument, &lopt, 25 },
-      { "enable-peer-exchange", optional_argument, &lopt, 26 },
-      { "enable-dht", optional_argument, &lopt, 27 },
-      { "dht-listen-port", required_argument, &lopt, 28 },
-      { "dht-entry-point", required_argument, &lopt, 29 },
+      { PREF_SEED_TIME, required_argument, &lopt, 22 },
+      { PREF_SEED_RATIO, required_argument, &lopt, 23 },
+      { PREF_MAX_UPLOAD_LIMIT, required_argument, &lopt, 24 },
+      { PREF_PEER_ID_PREFIX, required_argument, &lopt, 25 },
+      { PREF_ENABLE_PEER_EXCHANGE, optional_argument, &lopt, 26 },
+      { PREF_ENABLE_DHT, optional_argument, &lopt, 27 },
+      { PREF_DHT_LISTEN_PORT, required_argument, &lopt, 28 },
+      { PREF_DHT_ENTRY_POINT, required_argument, &lopt, 29 },
       { PREF_BT_MIN_CRYPTO_LEVEL, required_argument, &lopt, 30 },
       { PREF_BT_REQUIRE_CRYPTO, required_argument, &lopt, 31 },
 #endif // ENABLE_BITTORRENT
 #ifdef ENABLE_METALINK
-      { "metalink-file", required_argument, NULL, 'M' },
-      { "metalink-servers", required_argument, NULL, 'C' },
-      { "metalink-version", required_argument, &lopt, 100 },
-      { "metalink-language", required_argument, &lopt, 101 },
-      { "metalink-os", required_argument, &lopt, 102 },
-      { "follow-metalink", required_argument, &lopt, 103 },
-      { "metalink-location", required_argument, &lopt, 104 },
-      { "metalink-preferred-protocol", required_argument, &lopt, 105 },
-      { "metalink-enable-unique-protocol", optional_argument, &lopt, 106 },
+      { PREF_METALINK_FILE, required_argument, NULL, 'M' },
+      { PREF_METALINK_SERVERS, required_argument, NULL, 'C' },
+      { PREF_METALINK_VERSION, required_argument, &lopt, 100 },
+      { PREF_METALINK_LANGUAGE, required_argument, &lopt, 101 },
+      { PREF_METALINK_OS, required_argument, &lopt, 102 },
+      { PREF_FOLLOW_METALINK, required_argument, &lopt, 103 },
+      { PREF_METALINK_LOCATION, required_argument, &lopt, 104 },
+      { PREF_METALINK_PREFERRED_PROTOCOL, required_argument, &lopt, 105 },
+      { PREF_METALINK_ENABLE_UNIQUE_PROTOCOL, optional_argument, &lopt, 106 },
 #endif // ENABLE_METALINK
       { "version", no_argument, NULL, 'v' },
       { "help", optional_argument, NULL, 'h' },