diff --git a/src/ChangeLog b/src/ChangeLog index c8c3de01..ceac5aaa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-05-30 Darshit Shah + + * connect.{c,h}, convert.{c,h}, cookies.{c,h}, ftp-ls.c, ftp.h, gettext.h, + hash.h, host.h, html-parse.h, html-url.h, http.c, init.c, main.c, mswindows.c, + netrc.h, openssl.c, options.h, ptimer.h, recur.c, retr.c, sysdep.h, url.h, + vms.c, warc.c, wget.h: Whitespace and formatting changes only. + 2014-05-20 Darshit Shah * utils.c (human_readable): Add new parameters, acc and decimals for the diff --git a/src/connect.c b/src/connect.c index bfb079b7..1e4a44ba 100644 --- a/src/connect.c +++ b/src/connect.c @@ -273,7 +273,7 @@ connect_to_ip (const ip_address *ip, int port, const char *print) const char *txt_addr = print_address (ip); if (0 != strcmp (print, txt_addr)) { - char *str = NULL, *name; + char *str = NULL, *name; if (opt.enable_iri && (name = idn_decode ((char *) print)) != NULL) { @@ -287,18 +287,18 @@ connect_to_ip (const ip_address *ip, int port, const char *print) logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "), str ? str : escnonprint_uri (print), txt_addr, port); - if (str) - xfree (str); + if (str) + xfree (str); } else - { + { if (ip->family == AF_INET) logprintf (LOG_VERBOSE, _("Connecting to %s:%d... "), txt_addr, port); #ifdef ENABLE_IPV6 else if (ip->family == AF_INET6) logprintf (LOG_VERBOSE, _("Connecting to [%s]:%d... "), txt_addr, port); #endif - } + } } /* Store the sockaddr info to SA. */ diff --git a/src/connect.h b/src/connect.h index bb3f26a7..3826aa41 100644 --- a/src/connect.h +++ b/src/connect.h @@ -32,7 +32,7 @@ as that of the covered work. */ #ifndef CONNECT_H #define CONNECT_H -#include "host.h" /* for definition of ip_address */ +#include "host.h" /* for definition of ip_address */ /* Function declarations */ diff --git a/src/convert.c b/src/convert.c index f5a9cba3..abad5db0 100644 --- a/src/convert.c +++ b/src/convert.c @@ -125,7 +125,7 @@ convert_links_in_hashtable (struct hash_table *downloaded_set, u = url_parse (cur_url->url->url, NULL, pi, true); if (!u) - continue; + continue; local_name = hash_table_get (dl_url_file_map, u->url); diff --git a/src/convert.h b/src/convert.h index cdd0a482..23c5f0e1 100644 --- a/src/convert.h +++ b/src/convert.h @@ -31,18 +31,18 @@ as that of the covered work. */ #ifndef CONVERT_H #define CONVERT_H -struct hash_table; /* forward decl */ +struct hash_table; /* forward decl */ extern struct hash_table *dl_url_file_map; extern struct hash_table *downloaded_html_set; extern struct hash_table *downloaded_css_set; enum convert_options { - CO_NOCONVERT = 0, /* don't convert this URL */ - CO_CONVERT_TO_RELATIVE, /* convert to relative, e.g. to + CO_NOCONVERT = 0, /* don't convert this URL */ + CO_CONVERT_TO_RELATIVE, /* convert to relative, e.g. to "../../otherdir/foo.gif" */ - CO_CONVERT_TO_COMPLETE, /* convert to absolute, e.g. to - "http://orighost/somedir/bar.jpg". */ - CO_NULLIFY_BASE /* change to empty string. */ + CO_CONVERT_TO_COMPLETE, /* convert to absolute, e.g. to + "http://orighost/somedir/bar.jpg". */ + CO_NULLIFY_BASE /* change to empty string. */ }; struct url; @@ -51,36 +51,36 @@ struct url; position in an HTML document, etc. */ struct urlpos { - struct url *url; /* the URL of the link, after it has - been merged with the base */ - char *local_name; /* local file to which it was saved - (used by convert_links) */ + struct url *url; /* the URL of the link, after it has + been merged with the base */ + char *local_name; /* local file to which it was saved + (used by convert_links) */ /* reserved for special links such as which are used when converting links, but ignored when downloading. */ - unsigned int ignore_when_downloading :1; + unsigned int ignore_when_downloading :1; /* Information about the original link: */ - unsigned int link_relative_p :1; /* the link was relative */ - unsigned int link_complete_p :1; /* the link was complete (had host name) */ - unsigned int link_base_p :1; /* the url came from */ - unsigned int link_inline_p :1; /* needed to render the page */ - unsigned int link_css_p :1; /* the url came from CSS */ - unsigned int link_expect_html :1; /* expected to contain HTML */ - unsigned int link_expect_css :1; /* expected to contain CSS */ + unsigned int link_relative_p :1; /* the link was relative */ + unsigned int link_complete_p :1; /* the link was complete (had host name) */ + unsigned int link_base_p :1; /* the url came from */ + unsigned int link_inline_p :1; /* needed to render the page */ + unsigned int link_css_p :1; /* the url came from CSS */ + unsigned int link_expect_html :1; /* expected to contain HTML */ + unsigned int link_expect_css :1; /* expected to contain CSS */ - unsigned int link_refresh_p :1; /* link was received from - */ - int refresh_timeout; /* for reconstructing the refresh. */ + unsigned int link_refresh_p :1; /* link was received from + */ + int refresh_timeout; /* for reconstructing the refresh. */ /* Conversion requirements: */ - enum convert_options convert; /* is conversion required? */ + enum convert_options convert; /* is conversion required? */ /* URL's position in the buffer. */ int pos, size; - struct urlpos *next; /* next list element */ + struct urlpos *next; /* next list element */ }; /* downloaded_file() takes a parameter of this type and returns this type. */ diff --git a/src/cookies.c b/src/cookies.c index 6ba7b5a5..7f5ba962 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -95,7 +95,7 @@ struct cookie { int port; /* port number */ char *path; /* path prefix of the cookie */ - unsigned discard_requested :1; /* whether cookie was created to + unsigned discard_requested :1;/* whether cookie was created to request discarding another cookie. */ @@ -393,7 +393,7 @@ parse_set_cookie (const char *set_cookie, bool silent) /* Check if expiration spec is valid. If not, assume default (cookie doesn't expire, but valid only for - this session.) */ + this session.) */ expires = http_atotm (value_copy); if (expires != (time_t) -1) { @@ -460,9 +460,9 @@ parse_set_cookie (const char *set_cookie, bool silent) #define REQUIRE_DIGITS(p) do { \ - if (!c_isdigit (*p)) \ + if (!c_isdigit (*p)) \ return false; \ - for (++p; c_isdigit (*p); p++) \ + for (++p; c_isdigit (*p); p++) \ ; \ } while (0) diff --git a/src/cookies.h b/src/cookies.h index af3602a7..b3b9b2c0 100644 --- a/src/cookies.h +++ b/src/cookies.h @@ -37,9 +37,9 @@ struct cookie_jar *cookie_jar_new (void); void cookie_jar_delete (struct cookie_jar *); void cookie_handle_set_cookie (struct cookie_jar *, const char *, int, - const char *, const char *); + const char *, const char *); char *cookie_header (struct cookie_jar *, const char *, int, - const char *, bool); + const char *, bool); void cookie_jar_load (struct cookie_jar *, const char *); void cookie_jar_save (struct cookie_jar *, const char *); diff --git a/src/ftp-ls.c b/src/ftp-ls.c index d9077a37..8ab8a378 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -106,7 +106,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms) size_t bufsize = 0; char *line = NULL, *tok, *ptok; /* tokenizer */ - struct fileinfo *dir, *l, cur; /* list creation */ + struct fileinfo *dir, *l, cur; /* list creation */ fp = fopen (file, "rb"); if (!fp) diff --git a/src/ftp.h b/src/ftp.h index 3b0fba59..78b5270c 100644 --- a/src/ftp.h +++ b/src/ftp.h @@ -106,49 +106,49 @@ enum parsetype /* Information about one filename in a linked list. */ struct fileinfo { - enum ftype type; /* file type */ - char *name; /* file name */ - wgint size; /* file size */ - long tstamp; /* time-stamp */ - enum parsetype ptype; /* time parsing */ - int perms; /* file permissions */ - char *linkto; /* link to which file points */ - struct fileinfo *prev; /* previous... */ - struct fileinfo *next; /* ...and next structure. */ + enum ftype type; /* file type */ + char *name; /* file name */ + wgint size; /* file size */ + long tstamp; /* time-stamp */ + enum parsetype ptype; /* time parsing */ + int perms; /* file permissions */ + char *linkto; /* link to which file points */ + struct fileinfo *prev; /* previous... */ + struct fileinfo *next; /* ...and next structure. */ }; /* Commands for FTP functions. */ enum wget_ftp_command { - DO_LOGIN = 0x0001, /* Connect and login to the server. */ - DO_CWD = 0x0002, /* Change current directory. */ - DO_RETR = 0x0004, /* Retrieve the file. */ - DO_LIST = 0x0008, /* Retrieve the directory list. */ - LEAVE_PENDING = 0x0010 /* Do not close the socket. */ + DO_LOGIN = 0x0001, /* Connect and login to the server. */ + DO_CWD = 0x0002, /* Change current directory. */ + DO_RETR = 0x0004, /* Retrieve the file. */ + DO_LIST = 0x0008, /* Retrieve the directory list. */ + LEAVE_PENDING = 0x0010 /* Do not close the socket. */ }; enum wget_ftp_fstatus { - NOTHING = 0x0000, /* Nothing done yet. */ - ON_YOUR_OWN = 0x0001, /* The ftp_loop_internal sets the - defaults. */ - DONE_CWD = 0x0002, /* The current working directory is - correct. */ + NOTHING = 0x0000, /* Nothing done yet. */ + ON_YOUR_OWN = 0x0001, /* The ftp_loop_internal sets the + defaults. */ + DONE_CWD = 0x0002, /* The current working directory is + correct. */ /* 2013-10-17 Andrea Urbani (matfanjol) For more information about the following entries, please, look at ftp.c, function getftp, text "__LIST_A_EXPLANATION__". */ - AVOID_LIST_A = 0x0004, /* It tells us if during this - session we have to avoid the use - of "LIST -a".*/ - AVOID_LIST = 0x0008, /* It tells us if during this - session we have to avoid to use - "LIST". */ + AVOID_LIST_A = 0x0004, /* It tells us if during this + session we have to avoid the use + of "LIST -a".*/ + AVOID_LIST = 0x0008, /* It tells us if during this + session we have to avoid to use + "LIST". */ LIST_AFTER_LIST_A_CHECK_DONE = 0x0010 - /* It tells us if we have already - checked "LIST" after the first - "LIST -a" to handle the case of - file/folders named "-a". */ + /* It tells us if we have already + checked "LIST" after the first + "LIST -a" to handle the case of + file/folders named "-a". */ }; struct fileinfo *ftp_parse_ls (const char *, const enum stype); diff --git a/src/gettext.h b/src/gettext.h index 1f0613d1..fe383d84 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -133,8 +133,8 @@ inline #endif static const char * pgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - int category) + const char *msg_ctxt_id, const char *msgid, + int category) { const char *translation = dcgettext (domain, msg_ctxt_id, category); if (translation == msg_ctxt_id) @@ -152,9 +152,9 @@ inline #endif static const char * npgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) { const char *translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); @@ -192,8 +192,8 @@ inline #endif static const char * dcpgettext_expr (const char *domain, - const char *msgctxt, const char *msgid, - int category) + const char *msgctxt, const char *msgid, + int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; @@ -215,10 +215,10 @@ dcpgettext_expr (const char *domain, translation = dcgettext (domain, msg_ctxt_id, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) - free (msg_ctxt_id); + free (msg_ctxt_id); #endif if (translation != msg_ctxt_id) - return translation; + return translation; } return msgid; } @@ -237,9 +237,9 @@ inline #endif static const char * dcnpgettext_expr (const char *domain, - const char *msgctxt, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; @@ -261,10 +261,10 @@ dcnpgettext_expr (const char *domain, translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) - free (msg_ctxt_id); + free (msg_ctxt_id); #endif if (!(translation == msg_ctxt_id || translation == msgid_plural)) - return translation; + return translation; } return (n == 1 ? msgid : msgid_plural); } diff --git a/src/hash.h b/src/hash.h index 85767609..99b09574 100644 --- a/src/hash.h +++ b/src/hash.h @@ -34,7 +34,7 @@ as that of the covered work. */ struct hash_table; struct hash_table *hash_table_new (int, unsigned long (*) (const void *), - int (*) (const void *, const void *)); + int (*) (const void *, const void *)); void hash_table_destroy (struct hash_table *); void *hash_table_get (const struct hash_table *, const void *); @@ -47,11 +47,11 @@ int hash_table_remove (struct hash_table *, const void *); void hash_table_clear (struct hash_table *); void hash_table_for_each (struct hash_table *, - int (*) (void *, void *, void *), void *); + int (*) (void *, void *, void *), void *); typedef struct { - void *key, *value; /* public members */ - void *pos, *end; /* private members */ + void *key, *value; /* public members */ + void *pos, *end; /* private members */ } hash_table_iterator; void hash_table_iterate (struct hash_table *, hash_table_iterator *); int hash_table_iter_next (hash_table_iterator *); diff --git a/src/host.h b/src/host.h index 3f27ea0f..84f3d137 100644 --- a/src/host.h +++ b/src/host.h @@ -58,9 +58,9 @@ typedef struct { /* The actual data, in the form of struct in_addr or in6_addr: */ union { - struct in_addr d4; /* IPv4 address */ + struct in_addr d4; /* IPv4 address */ #ifdef ENABLE_IPV6 - struct in6_addr d6; /* IPv6 address */ + struct in6_addr d6; /* IPv6 address */ #endif } data; diff --git a/src/html-parse.h b/src/html-parse.h index fba96628..68e94b3f 100644 --- a/src/html-parse.h +++ b/src/html-parse.h @@ -32,8 +32,8 @@ as that of the covered work. */ #define HTML_PARSE_H struct attr_pair { - char *name; /* attribute name */ - char *value; /* attribute value */ + char *name; /* attribute name */ + char *value; /* attribute value */ /* Needed for URL conversion; the places where the value begins and ends, including the quotes and everything. */ @@ -45,19 +45,19 @@ struct attr_pair { }; struct taginfo { - char *name; /* tag name */ - int end_tag_p; /* whether this is an end-tag */ - int nattrs; /* number of attributes */ - struct attr_pair *attrs; /* attributes */ + char *name; /* tag name */ + int end_tag_p; /* whether this is an end-tag */ + int nattrs; /* number of attributes */ + struct attr_pair *attrs; /* attributes */ - const char *start_position; /* start position of tag */ - const char *end_position; /* end position of tag */ + const char *start_position; /* start position of tag */ + const char *end_position; /* end position of tag */ const char *contents_begin; /* delimiters of tag contents */ const char *contents_end; /* only valid if end_tag_p */ }; -struct hash_table; /* forward declaration */ +struct hash_table; /* forward declaration */ /* Flags for map_html_tags: */ #define MHT_STRICT_COMMENTS 1 /* use strict comment interpretation */ @@ -65,7 +65,7 @@ struct hash_table; /* forward declaration */ as "foo" */ void map_html_tags (const char *, int, - void (*) (struct taginfo *, void *), void *, int, - const struct hash_table *, const struct hash_table *); + void (*) (struct taginfo *, void *), void *, int, + const struct hash_table *, const struct hash_table *); #endif /* HTML_PARSE_H */ diff --git a/src/html-url.h b/src/html-url.h index 81fbfdb2..c4922207 100644 --- a/src/html-url.h +++ b/src/html-url.h @@ -32,15 +32,15 @@ as that of the covered work. */ #define HTML_URL_H struct map_context { - char *text; /* HTML text. */ - char *base; /* Base URI of the document, possibly - changed through . */ - const char *parent_base; /* Base of the current document. */ - const char *document_file; /* File name of this document. */ - bool nofollow; /* whether NOFOLLOW was specified in a + char *text; /* HTML text. */ + char *base; /* Base URI of the document, possibly + changed through . */ + const char *parent_base; /* Base of the current document. */ + const char *document_file; /* File name of this document. */ + bool nofollow; /* whether NOFOLLOW was specified in a tag. */ - struct urlpos *head; /* List of URLs that is being built. */ + struct urlpos *head; /* List of URLs that is being built. */ }; struct urlpos *get_urls_file (const char *); diff --git a/src/http.c b/src/http.c index 0583faed..9a28b377 100644 --- a/src/http.c +++ b/src/http.c @@ -1016,13 +1016,13 @@ modify_param_name(param_token *name) else if(delim1 == delim2) { if ((name->e - 1) == delim1) - { - result = RFC2231_ENCODING; - } + { + result = RFC2231_ENCODING; + } else - { - result = RFC2231_NOENCODING; - } + { + result = RFC2231_NOENCODING; + } name->e = delim1; } else @@ -1043,10 +1043,10 @@ modify_param_value (param_token *value, int encoding_type ) if (encoding_type == RFC2231_ENCODING) { const char *delim = memrchr (value->b, '\'', value->e - value->b); - if ( delim != NULL ) - { - value->b = (delim+1); - } + if (delim != NULL) + { + value->b = (delim+1); + } } } @@ -1154,7 +1154,7 @@ append_value_to_filename (char **filename, param_token const * const value, int original_length = strlen(*filename); int new_length = strlen(*filename) + (value->e - value->b); *filename = xrealloc (*filename, new_length+1); - memcpy (*filename + original_length, value->b, (value->e - value->b)); + memcpy (*filename + original_length, value->b, (value->e - value->b)); (*filename)[new_length] = '\0'; if (is_url_encoded) url_unescape (*filename + original_length); @@ -1515,13 +1515,13 @@ File %s already there; not retrieving.\n\n"), quote (filename)); url, warc_timestamp_str, warc_request_uuid, warc_ip, type and statcode will be saved in the headers of the WARC record. The head parameter contains the HTTP headers of the response. - + If fp is NULL and WARC is enabled, the response body will be written only to the WARC file. If WARC is disabled and fp is a file pointer, the data will be written to the file. If fp is a file pointer and WARC is enabled, the body will be written to both destinations. - + Returns the error code. */ static int read_response_body (struct http_stat *hs, int sock, FILE *fp, wgint contlen, @@ -1610,7 +1610,7 @@ read_response_body (struct http_stat *hs, int sock, FILE *fp, wgint contlen, return RETRFINISHED; } - + if (warc_tmp != NULL) fclose (warc_tmp); @@ -2651,7 +2651,7 @@ read_header: _("Location: %s%s\n"), hs->newloc ? escnonprint_uri (hs->newloc) : _("unspecified"), hs->newloc ? _(" [following]") : ""); - + /* In case the caller cares to look... */ hs->len = 0; hs->res = 0; @@ -2906,19 +2906,19 @@ read_header: } else if (ALLOW_CLOBBER || count > 0) { - if (opt.unlink && file_exists_p (hs->local_file)) - { - int res = unlink (hs->local_file); - if (res < 0) - { - logprintf (LOG_NOTQUIET, "%s: %s\n", hs->local_file, - strerror (errno)); - CLOSE_INVALIDATE (sock); - xfree (head); - xfree_null (type); - return UNLINKERR; - } - } + if (opt.unlink && file_exists_p (hs->local_file)) + { + int res = unlink (hs->local_file); + if (res < 0) + { + logprintf (LOG_NOTQUIET, "%s: %s\n", hs->local_file, + strerror (errno)); + CLOSE_INVALIDATE (sock); + xfree (head); + xfree_null (type); + return UNLINKERR; + } + } #ifdef __VMS int open_id; diff --git a/src/init.c b/src/init.c index 804e473a..9a6fd2b5 100644 --- a/src/init.c +++ b/src/init.c @@ -150,7 +150,7 @@ static const struct { { "certificatetype", &opt.cert_type, cmd_cert_type }, { "checkcertificate", &opt.check_cert, cmd_boolean }, #endif - { "chooseconfig", &opt.choose_config, cmd_file }, + { "chooseconfig", &opt.choose_config, cmd_file }, { "connecttimeout", &opt.connect_timeout, cmd_time }, { "contentdisposition", &opt.content_disposition, cmd_boolean }, { "contentonerror", &opt.content_on_error, cmd_boolean }, @@ -821,16 +821,16 @@ setval_internal_tilde (int comind, const char *com, const char *val) pstring = commands[comind].place; home = home_dir (); if (home) - { - homelen = strlen (home); - while (homelen && ISSEP (home[homelen - 1])) - home[--homelen] = '\0'; + { + homelen = strlen (home); + while (homelen && ISSEP (home[homelen - 1])) + home[--homelen] = '\0'; - /* Skip the leading "~/". */ - for (++val; ISSEP (*val); val++) - ; - *pstring = concat_strings (home, "/", val, (char *)0); - } + /* Skip the leading "~/". */ + for (++val; ISSEP (*val); val++) + ; + *pstring = concat_strings (home, "/", val, (char *)0); + } } return ret; } diff --git a/src/main.c b/src/main.c index 20b8aa33..4b230531 100644 --- a/src/main.c +++ b/src/main.c @@ -430,234 +430,234 @@ 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"), + -V, --version display the version of Wget and exit.\n"), N_("\ - -h, --help print this help.\n"), + -h, --help print this help.\n"), N_("\ - -b, --background go to background after startup.\n"), + -b, --background go to background after startup.\n"), N_("\ - -e, --execute=COMMAND execute a `.wgetrc'-style command.\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"), + -o, --output-file=FILE log messages to FILE.\n"), N_("\ - -a, --append-output=FILE append messages to FILE.\n"), + -a, --append-output=FILE append messages to FILE.\n"), #ifdef ENABLE_DEBUG N_("\ - -d, --debug print lots of debugging information.\n"), + -d, --debug print lots of debugging information.\n"), #endif #ifdef USE_WATT32 N_("\ - --wdebug print Watt-32 debug output.\n"), + --wdebug print Watt-32 debug output.\n"), #endif N_("\ - -q, --quiet quiet (no output).\n"), + -q, --quiet quiet (no output).\n"), N_("\ - -v, --verbose be verbose (this is the default).\n"), + -v, --verbose be verbose (this is the default).\n"), N_("\ - -nv, --no-verbose turn off verboseness, without being quiet.\n"), + -nv, --no-verbose turn off verboseness, without being quiet.\n"), N_("\ - --report-speed=TYPE Output bandwidth as TYPE. TYPE can be bits.\n"), + --report-speed=TYPE Output bandwidth as TYPE. TYPE can be bits.\n"), N_("\ - -i, --input-file=FILE download URLs found in local or external FILE.\n"), + -i, --input-file=FILE download URLs found in local or external FILE.\n"), N_("\ - -F, --force-html treat input file as HTML.\n"), + -F, --force-html treat input file as HTML.\n"), N_("\ - -B, --base=URL resolves HTML input-file links (-i -F)\n\ - relative to URL.\n"), + -B, --base=URL resolves HTML input-file links (-i -F)\n\ + relative to URL.\n"), N_("\ - --config=FILE Specify config file to use.\n"), + --config=FILE Specify config file to use.\n"), N_("\ - --no-config Do not read any config file.\n"), + --no-config Do not read any config file.\n"), "\n", N_("\ Download:\n"), N_("\ - -t, --tries=NUMBER set number of retries to NUMBER (0 unlimits).\n"), + -t, --tries=NUMBER set number of retries to NUMBER (0 unlimits).\n"), N_("\ - --retry-connrefused retry even if connection is refused.\n"), + --retry-connrefused retry even if connection is refused.\n"), N_("\ - -O, --output-document=FILE write documents to FILE.\n"), + -O, --output-document=FILE write documents to FILE.\n"), N_("\ - -nc, --no-clobber skip downloads that would download to\n\ - existing files (overwriting them).\n"), + -nc, --no-clobber skip downloads that would download to\n\ + existing files (overwriting them).\n"), N_("\ - -c, --continue resume getting a partially-downloaded file.\n"), + -c, --continue resume getting a partially-downloaded file.\n"), N_("\ - --start-pos=OFFSET start downloading from zero-based position OFFSET.\n"), + --start-pos=OFFSET start downloading from zero-based position OFFSET.\n"), N_("\ - --progress=TYPE select progress gauge type.\n"), + --progress=TYPE select progress gauge type.\n"), N_("\ - --show-progress display the progress bar in any verbosity mode.\n"), + --show-progress display the progress bar in any verbosity mode.\n"), N_("\ - -N, --timestamping don't re-retrieve files unless newer than\n\ - local.\n"), + -N, --timestamping don't re-retrieve files unless newer than\n\ + local.\n"), N_("\ - --no-use-server-timestamps don't set the local file's timestamp by\n\ - the one on the server.\n"), + --no-use-server-timestamps don't set the local file's timestamp by\n\ + the one on the server.\n"), N_("\ - -S, --server-response print server response.\n"), + -S, --server-response print server response.\n"), N_("\ - --spider don't download anything.\n"), + --spider don't download anything.\n"), N_("\ - -T, --timeout=SECONDS set all timeout values to SECONDS.\n"), + -T, --timeout=SECONDS set all timeout values to SECONDS.\n"), N_("\ - --dns-timeout=SECS set the DNS lookup timeout to SECS.\n"), + --dns-timeout=SECS set the DNS lookup timeout to SECS.\n"), N_("\ - --connect-timeout=SECS set the connect timeout to SECS.\n"), + --connect-timeout=SECS set the connect timeout to SECS.\n"), N_("\ - --read-timeout=SECS set the read timeout to SECS.\n"), + --read-timeout=SECS set the read timeout to SECS.\n"), N_("\ - -w, --wait=SECONDS wait SECONDS between retrievals.\n"), + -w, --wait=SECONDS wait SECONDS between retrievals.\n"), N_("\ - --waitretry=SECONDS wait 1..SECONDS between retries of a retrieval.\n"), + --waitretry=SECONDS wait 1..SECONDS between retries of a retrieval.\n"), N_("\ - --random-wait wait from 0.5*WAIT...1.5*WAIT secs between retrievals.\n"), + --random-wait wait from 0.5*WAIT...1.5*WAIT secs between retrievals.\n"), N_("\ - --no-proxy explicitly turn off proxy.\n"), + --no-proxy explicitly turn off proxy.\n"), N_("\ - -Q, --quota=NUMBER set retrieval quota to NUMBER.\n"), + -Q, --quota=NUMBER set retrieval quota to NUMBER.\n"), N_("\ - --bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host.\n"), + --bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host.\n"), N_("\ - --limit-rate=RATE limit download rate to RATE.\n"), + --limit-rate=RATE limit download rate to RATE.\n"), N_("\ - --no-dns-cache disable caching DNS lookups.\n"), + --no-dns-cache disable caching DNS lookups.\n"), N_("\ - --restrict-file-names=OS restrict chars in file names to ones OS allows.\n"), + --restrict-file-names=OS restrict chars in file names to ones OS allows.\n"), N_("\ - --ignore-case ignore case when matching files/directories.\n"), + --ignore-case ignore case when matching files/directories.\n"), #ifdef ENABLE_IPV6 N_("\ - -4, --inet4-only connect only to IPv4 addresses.\n"), + -4, --inet4-only connect only to IPv4 addresses.\n"), N_("\ - -6, --inet6-only connect only to IPv6 addresses.\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"), + --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"), + --user=USER set both ftp and http user to USER.\n"), N_("\ - --password=PASS set both ftp and http password to PASS.\n"), + --password=PASS set both ftp and http password to PASS.\n"), N_("\ - --ask-password prompt for passwords.\n"), + --ask-password prompt for passwords.\n"), N_("\ - --no-iri turn off IRI support.\n"), + --no-iri turn off IRI support.\n"), N_("\ - --local-encoding=ENC use ENC as the local encoding for IRIs.\n"), + --local-encoding=ENC use ENC as the local encoding for IRIs.\n"), N_("\ - --remote-encoding=ENC use ENC as the default remote encoding.\n"), + --remote-encoding=ENC use ENC as the default remote encoding.\n"), N_("\ - --unlink remove file before clobber.\n"), + --unlink remove file before clobber.\n"), "\n", N_("\ Directories:\n"), N_("\ - -nd, --no-directories don't create directories.\n"), + -nd, --no-directories don't create directories.\n"), N_("\ - -x, --force-directories force creation of directories.\n"), + -x, --force-directories force creation of directories.\n"), N_("\ - -nH, --no-host-directories don't create host directories.\n"), + -nH, --no-host-directories don't create host directories.\n"), N_("\ - --protocol-directories use protocol name in directories.\n"), + --protocol-directories use protocol name in directories.\n"), N_("\ - -P, --directory-prefix=PREFIX save files to PREFIX/...\n"), + -P, --directory-prefix=PREFIX save files to PREFIX/...\n"), N_("\ - --cut-dirs=NUMBER ignore NUMBER remote directory components.\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"), + --http-user=USER set http user to USER.\n"), N_("\ - --http-password=PASS set http password to PASS.\n"), + --http-password=PASS set http password to PASS.\n"), N_("\ - --no-cache disallow server-cached data.\n"), + --no-cache disallow server-cached data.\n"), N_ ("\ - --default-page=NAME Change the default page name (normally\n\ - this is `index.html'.).\n"), + --default-page=NAME Change the default page name (normally\n\ + this is `index.html'.).\n"), N_("\ - -E, --adjust-extension save HTML/CSS documents with proper extensions.\n"), + -E, --adjust-extension save HTML/CSS documents with proper extensions.\n"), N_("\ - --ignore-length ignore `Content-Length' header field.\n"), + --ignore-length ignore `Content-Length' header field.\n"), N_("\ - --header=STRING insert STRING among the headers.\n"), + --header=STRING insert STRING among the headers.\n"), N_("\ - --max-redirect maximum redirections allowed per page.\n"), + --max-redirect maximum redirections allowed per page.\n"), N_("\ - --proxy-user=USER set USER as proxy username.\n"), + --proxy-user=USER set USER as proxy username.\n"), N_("\ - --proxy-password=PASS set PASS as proxy password.\n"), + --proxy-password=PASS set PASS as proxy password.\n"), N_("\ - --referer=URL include `Referer: URL' header in HTTP request.\n"), + --referer=URL include `Referer: URL' header in HTTP request.\n"), N_("\ - --save-headers save the HTTP headers to file.\n"), + --save-headers save the HTTP headers to file.\n"), N_("\ - -U, --user-agent=AGENT identify as AGENT instead of Wget/VERSION.\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"), + --no-http-keep-alive disable HTTP keep-alive (persistent connections).\n"), N_("\ - --no-cookies don't use cookies.\n"), + --no-cookies don't use cookies.\n"), N_("\ - --load-cookies=FILE load cookies from FILE before session.\n"), + --load-cookies=FILE load cookies from FILE before session.\n"), N_("\ - --save-cookies=FILE save cookies to FILE after session.\n"), + --save-cookies=FILE save cookies to FILE after session.\n"), N_("\ - --keep-session-cookies load and save session (non-permanent) cookies.\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"), + --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"), + --post-file=FILE use the POST method; send contents of FILE.\n"), N_("\ - --method=HTTPMethod use method \"HTTPMethod\" in the header.\n"), + --method=HTTPMethod use method \"HTTPMethod\" in the header.\n"), N_("\ - --body-data=STRING Send STRING as data. --method MUST be set.\n"), + --body-data=STRING Send STRING as data. --method MUST be set.\n"), N_("\ - --body-file=FILE Send contents of FILE. --method MUST be set.\n"), + --body-file=FILE Send contents of FILE. --method MUST be set.\n"), N_("\ - --content-disposition honor the Content-Disposition header when\n\ - choosing local file names (EXPERIMENTAL).\n"), + --content-disposition honor the Content-Disposition header when\n\ + choosing local file names (EXPERIMENTAL).\n"), N_("\ - --content-on-error output the received content on server errors.\n"), + --content-on-error output the received content on server errors.\n"), N_("\ - --auth-no-challenge send Basic HTTP authentication information\n\ - without first waiting for the server's\n\ - challenge.\n"), + --auth-no-challenge send Basic HTTP authentication information\n\ + without first waiting for the server's\n\ + challenge.\n"), "\n", #ifdef HAVE_SSL N_("\ HTTPS (SSL/TLS) options:\n"), N_("\ - --secure-protocol=PR choose secure protocol, one of auto, SSLv2,\n\ - SSLv3, TLSv1 and PFS.\n"), + --secure-protocol=PR choose secure protocol, one of auto, SSLv2,\n\ + SSLv3, TLSv1 and PFS.\n"), N_("\ - --https-only only follow secure HTTPS links\n"), + --https-only only follow secure HTTPS links\n"), N_("\ - --no-check-certificate don't validate the server's certificate.\n"), + --no-check-certificate don't validate the server's certificate.\n"), N_("\ - --certificate=FILE client certificate file.\n"), + --certificate=FILE client certificate file.\n"), N_("\ - --certificate-type=TYPE client certificate type, PEM or DER.\n"), + --certificate-type=TYPE client certificate type, PEM or DER.\n"), N_("\ - --private-key=FILE private key file.\n"), + --private-key=FILE private key file.\n"), N_("\ - --private-key-type=TYPE private key type, PEM or DER.\n"), + --private-key-type=TYPE private key type, PEM or DER.\n"), N_("\ - --ca-certificate=FILE file with the bundle of CA's.\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"), + --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"), + --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"), + --egd-file=FILE file naming the EGD socket with random data.\n"), "\n", #endif /* HAVE_SSL */ @@ -665,76 +665,76 @@ HTTPS (SSL/TLS) options:\n"), FTP options:\n"), #ifdef __VMS N_("\ - --ftp-stmlf Use Stream_LF format for all binary FTP files.\n"), + --ftp-stmlf Use Stream_LF format for all binary FTP files.\n"), #endif /* def __VMS */ N_("\ - --ftp-user=USER set ftp user to USER.\n"), + --ftp-user=USER set ftp user to USER.\n"), N_("\ - --ftp-password=PASS set ftp password to PASS.\n"), + --ftp-password=PASS set ftp password to PASS.\n"), N_("\ - --no-remove-listing don't remove `.listing' files.\n"), + --no-remove-listing don't remove `.listing' files.\n"), N_("\ - --no-glob turn off FTP file name globbing.\n"), + --no-glob turn off FTP file name globbing.\n"), N_("\ - --no-passive-ftp disable the \"passive\" transfer mode.\n"), + --no-passive-ftp disable the \"passive\" transfer mode.\n"), N_("\ - --preserve-permissions preserve remote file permissions.\n"), + --preserve-permissions preserve remote file permissions.\n"), N_("\ - --retr-symlinks when recursing, get linked-to files (not dir).\n"), + --retr-symlinks when recursing, get linked-to files (not dir).\n"), "\n", N_("\ WARC options:\n"), N_("\ - --warc-file=FILENAME save request/response data to a .warc.gz file.\n"), + --warc-file=FILENAME save request/response data to a .warc.gz file.\n"), N_("\ - --warc-header=STRING insert STRING into the warcinfo record.\n"), + --warc-header=STRING insert STRING into the warcinfo record.\n"), N_("\ - --warc-max-size=NUMBER set maximum size of WARC files to NUMBER.\n"), + --warc-max-size=NUMBER set maximum size of WARC files to NUMBER.\n"), N_("\ - --warc-cdx write CDX index files.\n"), + --warc-cdx write CDX index files.\n"), N_("\ - --warc-dedup=FILENAME do not store records listed in this CDX file.\n"), + --warc-dedup=FILENAME do not store records listed in this CDX file.\n"), #ifdef HAVE_LIBZ N_("\ - --no-warc-compression do not compress WARC files with GZIP.\n"), + --no-warc-compression do not compress WARC files with GZIP.\n"), #endif N_("\ - --no-warc-digests do not calculate SHA1 digests.\n"), + --no-warc-digests do not calculate SHA1 digests.\n"), N_("\ - --no-warc-keep-log do not store the log file in a WARC record.\n"), + --no-warc-keep-log do not store the log file in a WARC record.\n"), N_("\ - --warc-tempdir=DIRECTORY location for temporary files created by the\n\ - WARC writer.\n"), + --warc-tempdir=DIRECTORY location for temporary files created by the\n\ + WARC writer.\n"), "\n", N_("\ Recursive download:\n"), N_("\ - -r, --recursive specify recursive download.\n"), + -r, --recursive specify recursive download.\n"), N_("\ - -l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).\n"), + -l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).\n"), N_("\ - --delete-after delete files locally after downloading them.\n"), + --delete-after delete files locally after downloading them.\n"), N_("\ - -k, --convert-links make links in downloaded HTML or CSS point to\n\ - local files.\n"), + -k, --convert-links make links in downloaded HTML or CSS point to\n\ + local files.\n"), N_("\ - --backups=N before writing file X, rotate up to N backup files.\n"), + --backups=N before writing file X, rotate up to N backup files.\n"), #ifdef __VMS N_("\ - -K, --backup-converted before converting file X, back up as X_orig.\n"), + -K, --backup-converted before converting file X, back up as X_orig.\n"), #else /* def __VMS */ N_("\ - -K, --backup-converted before converting file X, back up as X.orig.\n"), + -K, --backup-converted before converting file X, back up as X.orig.\n"), #endif /* def __VMS [else] */ N_("\ - -m, --mirror shortcut for -N -r -l inf --no-remove-listing.\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"), + -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"), + --strict-comments turn on strict (SGML) handling of HTML comments.\n"), "\n", N_("\ @@ -771,7 +771,7 @@ Recursive accept/reject:\n"), N_("\ -I, --include-directories=LIST list of allowed directories.\n"), N_("\ - --trust-server-names use the name specified by the redirection\n\ + --trust-server-names use the name specified by the redirection\n\ url last component.\n"), N_("\ -X, --exclude-directories=LIST list of excluded directories.\n"), @@ -1104,7 +1104,7 @@ main (int argc, char **argv) print_usage (1); fprintf (stderr, "\n"); fprintf (stderr, _("Try `%s --help' for more options.\n"), - exec_name); + exec_name); exit (2); } /* Find the short option character in the mapping. */ @@ -1709,14 +1709,14 @@ outputting to a regular file.\n")); char *wall_time = xstrdup (secs_to_human_time (end_time - start_time)); char *download_time = xstrdup (secs_to_human_time (total_download_time)); logprintf (LOG_NOTQUIET, - _("FINISHED --%s--\nTotal wall clock time: %s\n" - "Downloaded: %d files, %s in %s (%s)\n"), - datetime_str (time (NULL)), - wall_time, - numurls, - human_readable (total_downloaded_bytes, 10, 1), - download_time, - retr_rate (total_downloaded_bytes, total_download_time)); + _("FINISHED --%s--\nTotal wall clock time: %s\n" + "Downloaded: %d files, %s in %s (%s)\n"), + datetime_str (time (NULL)), + wall_time, + numurls, + human_readable (total_downloaded_bytes, 10, 1), + download_time, + retr_rate (total_downloaded_bytes, total_download_time)); xfree (wall_time); xfree (download_time); diff --git a/src/mswindows.c b/src/mswindows.c index c9923b3c..179773e0 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -620,35 +620,35 @@ inet_ntop (int af, const void *src, char *dst, socklen_t cnt) void set_windows_fd_as_blocking_socket (int fd) { - /* 04/2011 + /* 04/2011 gnulib select() converts blocking sockets to nonblocking in windows discussed here: http://old.nabble.com/blocking-socket-is-nonblocking-after-calling-gnulib- select%28%29-in-windows-td31432857.html wget uses blocking sockets so we must convert them back to blocking. - */ - int ret = 0; - int wsagle = 0; - const int zero = 0; + */ + int ret = 0; + int wsagle = 0; + const int zero = 0; - do - { - if(wsagle == WSAEINPROGRESS) - Sleep(1); /* use windows sleep */ - - WSASetLastError (0); - ret = ioctl (fd, FIONBIO, &zero); - wsagle = WSAGetLastError(); - } + do + { + if(wsagle == WSAEINPROGRESS) + Sleep(1); /* use windows sleep */ + + WSASetLastError (0); + ret = ioctl (fd, FIONBIO, &zero); + wsagle = WSAGetLastError (); + } while (ret && (wsagle == WSAEINPROGRESS)); - if(ret) + if(ret) { fprintf (stderr, _("ioctl() failed. The socket could not be set as blocking.\n") ); DEBUGP (("Winsock error: %d\n", WSAGetLastError ())); abort (); } - return; + return; } diff --git a/src/netrc.h b/src/netrc.h index b4bb8449..47adb793 100644 --- a/src/netrc.h +++ b/src/netrc.h @@ -33,10 +33,10 @@ as that of the covered work. */ typedef struct _acc_t { - char *host; /* NULL if this is the default machine - entry. */ + char *host; /* NULL if this is the default machine + entry. */ char *acc; - char *passwd; /* NULL if there is no password. */ + char *passwd; /* NULL if there is no password. */ struct _acc_t *next; } acc_t; diff --git a/src/openssl.c b/src/openssl.c index b725a065..4eab376f 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -459,10 +459,10 @@ ssl_connect_wget (int fd, const char *hostname) if (! is_valid_ip_address (hostname)) { if (! SSL_set_tlsext_host_name (conn, hostname)) - { - DEBUGP (("Failed to set TLS server-name indication.")); - goto error; - } + { + DEBUGP (("Failed to set TLS server-name indication.")); + goto error; + } } #endif @@ -712,7 +712,7 @@ ssl_check_certificate (int fd, const char *host) success = false; } } - + if (alt_name_checked == false) { /* Test commomName */ diff --git a/src/options.h b/src/options.h index 2855149c..cd4e5188 100644 --- a/src/options.h +++ b/src/options.h @@ -31,171 +31,170 @@ as that of the covered work. */ struct options { - int verbose; /* Are we verbose? (First set to -1, + int verbose; /* Are we verbose? (First set to -1, hence not boolean.) */ - bool quiet; /* Are we quiet? */ - int ntry; /* Number of tries per URL */ - bool retry_connrefused; /* Treat CONNREFUSED as non-fatal. */ - bool background; /* Whether we should work in background. */ - bool ignore_length; /* Do we heed content-length at all? */ - bool recursive; /* Are we recursive? */ - bool spanhost; /* Do we span across hosts in - recursion? */ + bool quiet; /* Are we quiet? */ + int ntry; /* Number of tries per URL */ + bool retry_connrefused; /* Treat CONNREFUSED as non-fatal. */ + bool background; /* Whether we should work in background. */ + bool ignore_length; /* Do we heed content-length at all? */ + bool recursive; /* Are we recursive? */ + bool spanhost; /* Do we span across hosts in + recursion? */ int max_redirect; /* Maximum number of times we'll allow a page to redirect. */ - bool relative_only; /* Follow only relative links. */ - bool no_parent; /* Restrict access to the parent - directory. */ - int reclevel; /* Maximum level of recursion */ - bool dirstruct; /* Do we build the directory structure - as we go along? */ - bool no_dirstruct; /* Do we hate dirstruct? */ - int cut_dirs; /* Number of directory components to cut. */ - bool add_hostdir; /* Do we add hostname directory? */ - bool protocol_directories; /* Whether to prepend "http"/"ftp" to dirs. */ - bool noclobber; /* Disables clobbering of existing - data. */ - bool unlink; /* remove file before clobbering */ - char *dir_prefix; /* The top of directory tree */ - char *lfilename; /* Log filename */ - char *input_filename; /* Input filename */ - char *choose_config; /* Specified config file */ - bool noconfig; - bool force_html; /* Is the input file an HTML file? */ + bool relative_only; /* Follow only relative links. */ + bool no_parent; /* Restrict access to the parent + directory. */ + int reclevel; /* Maximum level of recursion */ + bool dirstruct; /* Do we build the directory structure + as we go along? */ + bool no_dirstruct; /* Do we hate dirstruct? */ + int cut_dirs; /* Number of directory components to cut. */ + bool add_hostdir; /* Do we add hostname directory? */ + bool protocol_directories; /* Whether to prepend "http"/"ftp" to dirs. */ + bool noclobber; /* Disables clobbering of existing data. */ + bool unlink; /* remove file before clobbering */ + char *dir_prefix; /* The top of directory tree */ + char *lfilename; /* Log filename */ + char *input_filename; /* Input filename */ + char *choose_config; /* Specified config file */ + bool noconfig; /* Ignore all config files? */ + bool force_html; /* Is the input file an HTML file? */ char *default_page; /* Alternative default page (index file) */ - bool spider; /* Is Wget in spider mode? */ + bool spider; /* Is Wget in spider mode? */ - char **accepts; /* List of patterns to accept. */ - char **rejects; /* List of patterns to reject. */ - const char **excludes; /* List of excluded FTP directories. */ - const char **includes; /* List of FTP directories to - follow. */ - bool ignore_case; /* Whether to ignore case when - matching dirs and files */ + char **accepts; /* List of patterns to accept. */ + char **rejects; /* List of patterns to reject. */ + const char **excludes; /* List of excluded FTP directories. */ + const char **includes; /* List of FTP directories to + follow. */ + bool ignore_case; /* Whether to ignore case when + matching dirs and files */ - char *acceptregex_s; /* Patterns to accept (a regex string). */ - char *rejectregex_s; /* Patterns to reject (a regex string). */ - void *acceptregex; /* Patterns to accept (a regex struct). */ - void *rejectregex; /* Patterns to reject (a regex struct). */ + char *acceptregex_s; /* Patterns to accept (a regex string). */ + char *rejectregex_s; /* Patterns to reject (a regex string). */ + void *acceptregex; /* Patterns to accept (a regex struct). */ + void *rejectregex; /* Patterns to reject (a regex struct). */ enum { #ifdef HAVE_LIBPCRE regex_type_pcre, #endif regex_type_posix - } regex_type; /* The regex library. */ - void *(*regex_compile_fun)(const char *); /* Function to compile a regex. */ + } regex_type; /* The regex library. */ + void *(*regex_compile_fun)(const char *); /* Function to compile a regex. */ bool (*regex_match_fun)(const void *, const char *); /* Function to match a string to a regex. */ - char **domains; /* See host.c */ + char **domains; /* See host.c */ char **exclude_domains; - bool dns_cache; /* whether we cache DNS lookups. */ + bool dns_cache; /* whether we cache DNS lookups. */ char **follow_tags; /* List of HTML tags to recursively follow. */ char **ignore_tags; /* List of HTML tags to ignore if recursing. */ - bool follow_ftp; /* Are FTP URL-s followed in recursive - retrieving? */ - bool retr_symlinks; /* Whether we retrieve symlinks in - FTP. */ - char *output_document; /* The output file to which the - documents will be printed. */ - char *warc_filename; /* WARC output filename */ - char *warc_tempdir; /* WARC temp dir */ - char *warc_cdx_dedup_filename; /* CDX file to be used for deduplication. */ + bool follow_ftp; /* Are FTP URL-s followed in recursive + retrieving? */ + bool retr_symlinks; /* Whether we retrieve symlinks in + FTP. */ + char *output_document; /* The output file to which the + documents will be printed. */ + char *warc_filename; /* WARC output filename */ + char *warc_tempdir; /* WARC temp dir */ + char *warc_cdx_dedup_filename;/* CDX file to be used for deduplication. */ wgint warc_maxsize; /* WARC max archive size */ - bool warc_compression_enabled; /* For GZIP compression. */ - bool warc_digests_enabled; /* For SHA1 digests. */ - bool warc_cdx_enabled; /* Create CDX files? */ - bool warc_keep_log; /* Store the log file in a WARC record. */ - char **warc_user_headers; /* User-defined WARC header(s). */ + bool warc_compression_enabled;/* For GZIP compression. */ + bool warc_digests_enabled; /* For SHA1 digests. */ + bool warc_cdx_enabled; /* Create CDX files? */ + bool warc_keep_log; /* Store the log file in a WARC record. */ + char **warc_user_headers; /* User-defined WARC header(s). */ - char *user; /* Generic username */ - char *passwd; /* Generic password */ + char *user; /* Generic username */ + char *passwd; /* Generic password */ bool ask_passwd; /* Ask for password? */ - bool always_rest; /* Always use REST. */ - wgint start_pos; /* Start position of a download. */ - char *ftp_user; /* FTP username */ - char *ftp_passwd; /* FTP password */ - bool netrc; /* Whether to read .netrc. */ - bool ftp_glob; /* FTP globbing */ - bool ftp_pasv; /* Passive FTP. */ + bool always_rest; /* Always use REST. */ + wgint start_pos; /* Start position of a download. */ + char *ftp_user; /* FTP username */ + char *ftp_passwd; /* FTP password */ + bool netrc; /* Whether to read .netrc. */ + bool ftp_glob; /* FTP globbing */ + bool ftp_pasv; /* Passive FTP. */ - char *http_user; /* HTTP username. */ - char *http_passwd; /* HTTP password. */ - char **user_headers; /* User-defined header(s). */ - bool http_keep_alive; /* whether we use keep-alive */ + char *http_user; /* HTTP username. */ + char *http_passwd; /* HTTP password. */ + char **user_headers; /* User-defined header(s). */ + bool http_keep_alive; /* whether we use keep-alive */ - bool use_proxy; /* Do we use proxy? */ - bool allow_cache; /* Do we allow server-side caching? */ + bool use_proxy; /* Do we use proxy? */ + bool allow_cache; /* Do we allow server-side caching? */ char *http_proxy, *ftp_proxy, *https_proxy; char **no_proxy; char *base_href; - char *progress_type; /* progress indicator type. */ - bool show_progress; /* Show only the progress bar */ - bool noscroll; /* Don't scroll the filename in the progressbar */ + char *progress_type; /* progress indicator type. */ + bool show_progress; /* Show only the progress bar */ + bool noscroll; /* Don't scroll the filename in the progressbar */ char *proxy_user; /*oli*/ char *proxy_passwd; - double read_timeout; /* The read/write timeout. */ - double dns_timeout; /* The DNS timeout. */ - double connect_timeout; /* The connect timeout. */ + double read_timeout; /* The read/write timeout. */ + double dns_timeout; /* The DNS timeout. */ + double connect_timeout; /* The connect timeout. */ - bool random_wait; /* vary from 0 .. wait secs by random()? */ - double wait; /* The wait period between retrievals. */ - double waitretry; /* The wait period between retries. - HEH */ - bool use_robots; /* Do we heed robots.txt? */ + bool random_wait; /* vary from 0 .. wait secs by random()? */ + double wait; /* The wait period between retrievals. */ + double waitretry; /* The wait period between retries. - HEH */ + bool use_robots; /* Do we heed robots.txt? */ - wgint limit_rate; /* Limit the download rate to this - many bps. */ - SUM_SIZE_INT quota; /* Maximum file size to download and - store. */ + wgint limit_rate; /* Limit the download rate to this + many bps. */ + SUM_SIZE_INT quota; /* Maximum file size to download and + store. */ - bool server_response; /* Do we print server response? */ - bool save_headers; /* Do we save headers together with - file? */ - bool content_on_error; /* Do we output the content when the HTTP - status code indicates a server error */ + bool server_response; /* Do we print server response? */ + bool save_headers; /* Do we save headers together with + file? */ + bool content_on_error; /* Do we output the content when the HTTP + status code indicates a server error */ - bool debug; /* Debugging on/off */ + bool debug; /* Debugging on/off */ #ifdef USE_WATT32 bool wdebug; /* Watt-32 tcp/ip debugging on/off */ #endif - bool timestamping; /* Whether to use time-stamping. */ + bool timestamping; /* Whether to use time-stamping. */ - bool backup_converted; /* Do we save pre-converted files as *.orig? */ - int backups; /* Are numeric backups made? */ + bool backup_converted; /* Do we save pre-converted files as *.orig? */ + int backups; /* Are numeric backups made? */ - char *useragent; /* User-Agent string, which can be set - to something other than Wget. */ - char *referer; /* Naughty Referer, which can be - set to something other than - NULL. */ - bool convert_links; /* Will the links be converted - locally? */ - bool remove_listing; /* Do we remove .listing files - generated by FTP? */ - bool htmlify; /* Do we HTML-ify the OS-dependent - listings? */ + char *useragent; /* User-Agent string, which can be set + to something other than Wget. */ + char *referer; /* Naughty Referer, which can be + set to something other than + NULL. */ + bool convert_links; /* Will the links be converted + locally? */ + bool remove_listing; /* Do we remove .listing files + generated by FTP? */ + bool htmlify; /* Do we HTML-ify the OS-dependent + listings? */ char *dot_style; - wgint dot_bytes; /* How many bytes in a printing - dot. */ - int dots_in_line; /* How many dots in one line. */ - int dot_spacing; /* How many dots between spacings. */ + wgint dot_bytes; /* How many bytes in a printing + dot. */ + int dots_in_line; /* How many dots in one line. */ + int dot_spacing; /* How many dots between spacings. */ - bool delete_after; /* Whether the files will be deleted - after download. */ + bool delete_after; /* Whether the files will be deleted + after download. */ - bool adjust_extension; /* Use ".html" extension on all text/html? */ + bool adjust_extension; /* Use ".html" extension on all text/html? */ - bool page_requisites; /* Whether we need to download all files - necessary to display a page properly. */ - char *bind_address; /* What local IP address to bind to. */ + bool page_requisites; /* Whether we need to download all files + necessary to display a page properly. */ + char *bind_address; /* What local IP address to bind to. */ #ifdef HAVE_SSL enum { @@ -204,33 +203,33 @@ struct options secure_protocol_sslv3, secure_protocol_tlsv1, secure_protocol_pfs - } secure_protocol; /* type of secure protocol to use. */ - bool check_cert; /* whether to validate the server's cert */ - char *cert_file; /* external client certificate to use. */ - char *private_key; /* private key file (if not internal). */ + } secure_protocol; /* type of secure protocol to use. */ + bool check_cert; /* whether to validate the server's cert */ + char *cert_file; /* external client certificate to use. */ + char *private_key; /* private key file (if not internal). */ enum keyfile_type { keyfile_pem, keyfile_asn1 - } cert_type; /* type of client certificate file */ + } cert_type; /* type of client certificate file */ enum keyfile_type - private_key_type; /* type of private key file */ + private_key_type; /* type of private key file */ - char *ca_directory; /* CA directory (hash files) */ - char *ca_cert; /* CA certificate file to use */ + char *ca_directory; /* CA directory (hash files) */ + char *ca_cert; /* CA certificate file to use */ - char *random_file; /* file with random data to seed the PRNG */ - char *egd_file; /* file name of the egd daemon socket */ - bool https_only; /* whether to follow HTTPS only */ + char *random_file; /* file with random data to seed the PRNG */ + char *egd_file; /* file name of the egd daemon socket */ + bool https_only; /* whether to follow HTTPS only */ #endif /* HAVE_SSL */ - bool cookies; /* whether cookies are used. */ - char *cookies_input; /* file we're loading the cookies from. */ - char *cookies_output; /* file we're saving the cookies to. */ - bool keep_session_cookies; /* whether session cookies should be - saved and loaded. */ + bool cookies; /* whether cookies are used. */ + char *cookies_input; /* file we're loading the cookies from. */ + char *cookies_output; /* file we're saving the cookies to. */ + bool keep_session_cookies; /* whether session cookies should be + saved and loaded. */ - char *post_data; /* POST query string */ - char *post_file_name; /* File to post */ + char *post_data; /* POST query string */ + char *post_file_name; /* File to post */ char *method; /* HTTP Method to use in Header */ char *body_data; /* HTTP Method Data String */ char *body_file; /* HTTP Method File */ @@ -238,36 +237,36 @@ struct options enum { restrict_unix, restrict_windows - } restrict_files_os; /* file name restriction ruleset. */ - bool restrict_files_ctrl; /* non-zero if control chars in URLs - are restricted from appearing in - generated file names. */ + } restrict_files_os; /* file name restriction ruleset. */ + bool restrict_files_ctrl; /* non-zero if control chars in URLs + are restricted from appearing in + generated file names. */ bool restrict_files_nonascii; /* non-zero if bytes with values greater than 127 are restricted. */ enum { restrict_no_case_restriction, restrict_lowercase, restrict_uppercase - } restrict_files_case; /* file name case restriction. */ + } restrict_files_case; /* file name case restriction. */ - bool strict_comments; /* whether strict SGML comments are - enforced. */ + bool strict_comments; /* whether strict SGML comments are + enforced. */ bool preserve_perm; /* whether remote permissions are used - or that what is set by umask. */ + or that what is set by umask. */ #ifdef ENABLE_IPV6 - bool ipv4_only; /* IPv4 connections have been requested. */ - bool ipv6_only; /* IPv4 connections have been requested. */ + bool ipv4_only; /* IPv4 connections have been requested. */ + bool ipv6_only; /* IPv4 connections have been requested. */ #endif enum { prefer_ipv4, prefer_ipv6, prefer_none - } prefer_family; /* preferred address family when more - than one type is available */ + } prefer_family; /* preferred address family when more + than one type is available */ - bool content_disposition; /* Honor HTTP Content-Disposition header. */ + bool content_disposition; /* Honor HTTP Content-Disposition header. */ bool auth_without_challenge; /* Issue Basic authentication creds without waiting for a challenge. */ @@ -280,11 +279,11 @@ struct options int ftp_stmlf; /* Force Stream_LF format for binary FTP. */ #endif /* def __VMS */ - bool useservertimestamps; /* Update downloaded files' timestamps to - match those on server? */ + bool useservertimestamps; /* Update downloaded files' timestamps to + match those on server? */ - bool show_all_dns_entries; /* Show all the DNS entries when resolving a - name. */ + bool show_all_dns_entries; /* Show all the DNS entries when resolving a + name. */ bool report_bps; /*Output bandwidth in bits format*/ }; diff --git a/src/ptimer.h b/src/ptimer.h index 8df426af..fa9bb831 100644 --- a/src/ptimer.h +++ b/src/ptimer.h @@ -31,7 +31,7 @@ as that of the covered work. */ #ifndef PTIMER_H #define PTIMER_H -struct ptimer; /* forward declaration; all struct +struct ptimer; /* forward declaration; all struct members are private */ struct ptimer *ptimer_new (void); diff --git a/src/recur.c b/src/recur.c index d32a1b38..1121e5a7 100644 --- a/src/recur.c +++ b/src/recur.c @@ -253,23 +253,23 @@ retrieve_tree (struct url *start_url_parsed, struct iri *pi) the second time. */ if (dl_url_file_map && hash_table_contains (dl_url_file_map, url)) { - bool is_css_bool; + bool is_css_bool; file = xstrdup (hash_table_get (dl_url_file_map, url)); DEBUGP (("Already downloaded \"%s\", reusing it from \"%s\".\n", url, file)); - if ((is_css_bool = (css_allowed - && downloaded_css_set - && string_set_contains (downloaded_css_set, file))) - || (html_allowed - && downloaded_html_set - && string_set_contains (downloaded_html_set, file))) - { - descend = true; - is_css = is_css_bool; - } + if ((is_css_bool = (css_allowed + && downloaded_css_set + && string_set_contains (downloaded_css_set, file))) + || (html_allowed + && downloaded_html_set + && string_set_contains (downloaded_html_set, file))) + { + descend = true; + is_css = is_css_bool; + } } else { diff --git a/src/retr.c b/src/retr.c index 3638f90f..ff125a6c 100644 --- a/src/retr.c +++ b/src/retr.c @@ -650,7 +650,7 @@ calc_rate (wgint bytes, double secs, int *units) { double dlrate; double bibyte = 1000.0; - + if (!opt.report_bps) bibyte = 1024.0; @@ -903,10 +903,10 @@ retrieve_url (struct url * orig_parsed, const char *origurl, char **file, index page; that redirection is clearly a GET. We "suspend" POST data for the duration of the redirections, and restore it when we're done. - - RFC2616 HTTP/1.1 introduces code 307 Temporary Redirect - specifically to preserve the method of the request. - */ + + RFC2616 HTTP/1.1 introduces code 307 Temporary Redirect + specifically to preserve the method of the request. + */ if (result != NEWLOCATION_KEEP_POST && !method_suspended) SUSPEND_METHOD; @@ -1030,7 +1030,7 @@ retrieve_from_file (const char *file, bool html, int *count) /* If we have a found a content encoding, use it. * ( == is okay, because we're checking for identical object) */ if (iri->content_encoding != opt.locale) - set_uri_encoding (iri, iri->content_encoding, false); + set_uri_encoding (iri, iri->content_encoding, false); /* Reset UTF-8 encode status */ iri->utf8_encode = opt.enable_iri; diff --git a/src/sysdep.h b/src/sysdep.h index bd6b83bf..069882a7 100644 --- a/src/sysdep.h +++ b/src/sysdep.h @@ -222,10 +222,10 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); # undef FNM_PERIOD # undef FNM_NOMATCH -# define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ -# define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ -# define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ -# define FNM_NOMATCH 1 +# define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +# define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ +# define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ +# define FNM_NOMATCH 1 int fnmatch (const char *, const char *, int); #endif diff --git a/src/url.h b/src/url.h index 6d18ed81..1627be9e 100644 --- a/src/url.h +++ b/src/url.h @@ -76,11 +76,11 @@ enum url_scheme { /* Structure containing info on a URL. */ struct url { - char *url; /* Original URL */ - enum url_scheme scheme; /* URL scheme */ + char *url; /* Original URL */ + enum url_scheme scheme; /* URL scheme */ - char *host; /* Extracted hostname */ - int port; /* Port number */ + char *host; /* Extracted hostname */ + int port; /* Port number */ /* URL components (URL-quoted). */ char *path; diff --git a/src/vms.c b/src/vms.c index c65eb94d..5183c595 100644 --- a/src/vms.c +++ b/src/vms.c @@ -45,7 +45,7 @@ * * Simplifies a fancy URL-derived file name into an ODS2- or * ODS5-compatible file name. - * + * *---------------------------------------------------------------------- * * utime() @@ -299,7 +299,7 @@ int dmy_lib$initialize = (int) lib$initialize; /*--------------------------------------------------------------------*/ /* vms_arch() - + Returns (run-time) VMS architecture string. */ @@ -556,12 +556,12 @@ char *vms_getpass( const char *prompt) fclose( sdc); } return ret; -} +} /*--------------------------------------------------------------------*/ /* vms_vers() - + Returns (run-time) VMS version string. */ @@ -1337,7 +1337,7 @@ localtime_r (t, tp) return tp; } -#endif /* __CRTL_VER < 70000000 */ +#endif /* __CRTL_VER < 70000000 */ /*--------------------------------------------------------------------*/ diff --git a/src/warc.c b/src/warc.c index 38ef3a1b..82b5bb35 100644 --- a/src/warc.c +++ b/src/warc.c @@ -726,7 +726,7 @@ warc_start_new_file (bool meta) if (warc_current_file != NULL) fclose (warc_current_file); - + free (warc_current_warcinfo_uuid_str); free (warc_current_filename); diff --git a/src/wget.h b/src/wget.h index 3c739472..ba4ea21e 100644 --- a/src/wget.h +++ b/src/wget.h @@ -254,24 +254,24 @@ typedef double SUM_SIZE_INT; /* Copy the data delimited with BEG and END to alloca-allocated storage, and zero-terminate it. Arguments are evaluated only once, in the order BEG, END, PLACE. */ -#define BOUNDED_TO_ALLOCA(beg, end, place) do { \ - const char *BTA_beg = (beg); \ - int BTA_len = (end) - BTA_beg; \ - char **BTA_dest = &(place); \ - *BTA_dest = alloca (BTA_len + 1); \ - memcpy (*BTA_dest, BTA_beg, BTA_len); \ - (*BTA_dest)[BTA_len] = '\0'; \ +#define BOUNDED_TO_ALLOCA(beg, end, place) do { \ + const char *BTA_beg = (beg); \ + int BTA_len = (end) - BTA_beg; \ + char **BTA_dest = &(place); \ + *BTA_dest = alloca (BTA_len + 1); \ + memcpy (*BTA_dest, BTA_beg, BTA_len); \ + (*BTA_dest)[BTA_len] = '\0'; \ } while (0) /* Return non-zero if string bounded between BEG and END is equal to STRING_LITERAL. The comparison is case-sensitive. */ -#define BOUNDED_EQUAL(beg, end, string_literal) \ - ((end) - (beg) == sizeof (string_literal) - 1 \ +#define BOUNDED_EQUAL(beg, end, string_literal) \ + ((end) - (beg) == sizeof (string_literal) - 1 \ && !memcmp (beg, string_literal, sizeof (string_literal) - 1)) /* The same as above, except the comparison is case-insensitive. */ -#define BOUNDED_EQUAL_NO_CASE(beg, end, string_literal) \ - ((end) - (beg) == sizeof (string_literal) - 1 \ +#define BOUNDED_EQUAL_NO_CASE(beg, end, string_literal) \ + ((end) - (beg) == sizeof (string_literal) - 1 \ && !strncasecmp (beg, string_literal, sizeof (string_literal) - 1)) /* Like ptr=strdup(str), but allocates the space for PTR on the stack. @@ -280,11 +280,11 @@ typedef double SUM_SIZE_INT; The problem is that some compilers can't handle alloca() being an argument to a function. */ -#define STRDUP_ALLOCA(ptr, str) do { \ - char **SA_dest = &(ptr); \ - const char *SA_src = (str); \ - *SA_dest = (char *)alloca (strlen (SA_src) + 1); \ - strcpy (*SA_dest, SA_src); \ +#define STRDUP_ALLOCA(ptr, str) do { \ + char **SA_dest = &(ptr); \ + const char *SA_src = (str); \ + *SA_dest = (char *)alloca (strlen (SA_src) + 1); \ + strcpy (*SA_dest, SA_src); \ } while (0) /* Generally useful if you want to avoid arbitrary size limits but @@ -295,17 +295,17 @@ typedef double SUM_SIZE_INT; NEEDED_SIZE objects. The reallocing is done by doubling, which ensures constant amortized time per element. */ -#define DO_REALLOC(basevar, sizevar, needed_size, type) do { \ - long DR_needed_size = (needed_size); \ - long DR_newsize = 0; \ - while ((sizevar) < (DR_needed_size)) { \ - DR_newsize = sizevar << 1; \ - if (DR_newsize < 16) \ - DR_newsize = 16; \ - (sizevar) = DR_newsize; \ - } \ - if (DR_newsize) \ - basevar = xrealloc (basevar, DR_newsize * sizeof (type)); \ +#define DO_REALLOC(basevar, sizevar, needed_size, type) do { \ + long DR_needed_size = (needed_size); \ + long DR_newsize = 0; \ + while ((sizevar) < (DR_needed_size)) { \ + DR_newsize = sizevar << 1; \ + if (DR_newsize < 16) \ + DR_newsize = 16; \ + (sizevar) = DR_newsize; \ + } \ + if (DR_newsize) \ + basevar = xrealloc (basevar, DR_newsize * sizeof (type)); \ } while (0) /* Used to print pointers (usually for debugging). Print pointers @@ -323,14 +323,14 @@ extern const char *exec_name; /* Document type ("dt") flags */ enum { - TEXTHTML = 0x0001, /* document is of type text/html + TEXTHTML = 0x0001, /* document is of type text/html or application/xhtml+xml */ - RETROKF = 0x0002, /* retrieval was OK */ - HEAD_ONLY = 0x0004, /* only send the HEAD request */ - SEND_NOCACHE = 0x0008, /* send Pragma: no-cache directive */ - ACCEPTRANGES = 0x0010, /* Accept-ranges header was found */ + RETROKF = 0x0002, /* retrieval was OK */ + HEAD_ONLY = 0x0004, /* only send the HEAD request */ + SEND_NOCACHE = 0x0008, /* send Pragma: no-cache directive */ + ACCEPTRANGES = 0x0010, /* Accept-ranges header was found */ ADDED_HTML_EXTENSION = 0x0020, /* added ".html" extension due to -E */ - TEXTCSS = 0x0040 /* document is of type text/css */ + TEXTCSS = 0x0040 /* document is of type text/css */ }; /* Universal error type -- used almost everywhere. Error reporting of