Adjust the decimal units flag variable name from "si" to "decimal_units" so it does not overlap with other words like "size" and "signal"; add man page entry and adjust the "-L" man page entry; and allow this flag to also change how input prefixes are processed.

This commit is contained in:
Andrew Wood
2024-03-19 22:17:43 +00:00
parent 3b721112e6
commit c9dede08d4
13 changed files with 95 additions and 50 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* Global program option structure and the parsing function prototype.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -34,7 +34,7 @@ struct opts_s { /* structure describing run-time options */
bool average_rate; /* average rate counter flag */
bool bytes; /* bytes transferred flag */
bool bits; /* report transfer size in bits */
bool si; /* decimal prefix flag */
bool decimal_units; /* decimal prefix flag */
bool bufpercent; /* transfer buffer percentage flag */
size_t lastwritten; /* show N bytes last written */
bool force; /* force-if-not-terminal flag */
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* Functions internal to the PV library. Include "config.h" first.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -105,7 +105,7 @@ struct pvstate_s {
bool wait; /* wait for data before display */
bool linemode; /* count lines instead of bytes */
bool bits; /* report bits instead of bytes */
bool si; /* use decimal prefixes */
bool decimal_units; /* use decimal prefixes */
bool null_terminated_lines; /* lines are null-terminated */
bool no_display; /* do nothing other than pipe data */
unsigned int skip_errors; /* skip read errors counter */
+7 -5
View File
@@ -1,7 +1,7 @@
/*
* Functions used across the program.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -49,15 +49,17 @@ typedef enum {
extern double pv_getnum_interval(const char *);
/*
* Return the given string converted to an off_t, for use as a size.
* Return the given string converted to an off_t, for use as a size,
* optionally interpreting suffixes in decimal units (multiples of 1000)
* instead of multiples of 1024.
*/
extern off_t pv_getnum_size(const char *);
extern off_t pv_getnum_size(const char *, bool);
/*
* Return the given string converted to an unsigned integer, for use as a
* count such as screen width.
*/
extern unsigned int pv_getnum_count(const char *);
extern unsigned int pv_getnum_count(const char *, bool);
/*
* Return true if the given string is a number of the given type. NB an
@@ -164,7 +166,7 @@ extern void pv_state_wait_set(pvstate_t, bool);
extern void pv_state_delay_start_set(pvstate_t, double);
extern void pv_state_linemode_set(pvstate_t, bool);
extern void pv_state_bits_set(pvstate_t, bool);
extern void pv_state_si_set(pvstate_t, bool);
extern void pv_state_decimal_units_set(pvstate_t, bool);
extern void pv_state_null_terminated_lines_set(pvstate_t, bool);
extern void pv_state_no_display_set(pvstate_t, bool);
extern void pv_state_skip_errors_set(pvstate_t, unsigned int);