Rename state variable "no_op" to the more descriptive "no_display", as pv is not doing nothing when this is set, it is still transferring data.
This commit is contained in:
@@ -35,7 +35,7 @@ struct opts_s { /* structure describing run-time options */
|
||||
bool wait; /* wait for transfer before display */
|
||||
bool linemode; /* count lines instead of bytes */
|
||||
bool null; /* lines are null-terminated */
|
||||
bool no_op; /* do nothing other than pipe data */
|
||||
bool no_display; /* do nothing other than pipe data */
|
||||
unsigned long long rate_limit; /* rate limit, in bytes per second */
|
||||
unsigned long long buffer_size;/* buffer size, in bytes (0=default) */
|
||||
unsigned int remote; /* PID of pv to update settings of */
|
||||
|
||||
@@ -90,7 +90,7 @@ struct pvstate_s {
|
||||
bool linemode; /* count lines instead of bytes */
|
||||
bool bits; /* report bits instead of bytes */
|
||||
bool null; /* lines are null-terminated */
|
||||
bool no_op; /* do nothing other than pipe data */
|
||||
bool no_display; /* do nothing other than pipe data */
|
||||
unsigned int skip_errors; /* skip read errors counter */
|
||||
bool stop_at_size; /* set if we stop at "size" bytes */
|
||||
bool sync_after_write; /* set if we sync after every write */
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ 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_null_set(pvstate_t, bool);
|
||||
extern void pv_state_no_op_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);
|
||||
extern void pv_state_stop_at_size_set(pvstate_t, bool);
|
||||
extern void pv_state_sync_after_write_set(pvstate_t, bool);
|
||||
|
||||
+3
-3
@@ -211,8 +211,8 @@ int main(int argc, char **argv)
|
||||
if ((0 == isatty(STDERR_FILENO))
|
||||
&& (false == opts->force)
|
||||
&& (false == opts->numeric)) {
|
||||
opts->no_op = true;
|
||||
debug("%s", "nothing to display - setting no_op");
|
||||
opts->no_display = true;
|
||||
debug("%s", "nothing to display - setting no_display");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -259,7 +259,7 @@ int main(int argc, char **argv)
|
||||
pv_state_interval_set(state, opts->interval);
|
||||
pv_state_width_set(state, opts->width);
|
||||
pv_state_height_set(state, opts->height);
|
||||
pv_state_no_op_set(state, opts->no_op);
|
||||
pv_state_no_display_set(state, opts->no_display);
|
||||
pv_state_force_set(state, opts->force);
|
||||
pv_state_cursor_set(state, opts->cursor);
|
||||
pv_state_numeric_set(state, opts->numeric);
|
||||
|
||||
+1
-1
@@ -380,7 +380,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
numopts++;
|
||||
break;
|
||||
case 'q':
|
||||
opts->no_op = true;
|
||||
opts->no_display = true;
|
||||
numopts++;
|
||||
break;
|
||||
case 'c':
|
||||
|
||||
+2
-2
@@ -237,7 +237,7 @@ int pv_main_loop(pvstate_t state)
|
||||
next_update.tv_sec = cur_time.tv_sec - 1;
|
||||
}
|
||||
|
||||
if (state->no_op)
|
||||
if (state->no_display)
|
||||
continue;
|
||||
|
||||
/*
|
||||
@@ -322,7 +322,7 @@ int pv_main_loop(pvstate_t state)
|
||||
if (state->cursor) {
|
||||
pv_crs_fini(state);
|
||||
} else {
|
||||
if ((!state->numeric) && (!state->no_op)
|
||||
if ((!state->numeric) && (!state->no_display)
|
||||
&& (state->display_visible))
|
||||
pv_write_retry(STDERR_FILENO, "\n", 1);
|
||||
}
|
||||
|
||||
+2
-2
@@ -197,9 +197,9 @@ void pv_state_null_set(pvstate_t state, bool val)
|
||||
state->null = val;
|
||||
};
|
||||
|
||||
void pv_state_no_op_set(pvstate_t state, bool val)
|
||||
void pv_state_no_display_set(pvstate_t state, bool val)
|
||||
{
|
||||
state->no_op = val;
|
||||
state->no_display = val;
|
||||
};
|
||||
|
||||
void pv_state_skip_errors_set(pvstate_t state, unsigned int val)
|
||||
|
||||
Reference in New Issue
Block a user