diff --git a/src/include/options.h b/src/include/options.h index 33f6e26..012363a 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -34,7 +34,7 @@ struct opts_s { /* structure describing run-time options */ bool numeric; /* numeric output only */ bool wait; /* wait for transfer before display */ bool linemode; /* count lines instead of bytes */ - bool null; /* lines are null-terminated */ + bool null_terminated_lines; /* lines are null-terminated */ 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) */ diff --git a/src/include/pv-internal.h b/src/include/pv-internal.h index 4a8d988..82a06a4 100644 --- a/src/include/pv-internal.h +++ b/src/include/pv-internal.h @@ -89,7 +89,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 null; /* lines are null-terminated */ + 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 */ bool stop_at_size; /* set if we stop at "size" bytes */ diff --git a/src/include/pv.h b/src/include/pv.h index da28249..177cc76 100644 --- a/src/include/pv.h +++ b/src/include/pv.h @@ -107,7 +107,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_null_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); extern void pv_state_stop_at_size_set(pvstate_t, bool); diff --git a/src/main/main.c b/src/main/main.c index 26d7959..808315a 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -191,7 +191,7 @@ int main(int argc, char **argv) */ if (0 == opts->size) { pv_state_linemode_set(state, opts->linemode); - pv_state_null_set(state, opts->null); + pv_state_null_terminated_lines_set(state, opts->null_terminated_lines); opts->size = pv_calc_total_size(state); debug("%s: %llu", "no size given - calculated", opts->size); } @@ -268,7 +268,7 @@ int main(int argc, char **argv) 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_null_terminated_lines_set(state, opts->null_terminated_lines); pv_state_skip_errors_set(state, opts->skip_errors); pv_state_stop_at_size_set(state, opts->stop_at_size); pv_state_sync_after_write_set(state, opts->sync_after_write); diff --git a/src/main/options.c b/src/main/options.c index 73f468d..46c1d9c 100644 --- a/src/main/options.c +++ b/src/main/options.c @@ -422,7 +422,7 @@ opts_t opts_parse(unsigned int argc, char **argv) opts->linemode = true; break; case '0': - opts->null = true; + opts->null_terminated_lines = true; opts->linemode = true; break; case 'i': @@ -529,7 +529,7 @@ opts_t opts_parse(unsigned int argc, char **argv) return NULL; if (0 != opts->watch_pid) { - if (opts->linemode || opts->null || opts->stop_at_size + if (opts->linemode || opts->null_terminated_lines || opts->stop_at_size || (opts->skip_errors > 0) || (opts->buffer_size > 0) || (opts->rate_limit > 0)) { /*@-mustfreefresh@ *//* see above */ diff --git a/src/pv/file.c b/src/pv/file.c index b78b66f..e4f96a9 100644 --- a/src/pv/file.c +++ b/src/pv/file.c @@ -199,7 +199,7 @@ static unsigned long long pv_calc_total_lines(pvstate_t state) break; } for (buf_idx = 0; buf_idx < numread; buf_idx++) { - if (state->null) { + if (state->null_terminated_lines) { if ('\0' == scanbuf[buf_idx]) total++; } else { diff --git a/src/pv/state.c b/src/pv/state.c index 658ba73..3a4c6ed 100644 --- a/src/pv/state.c +++ b/src/pv/state.c @@ -192,9 +192,9 @@ void pv_state_bits_set(pvstate_t state, bool bits) state->bits = bits; }; -void pv_state_null_set(pvstate_t state, bool val) +void pv_state_null_terminated_lines_set(pvstate_t state, bool val) { - state->null = val; + state->null_terminated_lines = val; }; void pv_state_no_display_set(pvstate_t state, bool val) diff --git a/src/pv/transfer.c b/src/pv/transfer.c index b88c9ea..d1d51f8 100644 --- a/src/pv/transfer.c +++ b/src/pv/transfer.c @@ -529,7 +529,7 @@ static int pv__transfer_write(pvstate_t state, int *eof_in, int *eof_out, long * state->transfer_buffer[state->write_position + nwritten] = 0; ptr = (char *) (state->transfer_buffer + state->write_position - 1); - if (state->null) { + if (state->null_terminated_lines) { for (ptr++; ptr - (char *) state->transfer_buffer - @@ -861,7 +861,7 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out, unsigned lo * In line mode, only write up to and including the last newline, * so that we're writing output line-by-line. */ - if ((state->to_write > 0) && (state->linemode) && !(state->null)) { + if ((state->to_write > 0) && (state->linemode) && !(state->null_terminated_lines)) { /* * Guillaume Marcais: use strrchr to find last \n */