* libwget/hashmap.c: Likewise
* libwget/iri.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* libwget/utils.c: Likewise
Gcc 4.1.3 on NetBSD 5.1 errors when duplicate _GL_INLINE is given as a
function attribute.
From the gnulib manual: "C code ordinarily should not use inline. Typically it
is better to let the compiler figure out whether to inline, as compilers are
pretty good about optimization nowadays. In this sense, inline is like
register, another keyword that is typically no longer needed"
* include/wget/wget.h: Amend return type of wget_bar_print(), wget_bar_vprintf()
* libwget/Makefile.am: Replace fprintf in generated css_tokenizer.c
* libwget/bar.c: Replace *printf by wget_*printf,
(_bar_set_progress): Generate progress bar with memcpy/memset
* libwget/hpkp.c: Replace *printf by wget_*printf
* libwget/cookie.c: Likewise
* libwget/hpkp.c: Likewise
* libwget/hsts.c: Likewise
* libwget/http.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/io.c: Likewise
* libwget/net.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/pipe.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* libwget/utils.c: Likewise
* libwget/xml.c: Likewise
The intention is to not pull in (large) code parts from libc when
linking statically, the performance is better and we have no
portability issues on non-POSIX platforms (e.g. Windows).
This reverts commit 2d7fe3e9fc.
With the above patch, a tiny memory allocation is avoided, but in doing
so, it misses an important case. The glob(3) call never returns a
success when the file does not already exist at the given path.
* README.md: Mark options
* docs/wget2_manual.md: Mark URLs
* libwget/bar.c: Fix doc for bar_init(),
add doxygen close tag at end of file
* libwget/buffer.c: Fix doc for wget_buffer_reset()
* libwget/console.c: Move unused tag to front of param
* libwget/hpkp.c: Fix documented params for wget_hpkp_new()
* libwget/iri.c: Fix doc for wget_iri_supported()
* libwget/net.c: Fix doc for wget_tcp_printf()
* libwget/utils.c: Move unused tag to front of param
* include/wget/wget.h: Add const to first param of wget_restrict_file_name
* libwget/utils.c: Likewise
* tests/libtest.c: Remove debug output, start/stop ftp server thread,
popen() without 'b'.
* tests/test-iri.c: Skip test on _WIN32
* libwget/utils.c: Rename wget_strnglob to wget_strglob. It now calls
glob on the entire string.
* include/wget/wget.h: Change protoype of wget_strnglob
* src/options.c: Change calls to wget_strnglob to use new wget_strglob
calls
* include/wget/wget.h: Add flag 'proxied' to wget_http_connection_t,
add arg 'proxied' to wget_http_request_to_buffer(),
add new function declaration wget_http_set_no_proxy(),
add new function declaration wget_http_match_no_proxy().
* libwget/http.c: Add variable 'no_proxies',
(wget_http_open): Check host against 'no_proxy' and set 'conn->proxied'
when appropriate,
(wget_http_send_request): Call wget_http_request_to_buffer() with
conn->proxied,
(wget_http_request_to_buffer): Check 'proxied',
(_parse_proxies): Cleanup,
(_parse_no_proxies): New function,
(wget_http_set_no_proxy): New function,
(wget_http_match_no_proxy): New function
* libwget/init.c (wget_global_deinit): Free no_proxy memory
* libwget/ip.c: Add code in comments (for later use)
* libwget/utils.c (wget_match_tail, wget_match_tail_nocase): Cleanup
* src/options.c (init): Handle 'no_proxy' env variable
* src/wget_options.h (struct config): Add no_proxy member
* src/options.c (_shell_expand): New function to perform tilde
expansion on a given string
(parse_filename): Parse the input string and perform shell expansion on
it using _shell_expand
(parse_string): Set the parser functions for various options that may be
set from a config file to use parse_filename
(wget_strnglob): Run glob() on only the specified part of the string
* include/wget/wget.h: wget_get_screen_size() must not be pure
* libwget/bar.c (_bar_get_width): Leave one space right to avoid linebreaks
* libwget/utils.c (wget_human_readable): Align # of bytes
* src/bar.c (wget_get_screen_size): Fix return value
* include/wget/wget.h: New function wget_get_screen_size. Replaces old
wget_determine_screen_width
* libwget/bar.c (_bar_get_width): Use wget_get_screen_size instead of
wget_determine_screen_width
* libwget/utils.c: Replace function wget_determine_screen_width with a
more generic wget_get_screen_size.
* include/wget/wget.h: Declare new function wget_determine_screen_width.
Also change prototype of wget_bar_init to not accept a max_width
parameter
* src/utils.c: Move function determine_screen_width from here ...
* libwget/utils.c: ... to here.
* src/utils.{c,h}: Delete empty file
* src/Makefile.am: Remove source files utils.{c,h}
* src/bar.c: Move detection of screen width from here ...
* libwget/bar.c: ... to here
* tests/test.c: wget_bar_init() no longer takes a max_width parameter
* libwget/utils.c (wget_human_readable): Set acc to 1000 and print to 2
decimal places. This is similar to the settings used in Wget 1.x.
* libwget/bar.c (_bar_slot_t): Define element human_size to be as large
as _BAR_DOWNBYTES_SIZE.
* bootstrap.conf: Remove module 'human'
* include/libwget.h.in: Amend wget_human_readable()
* libwget/bar.c: Use new function wget_human_readable()
* libwget/utils.c: Replace wget_human_readable()
* src/wget.c: Use new function wget_human_readable()
* include/libwget.h.in: Add wget_human_readable_alloc()
* libwget/utils.c: Add wget_human_readable_alloc()
* libwget/bar.c: Use wget_human_readable_alloc()
* src/bar.c (bar_init): Set log function after call to wget_bar_init()
* src/wget.c (main): Use wget_human_readable() to print bottom line of bar
* bootstrap.conf: Add the human module and its dependency unistd
* include/libwget.h.in: Replace method signature for wget_human_readable
* libwget/bar.c (_bar_slot_t): Add a new struct memeber for storing the
human readable string that it printed on the progress bar
(wget_bar_init): Initialise the new human_size struct member
(wget_bar_update): Use the new wget_human_readable() method
(_bar_print_final): Same
(wget_bar_deinit): Free the allocated memory for each slot
* libwget/utils.c (wget_human_readable): Replace the old function with a
call to the human_readable() method from gnulib
Give the progress bar its own thread and let it update the entire
display asynchronously at a specified time interval. The existing
implementation refreshes the progress bar for each network packet
downloaded. Over multiple downloader threads and a high speed network
connection this can lead to far too many redrawings of the screen. Also,
each of the downloader threads will block while trying to acquire the
thread mutex because another thread just retrieved a packet. While I
haven't profiled it, it seems like there would be extremely high lock
contention in the existing implementation. Instead, with a separate
thread, we can update all the progress bar slots simultaneously at
regular intervals.
* bootstrap.conf: Include Gnulib module "ioctl"
* include/libwget.h.in: Define always_inline, flatten and deprecated
compiler attributes for both GCC and Clang
* include/libwget.h.in: Export new functions wget_human_readable,
wget_bar_register and wget_bar_deregister.
* include/libwget.h.in (wget_http_response_t): Add new element
"cur_downloaded" to struct. This element keeps a track of the raw
number of bytes downloaded in the response
(_wget_bar_ctx): Define new struct for storing the progress bar
context.
* libwget/bar.c: Fix display of downloaded ratio. Ensure it does not
exceed 100% by comparing the raw downloaded bytes instead of
uncompressed downloaded bytes.
Add support for printing the filename and downloaded bytes to the
progress bar.
* libwget/http.c (wget_http_response_cb): Store the raw number of
bytes downloaded from the network in the response data
* libwget/utils.c (wget_human_readable): New function to convert an
int value to a human readable string
* src/bar.c: Use the entire screen width instead of just 70 columns
for the progress bar.
Provide methods to register and deregister a progress bar
context
(wget_bar_update_thread): New method for the progress bar thread
to update the output periodically.
* src/bar.h: Same
* src/job.h: Move definition of struct DOWNLOADER from main.c to
here
* src/progress.h: Move definition of _body_callback_context from
main.c to here
* src/utils.c: Add new method to determine the width of the screen
* src/utils.h: Same
* src/wget.c: Use the new progress bar contexts. Update, register
and deregister them
(main): Deinit the progress bar only if it was enabled
* src/Makefile.am: Add new files, progress.h, utils.c, utils.h