summaryrefslogtreecommitdiff
path: root/src/progress.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:17 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:17 +0900
commit6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20 (patch)
tree4936775a0caecb157d619aa6c8f26310c2611c7e /src/progress.c
parent0fd98397eab07f1ec3b1fad9890fd751298e1fe0 (diff)
downloadwget-6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20.tar.gz
wget-6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20.tar.bz2
wget-6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20.zip
Imported Upstream version 1.18upstream/1.18
Diffstat (limited to 'src/progress.c')
-rw-r--r--src/progress.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/progress.c b/src/progress.c
index 93f6246..c635d19 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -1164,6 +1164,8 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
}
padding = bp->width - count_cols (bp->buffer);
+ assert (padding >= 0 && "Padding length became non-positive!");
+ padding = padding > 0 ? padding : 0;
memset (p, ' ', padding);
p += padding;
*p = '\0';
@@ -1174,6 +1176,9 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
* from the release code since we do not want Wget to crash and burn when the
* assertion fails. Instead Wget should continue downloading and display a
* horrible and irritating progress bar that spams the screen with newlines.
+ *
+ * By default, all assertions are disabled in a Wget build and are enabled
+ * only with the --enable-assert configure option.
*/
assert (count_cols (bp->buffer) == bp->width);
}
@@ -1193,8 +1198,6 @@ display_image (char *buf)
static void
bar_set_params (char *params)
{
- char *term = getenv ("TERM");
-
if (params)
{
char *param = strtok (params, ":");
@@ -1214,12 +1217,6 @@ bar_set_params (char *params)
dots. */
|| !isatty (fileno (stderr))
#endif
- /* Normally we don't depend on terminal type because the
- progress bar only uses ^M to move the cursor to the
- beginning of line, which works even on dumb terminals. But
- Jamie Zawinski reports that ^M and ^H tricks don't work in
- Emacs shell buffers, and only make a mess. */
- || (term && 0 == strcmp (term, "emacs"))
)
&& !current_impl_locked)
{