shall include the source code for the parts of OpenSSL used as well
as that of the covered work. */
+#define USE_GNULIB_ALLOC
+
#include "wget.h"
#include <stdio.h>
# include <unistd.h>
#endif
#include <signal.h>
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
#include "progress.h"
#include "utils.h"
}
else
fprintf (stderr,
- _("Invalid dot style specification `%s'; leaving unchanged.\n"),
- params);
+ _("Invalid dot style specification %s; leaving unchanged.\n"),
+ quote (params));
}
\f
/* "Thermometer" (bar) progress. */
#endif
}
+#if USE_NLS_PROGRESS_BAR
int
count_cols (const char *mbs)
{
int bytes;
int remaining = strlen(mbs);
int cols = 0;
+ int wccols;
while (*mbs != '\0')
{
bytes = mbtowc (&wc, mbs, remaining);
+ assert (bytes != 0); /* Only happens when *mbs == '\0' */
+ if (bytes == -1)
+ {
+ /* Invalid sequence. We'll just have to fudge it. */
+ return cols + remaining;
+ }
mbs += bytes;
remaining -= bytes;
- cols += wcwidth(wc);
+ wccols = wcwidth(wc);
+ cols += (wccols == -1? 1 : wccols);
}
return cols;
}
+#else
+# define count_cols(mbs) ((int)(strlen(mbs)))
+#endif
/* Translation note: "ETA" is English-centric, but this must
be short, ideally 3 chars. Abbreviate if necessary. */
int nbytes;
int ncols;
+#if USE_NLS_PROGRESS_BAR
eta_trans = _(eta_str);
+#else
+ eta_trans = eta_str;
+#endif
/* Determine the number of bytes used in the translated string,
* versus the number of columns used. This is to figure out how
"[]" - progress bar decorations - 2 chars
" nnn,nnn,nnn" - downloaded bytes - 12 chars or very rarely more
" 12.5K/s" - download rate - 8 chars
- " eta 36m 51s" - ETA - 13 chars
+ " eta 36m 51s" - ETA - 14 chars
"=====>..." - progress bar - the rest
*/
int dlbytes_size = 1 + MAX (size_grouped_len, 11);
- int progress_size = bp->width - (4 + 2 + dlbytes_size + 8 + 13);
+ int progress_size = bp->width - (4 + 2 + dlbytes_size + 8 + 14);
if (progress_size < 5)
progress_size = 0;
move_to_end (p);
}
- assert (p - bp->buffer - bytes_cols_diff - size_grouped_diff <= bp->width);
-
while (p - bp->buffer - bytes_cols_diff - size_grouped_diff < bp->width)
*p++ = ' ';
*p = '\0';