Recurring banners except the first are printed just after the latest
interval's statistics line, giving the false impression that the latter
are omitted. It is also better to print a new banner only if it is
going to be followed by a new line of statistics, in case netstat(1) is
interrupted or we have reached the number of iterations specified by
'-q'.
Fix this by pushing printing these banners inside the loop producing
statistics lines, after having waited for the next interval.
The first banner is printed before the loop, as we want it to be printed
immediately at launch, even if at this point we do not have statistics
to display (we have to wait for an interval to compute these, as they
are based on a difference).
While here, remove the 'goto' spaghetti by putting banner printing into
its own private function and using a proper infinite loop in
sidewaysintpr().
While here, document the why of the 21 statistics line span between two
banners.
While here, check for the number of output lines of statistics once such
a line has effectively been printed. This allows to remove the internal
incrementation performed when reading '-w''s argument, which was a hack
to compensate the misplaced check.
While here, in the manual page, simplify the description of the '-w'
mode and mention that passing 0 to '-q' means "no count limit".
Fixes: 84c1edcbad7d ("Rewrite netstat/if.c to use ...")
Fixes: bf10ffe1d3a9 ("Add a new option, -q howmany, ...")
Sponsored by: The FreeBSD Foundation