Rename --bits to --report-bps.

This commit is contained in:
Giuseppe Scrivano 2012-06-06 14:10:07 +02:00
parent 321b5dce85
commit 96418c6885
8 changed files with 20 additions and 10 deletions

2
NEWS
View File

@ -21,7 +21,7 @@ Please send GNU Wget bug reports to <bug-wget@gnu.org>.
** Report stdout close errors.
** Accept the --bit option.
** Accept the --report-bps option.
** Enable client certificates when GNU TLS is used.

View File

@ -1,3 +1,13 @@
2012-06-06 Giuseppe Scrivano <gscrivano@gnu.org>
* options.h (struct options): Rename `bits_fmt' to `report_bps'.
* main.c (print_help): Rename --bits to --report-bps.
(cmdline_options): Likewise.
* init.c (commands): Likewise
* progress.c (create_image): Adjust caller.
* retr.c (retr_rate): Likewise.
* utils.c (convert_to_bits): Likewise.
2012-06-04 Tim Ruehsen <tim.ruehsen@gmx.de>
* main.c (main): Check for filename != NULL.

View File

@ -133,7 +133,6 @@ static const struct {
{ "backups", &opt.backups, cmd_number },
{ "base", &opt.base_href, cmd_string },
{ "bindaddress", &opt.bind_address, cmd_string },
{ "bits", &opt.bits_fmt, cmd_boolean},
#ifdef HAVE_SSL
{ "cacertificate", &opt.ca_cert, cmd_file },
#endif
@ -248,6 +247,7 @@ static const struct {
{ "relativeonly", &opt.relative_only, cmd_boolean },
{ "remoteencoding", &opt.encoding_remote, cmd_string },
{ "removelisting", &opt.remove_listing, cmd_boolean },
{ "reportbps", &opt.report_bps, cmd_boolean},
{ "restrictfilenames", NULL, cmd_spec_restrict_file_names },
{ "retrsymlinks", &opt.retr_symlinks, cmd_boolean },
{ "retryconnrefused", &opt.retry_connrefused, cmd_boolean },

View File

@ -168,7 +168,6 @@ static struct cmdline_option option_data[] =
{ "backups", 0, OPT_BOOLEAN, "backups", -1 },
{ "base", 'B', OPT_VALUE, "base", -1 },
{ "bind-address", 0, OPT_VALUE, "bindaddress", -1 },
{ "bits", 0, OPT_BOOLEAN, "bits", -1 },
{ IF_SSL ("ca-certificate"), 0, OPT_VALUE, "cacertificate", -1 },
{ IF_SSL ("ca-directory"), 0, OPT_VALUE, "cadirectory", -1 },
{ "cache", 0, OPT_BOOLEAN, "cache", -1 },
@ -269,6 +268,7 @@ static struct cmdline_option option_data[] =
{ "relative", 'L', OPT_BOOLEAN, "relativeonly", -1 },
{ "remote-encoding", 0, OPT_VALUE, "remoteencoding", -1 },
{ "remove-listing", 0, OPT_BOOLEAN, "removelisting", -1 },
{ "report-bps", 0, OPT_BOOLEAN, "reportbps", -1 },
{ "restrict-file-names", 0, OPT_BOOLEAN, "restrictfilenames", -1 },
{ "retr-symlinks", 0, OPT_BOOLEAN, "retrsymlinks", -1 },
{ "retry-connrefused", 0, OPT_BOOLEAN, "retryconnrefused", -1 },
@ -764,7 +764,7 @@ Recursive accept/reject:\n"),
N_("\
Output format:\n"),
N_("\
--bits Output bandwidth in bits.\n"),
--report-bps Output bandwidth in bits.\n"),
"\n",
N_("Mail bug reports and suggestions to <bug-wget@gnu.org>.\n")
};

View File

@ -279,7 +279,7 @@ struct options
bool show_all_dns_entries; /* Show all the DNS entries when resolving a
name. */
bool bits_fmt; /*Output bandwidth in bits format*/
bool report_bps; /*Output bandwidth in bits format*/
};
extern struct options opt;

View File

@ -989,7 +989,7 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
double dltime = hist->total_time + (dl_total_time - bp->recent_start);
double dlspeed = calc_rate (dlquant, dltime, &units);
sprintf (p, " %4.*f%s", dlspeed >= 99.95 ? 0 : dlspeed >= 9.995 ? 1 : 2,
dlspeed, !opt.bits_fmt?short_units[units]:short_units_bits[units]);
dlspeed, !opt.report_bps ? short_units[units] : short_units_bits[units]);
move_to_end (p);
}
else

View File

@ -628,7 +628,7 @@ retr_rate (wgint bytes, double secs)
e.g. "1022", "247", "12.5", "2.38". */
sprintf (res, "%.*f %s",
dlrate >= 99.95 ? 0 : dlrate >= 9.995 ? 1 : 2,
dlrate, !opt.bits_fmt? rate_names[units]: rate_names_bits[units]);
dlrate, !opt.report_bps ? rate_names[units]: rate_names_bits[units]);
return res;
}
@ -647,7 +647,7 @@ calc_rate (wgint bytes, double secs, int *units)
double dlrate;
double bibyte = 1000.0;
if (!opt.bits_fmt)
if (!opt.report_bps)
bibyte = 1024.0;

View File

@ -1844,12 +1844,12 @@ number_to_static_string (wgint number)
return buf;
}
/* Converts the byte to bits format if --bits option is enabled
/* Converts the byte to bits format if --report-bps option is enabled
*/
wgint
convert_to_bits (wgint num)
{
if (opt.bits_fmt)
if (opt.report_bps)
return num * 8;
return num;
}