Reinstate pkg_printf just on this topic branch.
pkg_printf only missing iterate_item() now.  Nearly complete.

Add pkg_dir_keep() and pkg_file_keep() accessor methods.
Add %k for package locking status; goes with the newly committed
pkg-lock(8)
Add function pointers to the fmt table.
Reformat comment slightly
Don't use inline -- makes no sense if the function is to be called via
a pointer.
Constify (constipate?) various accessor routines
Make all the format_foo() functions take the same set of arguments and
add a list of prototypes in preparation for getting rid of the
big-momma switch statement.
Add many function prototypes.  Reorder functions in the file to group
similar code together. Fill in the final missing code blocks.  Should
be complete, bar the debugging,
Add CPP glue to be able to turn off static-ness of internal functions
while testing.  We don't want these functions generally visible in
libpkg.so, but we do want to be able to exercise them individually
from within atf.
Split out the typedefs and function prototypes into a new
private/pkg_printf.h header.  This is to support linking against a
test program so that testing can exercise the pkg_printf internals.
Add a new sub-dir under tests for pkg_printf.  This pokes around in
the private internals of pkg_printf, so it specially compiles
pkg_printf.c using CPP trickery to make all the static functions in
there extern.  This means it has to be a separate binary from the
tests in ../lib

Contains no actual testing code (yet...)

Does heroic things to the C-include search path and the L-library
search path, plus futzting with RPATH to force the test program
to dynamically link against libpkg.so in the source tree.

Optionally define STATIC_TESTS to compile tests with static linkage.

Use of 'inline' in function definitions confuses the linker.
Add back portability shims for using the bundled libelf under static
compilation.
Implement tests of human_number()

- Decimal and binary formats
- Field width modifier
- Format modifier

Corresponding bug fixes to pkg_printf.c TODO: thousands separator
needs LC_NUMERIC set to something other than 'C' in order to do
anything interesting.
Implement test of gen_format()
Allow for the width of the scale factor (if required) when doing
calculations on field-width.
Impement tests for gen_format
Add tests for the string_val() output function.
Add tests for int_val(), bool_val(), mode_val()
Create a liclog_val() output function (maintaining the same layering
as for other output types) even though there's only one place it would
get called from.

Mode the static strings for licence logic or boolean output to with
the appropriate output function.

Modify the mode_val() output so that when printing values in octal,
strip off the inode type bits unless PP_EXPLICIT_PLUS '%+Fp', '%+Dp'
is given.