📄 main.c
字号:
longopt->has_arg = optional_argument; /* For Boolean options, add the "--no-FOO" variant, which is identical to "--foo", except it has opposite meaning and it doesn't allow an argument. */ longopt = &long_options[o++]; longopt->name = no_prefix (opt->long_name); longopt->has_arg = no_argument; /* Mask the value so we'll be able to recognize that we're dealing with the false value. */ longopt->val = i | BOOLEAN_NEG_MARKER; break; default: assert (opt->argtype != -1); longopt->has_arg = opt->argtype; if (opt->short_name) { if (longopt->has_arg == required_argument) *p++ = ':'; /* Don't handle optional_argument */ } } } /* Terminate short_options. */ *p = '\0'; /* No need for xzero(long_options[o]) because its storage is static and it will be zeroed by default. */ assert (o <= countof (long_options));}/* Print the usage message. */static voidprint_usage (void){ printf (_("Usage: %s [OPTION]... [URL]...\n"), exec_name);}/* Print the help message, describing all the available options. If you add an option, be sure to update this list. */static voidprint_help (void){ /* We split the help text this way to ease translation of individual entries. */ static const char *help[] = { "\n", N_("\Mandatory arguments to long options are mandatory for short options too.\n\n"), N_("\Startup:\n"), N_("\ -V, --version display the version of Wget and exit.\n"), N_("\ -h, --help print this help.\n"), N_("\ -b, --background go to background after startup.\n"), N_("\ -e, --execute=COMMAND execute a `.wgetrc'-style command.\n"), "\n", N_("\Logging and input file:\n"), N_("\ -o, --output-file=FILE log messages to FILE.\n"), N_("\ -a, --append-output=FILE append messages to FILE.\n"),#ifdef ENABLE_DEBUG N_("\ -d, --debug print lots of debugging information.\n"),#endif N_("\ -q, --quiet quiet (no output).\n"), N_("\ -v, --verbose be verbose (this is the default).\n"), N_("\ -nv, --no-verbose turn off verboseness, without being quiet.\n"), N_("\ -i, --input-file=FILE download URLs found in FILE.\n"), N_("\ -F, --force-html treat input file as HTML.\n"), N_("\ -B, --base=URL prepends URL to relative links in -F -i file.\n"), "\n", N_("\Download:\n"), N_("\ -t, --tries=NUMBER set number of retries to NUMBER (0 unlimits).\n"), N_("\ --retry-connrefused retry even if connection is refused.\n"), N_("\ -O, --output-document=FILE write documents to FILE.\n"), N_("\ -nc, --no-clobber skip downloads that would download to\n\ existing files.\n"), N_("\ -c, --continue resume getting a partially-downloaded file.\n"), N_("\ --progress=TYPE select progress gauge type.\n"), N_("\ -N, --timestamping don't re-retrieve files unless newer than\n\ local.\n"), N_("\ -S, --server-response print server response.\n"), N_("\ --spider don't download anything.\n"), N_("\ -T, --timeout=SECONDS set all timeout values to SECONDS.\n"), N_("\ --dns-timeout=SECS set the DNS lookup timeout to SECS.\n"), N_("\ --connect-timeout=SECS set the connect timeout to SECS.\n"), N_("\ --read-timeout=SECS set the read timeout to SECS.\n"), N_("\ -w, --wait=SECONDS wait SECONDS between retrievals.\n"), N_("\ --waitretry=SECONDS wait 1..SECONDS between retries of a retrieval.\n"), N_("\ --random-wait wait from 0...2*WAIT secs between retrievals.\n"), N_("\ -Y, --proxy explicitly turn on proxy.\n"), N_("\ --no-proxy explicitly turn off proxy.\n"), N_("\ -Q, --quota=NUMBER set retrieval quota to NUMBER.\n"), N_("\ --bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host.\n"), N_("\ --limit-rate=RATE limit download rate to RATE.\n"), N_("\ --no-dns-cache disable caching DNS lookups.\n"), N_("\ --restrict-file-names=OS restrict chars in file names to ones OS allows.\n"),#ifdef ENABLE_IPV6 N_("\ -4, --inet4-only connect only to IPv4 addresses.\n"), N_("\ -6, --inet6-only connect only to IPv6 addresses.\n"), N_("\ --prefer-family=FAMILY connect first to addresses of specified family,\n\ one of IPv6, IPv4, or none.\n"),#endif N_("\ --user=USER set both ftp and http user to USER.\n"), N_("\ --password=PASS set both ftp and http password to PASS.\n"), "\n", N_("\Directories:\n"), N_("\ -nd, --no-directories don't create directories.\n"), N_("\ -x, --force-directories force creation of directories.\n"), N_("\ -nH, --no-host-directories don't create host directories.\n"), N_("\ --protocol-directories use protocol name in directories.\n"), N_("\ -P, --directory-prefix=PREFIX save files to PREFIX/...\n"), N_("\ --cut-dirs=NUMBER ignore NUMBER remote directory components.\n"), "\n", N_("\HTTP options:\n"), N_("\ --http-user=USER set http user to USER.\n"), N_("\ --http-password=PASS set http password to PASS.\n"), N_("\ --no-cache disallow server-cached data.\n"), N_("\ -E, --html-extension save HTML documents with `.html' extension.\n"), N_("\ --ignore-length ignore `Content-Length' header field.\n"), N_("\ --header=STRING insert STRING among the headers.\n"), N_("\ --proxy-user=USER set USER as proxy username.\n"), N_("\ --proxy-password=PASS set PASS as proxy password.\n"), N_("\ --referer=URL include `Referer: URL' header in HTTP request.\n"), N_("\ --save-headers save the HTTP headers to file.\n"), N_("\ -U, --user-agent=AGENT identify as AGENT instead of Wget/VERSION.\n"), N_("\ --no-http-keep-alive disable HTTP keep-alive (persistent connections).\n"), N_("\ --no-cookies don't use cookies.\n"), N_("\ --load-cookies=FILE load cookies from FILE before session.\n"), N_("\ --save-cookies=FILE save cookies to FILE after session.\n"), N_("\ --keep-session-cookies load and save session (non-permanent) cookies.\n"), N_("\ --post-data=STRING use the POST method; send STRING as the data.\n"), N_("\ --post-file=FILE use the POST method; send contents of FILE.\n"), "\n",#ifdef HAVE_SSL N_("\HTTPS (SSL/TLS) options:\n"), N_("\ --secure-protocol=PR choose secure protocol, one of auto, SSLv2,\n\ SSLv3, and TLSv1.\n"), N_("\ --no-check-certificate don't validate the server's certificate.\n"), N_("\ --certificate=FILE client certificate file.\n"), N_("\ --certificate-type=TYPE client certificate type, PEM or DER.\n"), N_("\ --private-key=FILE private key file.\n"), N_("\ --private-key-type=TYPE private key type, PEM or DER.\n"), N_("\ --ca-certificate=FILE file with the bundle of CA's.\n"), N_("\ --ca-directory=DIR directory where hash list of CA's is stored.\n"), N_("\ --random-file=FILE file with random data for seeding the SSL PRNG.\n"), N_("\ --egd-file=FILE file naming the EGD socket with random data.\n"), "\n",#endif /* HAVE_SSL */ N_("\FTP options:\n"), N_("\ --ftp-user=USER set ftp user to USER.\n"), N_("\ --ftp-password=PASS set ftp password to PASS.\n"), N_("\ --no-remove-listing don't remove `.listing' files.\n"), N_("\ --no-glob turn off FTP file name globbing.\n"), N_("\ --no-passive-ftp disable the \"passive\" transfer mode.\n"), N_("\ --retr-symlinks when recursing, get linked-to files (not dir).\n"), N_("\ --preserve-permissions preserve remote file permissions.\n"), "\n", N_("\Recursive download:\n"), N_("\ -r, --recursive specify recursive download.\n"), N_("\ -l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).\n"), N_("\ --delete-after delete files locally after downloading them.\n"), N_("\ -k, --convert-links make links in downloaded HTML point to local files.\n"), N_("\ -K, --backup-converted before converting file X, back up as X.orig.\n"), N_("\ -m, --mirror shortcut for -N -r -l inf --no-remove-listing.\n"), N_("\ -p, --page-requisites get all images, etc. needed to display HTML page.\n"), N_("\ --strict-comments turn on strict (SGML) handling of HTML comments.\n"), "\n", N_("\Recursive accept/reject:\n"), N_("\ -A, --accept=LIST comma-separated list of accepted extensions.\n"), N_("\ -R, --reject=LIST comma-separated list of rejected extensions.\n"), N_("\ -D, --domains=LIST comma-separated list of accepted domains.\n"), N_("\ --exclude-domains=LIST comma-separated list of rejected domains.\n"), N_("\ --follow-ftp follow FTP links from HTML documents.\n"), N_("\ --follow-tags=LIST comma-separated list of followed HTML tags.\n"), N_("\ --ignore-tags=LIST comma-separated list of ignored HTML tags.\n"), N_("\ -H, --span-hosts go to foreign hosts when recursive.\n"), N_("\ -L, --relative follow relative links only.\n"), N_("\ -I, --include-directories=LIST list of allowed directories.\n"), N_("\ -X, --exclude-directories=LIST list of excluded directories.\n"), N_("\ -np, --no-parent don't ascend to the parent directory.\n"), "\n", N_("Mail bug reports and suggestions to <bug-wget@gnu.org>.\n") }; int i; printf (_("GNU Wget %s, a non-interactive network retriever.\n"), version_string); print_usage (); for (i = 0; i < countof (help); i++) fputs (_(help[i]), stdout); exit (0);}static voidprint_version (void){ printf ("GNU Wget %s\n\n", version_string); fputs (_("\Copyright (C) 2005 Free Software Foundation, Inc.\n"), stdout); fputs (_("\This program is distributed in the hope that it will be useful,\n\but WITHOUT ANY WARRANTY; without even the implied warranty of\n\MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\GNU General Public License for more details.\n"), stdout); fputs (_("\nOriginally written by Hrvoje Niksic <hniksic@xemacs.org>.\n"), stdout); exit (0);}intmain (int argc, char *const *argv){ char **url, **t; int i, ret, longindex; int nurl, status; int append_to_log = 0; i18n_initialize (); /* Construct the name of the executable, without the directory part. */ exec_name = strrchr (argv[0], PATH_SEPARATOR); if (!exec_name)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -