If no display options are passed and "-M both" is active, set a "ratio" option flag to display the in:out ratio as well (#67).

This commit is contained in:
Andrew Wood
2026-04-02 23:08:49 +01:00
parent 8ef4ff2e84
commit 80358e84f3
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -93,6 +93,7 @@ struct opts_s {
bool rate; /* rate counter flag */
bool average_rate; /* average rate counter flag */
bool bytes; /* bytes transferred flag */
bool ratio; /* in:out ratio flag */
bool bits; /* report transfer size in bits */
bool decimal_units; /* decimal prefix flag */
bool bufpercent; /* transfer buffer percentage flag */
+2 -1
View File
@@ -1290,7 +1290,8 @@ opts_t opts_parse(unsigned int argc, char **argv)
opts->eta = true;
opts->rate = true;
opts->bytes = true;
/* TODO: add ratio format if "-M both" */
if (PV_SIDE_BOTH == opts->side)
opts->ratio = true;
}
/* If -Z was given but not -E, pretend one -E was given too. */
+2
View File
@@ -412,6 +412,8 @@ void pv_state_free(pvstate_t state)
/*
* Set the formatting string, given a set of old-style formatting options.
*
* TODO: allow opts->ratio to be passed here as well.
*/
void pv_state_set_format(pvstate_t state, bool progress, bool timer, bool eta, bool fineta, bool rate, bool average_rate, bool bytes, bool bufpercent, size_t lastwritten, /*@null@ */
const char *name)