freebsd-dev/cmd
Kyle Blatter 3bfc7f1b20 Refactor arc_summary to simplify -p processing
The -p option is used to specify a specific page of output to be
displayed. If omitted, all output pages would be displayed.

arc_summary, as it stood, had really kludgy processing code for
processing the -p option. It relied on a try-except block which was
treated as an if statement and in normal operation would fail any time a
user didn't specify the -p option on the command line. When the
exception was thrown, the script would then display all output pages.
This happened whether the -p option was omitted or malformed. Thus, in
the principle use case, an exception would be raised in order to run the
script as desired. The same except code would be called regardless of
the exception, however, and malformed -p arguments would also cause the
script to execute.

Additionally, this required the function which handles the case where
all output pages were to be displayed, _call_all, to be potentially
called from several locations within main.

This commit refactors the option processing code to simplify it and make
it easier to catch runtime errors in the script. This is done by
specializing the try-except block to only have an exception when the -p
argument is malformed. When the -p option is correctly selected by the
user, it calls a function in the unSub array directly, which will only
display one page of output.

Finally in the context of this refactoring the page breaks have been
removed.  Pages seem to have been added into the output in the FreeNAS
version of the script. This patch removes pages from the output to more
closely resemble the freebsd version of the script.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Kyle Blatter <kyleblatter@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
2015-01-28 10:59:19 -08:00
..
arc_summary Refactor arc_summary to simplify -p processing 2015-01-28 10:59:19 -08:00
arcstat Print header properly when terminal resizes 2014-11-14 15:32:30 -08:00
dbufstat Python 3 fixes 2013-11-08 14:30:29 -08:00
fsck_zfs Add /sbin/fsck.zfs helper 2013-01-09 16:54:58 -08:00
mount_zfs Make directory into which mount.zfs is installed configurable 2014-10-28 09:40:59 -07:00
vdev_id vdev_id: use mawk-compatible regular expression 2014-12-19 12:05:16 -08:00
zdb Fix zdb segfault 2014-10-23 15:30:32 -07:00
zed Cleanup struct zed_conf vars in zed_conf_destroy 2014-10-06 13:18:11 -07:00
zfs Create an 'overlay' property 2014-08-15 13:39:19 -07:00
zhack Illumos 4370, 4371 2014-07-28 14:29:58 -07:00
zinject Make command line guid parsing more tolerant 2014-04-02 13:10:08 -07:00
zpios Fix error message in zpios 2014-01-29 15:11:56 -08:00
zpool Fix cstyle issue from c66989b 2014-12-19 12:00:14 -08:00
zstreamdump Illumos 4757, 4913 2014-08-01 14:28:05 -07:00
ztest Illumos 5164-5165 - space map fixes 2014-10-23 15:30:32 -07:00
zvol_id Improve zvol symlink handling. 2014-11-06 11:13:18 -08:00
Makefile.am Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00