Use dormant code to calculate total line count in line mode when all inputs are regular files, and fix unwise variable naming in size calculation functions, no more "i" and "j".

This commit is contained in:
Andrew Wood
2023-08-28 16:12:31 +01:00
parent 66cae656d1
commit 10296f93e4
6 changed files with 93 additions and 46 deletions
+4 -3
View File
@@ -187,10 +187,11 @@ int main(int argc, char **argv)
if (0 == opts->watch_pid) {
/*
* If no size was given, and we're not in line mode, try to
* calculate the total size.
* If no size was given, try to calculate the total size.
*/
if ((0 == opts->size) && (false == opts->linemode)) {
if (0 == opts->size) {
pv_state_linemode_set(state, opts->linemode);
pv_state_null_set(state, opts->null);
opts->size = pv_calc_total_size(state);
debug("%s: %llu", "no size given - calculated", opts->size);
}
+2 -1
View File
@@ -131,7 +131,8 @@ bool opts_add_file(opts_t opts, const char *filename)
* aren't copied anywhere, just the pointers are copied, so make sure the
* command line data isn't overwritten or argv[1] free()d or whatever.
*/
/*@null@ */ /*@only@ */
/*@null@ */
/*@only@ */
opts_t opts_parse(unsigned int argc, char **argv)
{
#ifdef HAVE_GETOPT_LONG