In all cases except CTLTYPE_STRING, penv is NULL here, so passing it
indiscriminately to printf() and freeenv() is incorrect.  Add a NULL
check before freeenv(); as for printf(), we could use req.newptr
instead, but we'd have to select the correct format string based on
the type, and that's too much work for an error message, so just
remove it.
Provide a working GPIOBUS_IVAR() macro for FDT systems.
Hook libxo to the build.

Sponsored by:	Juniper Networks, Inc.
Hook xo(1) to the build -- it's like echo, but uses libxo to
support emitting machine-readable output.

Sponsored by:	Juniper Networks, Inc.
Move the duplicated code to a single function.

No functional changes.