Added --bits option

This commit is contained in:
Andrew Wood
2023-07-16 23:12:12 +01:00
parent fd46c9b1f6
commit 461486ec4f
12 changed files with 70 additions and 15 deletions
+2
View File
@@ -45,6 +45,8 @@ void display_help(void)
("compute average rate over past SEC seconds (default 30s)")},
{"-b", "--bytes", 0,
N_("show number of bytes transferred")},
{"-8", "--bits", 0,
N_("show number of bits transferred")},
{"-T", "--buffer-percent", 0,
N_("show percentage of transfer buffer in use")},
{"-A", "--last-written", _("NUM"),
+1
View File
@@ -195,6 +195,7 @@ int main(int argc, char **argv)
pv_state_wait_set(state, opts->wait);
pv_state_delay_start_set(state, opts->delay_start);
pv_state_linemode_set(state, opts->linemode);
pv_state_bits_set(state, opts->bits);
pv_state_null_set(state, opts->null);
pv_state_skip_errors_set(state, opts->skip_errors);
pv_state_stop_at_size_set(state, opts->stop_at_size);
+7 -1
View File
@@ -58,6 +58,7 @@ opts_t opts_parse(int argc, char **argv)
{"rate", 0, NULL, (int) 'r'},
{"average-rate", 0, NULL, (int) 'a'},
{"bytes", 0, NULL, (int) 'b'},
{"bits", 0, NULL, (int) '8'},
{"buffer-percent", 0, NULL, (int) 'T'},
{"last-written", 1, NULL, (int) 'A'},
{"force", 0, NULL, (int) 'f'},
@@ -88,7 +89,7 @@ opts_t opts_parse(int argc, char **argv)
int option_index = 0;
#endif
char *short_options =
"hVpteIrabTA:fnqcWD:s:l0i:w:H:N:F:L:B:CESR:P:d:m:";
"hVpteIrab8TA:fnqcWD:s:l0i:w:H:N:F:L:B:CESR:P:d:m:";
int c, numopts;
unsigned int check_pid;
int check_fd;
@@ -234,6 +235,11 @@ opts_t opts_parse(int argc, char **argv)
opts->bytes = true;
numopts++;
break;
case '8':
opts->bytes = true;
opts->bits = true;
numopts++;
break;
case 'T':
opts->bufpercent = true;
numopts++;