hush/miscutils
Ron Yorston 193ba408a4 less: improvements to verbose status messages
Make verbose status messages (-m/-M flags) behave more like the
real `less` command:

- fix display of line numbers so they're correct whether lines are
  being truncated (-S flag) or wrapped.
- don't display total lines or percentage when lines are read from
  stdin:  we don't have that information until we reach EOF.  When
  we do reach EOF the additional information is displayed.
- when lines are read from a file count the total number of lines
  so that we can display percentages.  Counting lines is avoided
  until the information is actually needed.  If the user pages to
  EOF the separate read pass can be avoided entirely.

Fixes Bug 7586

function                                             old     new   delta
m_status_print                                       195     382    +187
safe_lineno                                            -      35     +35
reinitialize                                         172     182     +10
read_lines                                           675     685     +10
buffer_fill_and_print                                178     169      -9
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 242/-9)            Total: 233 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-21 22:28:09 +02:00
..
Config.src taskset: support CPU masks for more than 64 CPUs 2014-08-17 19:36:22 +02:00
Kbuild.src taskset: support CPU masks for more than 64 CPUs 2014-08-17 19:36:22 +02:00
adjtimex.c adjtimex: make its help text and printed data a bit less cryptic 2014-04-17 11:29:34 +02:00
bbconfig.c rename archive.h to bb_archive.h. no code changes 2011-09-22 12:45:14 +02:00
beep.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
chat.c fix assorted unused code and wrong format specs found by cppchekc (bug 6716) 2013-11-29 16:43:33 +01:00
chrt.c chrt: remove warning for _POSIX_PRIORITY_SCHEDULING 2013-07-08 11:20:13 +02:00
conspy.c conspy: add framebuffer support, -Q option. 2011-09-13 18:39:04 +02:00
crond.c libbb: introduce and use is_prefixed_with() 2015-03-12 17:48:34 +01:00
crontab.c Removes stray empty line from code 2015-07-13 03:25:46 +02:00
dc.c dc: fix "dc p" prinitng bogus data 2015-05-25 13:31:25 +02:00
devfsd.c libbb: introduce and use is_prefixed_with() 2015-03-12 17:48:34 +01:00
devmem.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
eject.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
fbsplash.c libbb: introduce and use is_prefixed_with() 2015-03-12 17:48:34 +01:00
fbsplash.cfg fbsplash: cosmetic comment and Config text fixes; rename .ini -> .cfg 2008-03-26 15:12:11 +00:00
flash_eraseall.c flash_eraseall: implement -N 2013-03-15 00:42:39 +01:00
flash_lock_unlock.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
flashcp.c flashcp: change BUFSIZE to 4k 2014-12-10 13:44:27 +01:00
hdparm.c Use unsigned printf/scanf conversion where more appropriate 2013-11-29 16:45:45 +01:00
i2c_tools.c i2cdetect: use break instead of goto in list_i2c_busses_and_exit() 2015-06-07 18:05:47 +02:00
inotifyd.c inotify: if PROG is -, print events to stdout 2011-10-10 20:24:02 +02:00
ionice.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
last.c *: Switch to POSIX utmpx API 2015-04-02 23:03:46 +02:00
last_fancy.c libbb: add a function to make a copy of a region of memory 2015-07-19 23:05:20 +02:00
less.c less: improvements to verbose status messages 2015-07-21 22:28:09 +02:00
makedevs.c makedevs: fix help-text 2011-05-30 23:00:47 +02:00
man.c libbb: introduce and use is_prefixed_with() 2015-03-12 17:48:34 +01:00
microcom.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
mountpoint.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
mt.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
nandwrite.c nanddump: don't show --bb in usage when disabled 2014-12-18 11:55:08 +01:00
raidautorun.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
readahead.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
rfkill.c rfkill: use new-style config/kbuild/applet 2013-11-20 14:21:29 +01:00
runlevel.c *: Switch to POSIX utmpx API 2015-04-02 23:03:46 +02:00
rx.c whitespace fixes. no code changes 2013-01-15 13:58:01 +01:00
setserial.c setserial: Fix typo: s/baund_rate/baud_rate/g 2013-03-22 17:04:51 +01:00
setsid.c setsid: code shrink, expanded comments 2013-08-07 18:49:51 +02:00
strings.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
taskset.c taskset: fix logic error in "if it doesn't start with 0x..." 2014-08-31 01:35:45 +02:00
time.c whitespace fixes. no code changes 2013-01-15 13:58:01 +01:00
timeout.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
ttysize.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
ubi_tools.c ubiattach: add option -O 2015-01-30 18:33:24 +01:00
volname.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
wall.c *: Switch to POSIX utmpx API 2015-04-02 23:03:46 +02:00
watchdog.c CONFIG_PID_FILE_PATH: new configuration option for pidfile paths 2012-12-19 15:53:33 -05:00