posix: factor out doselection argument checking function.

* lib/posix/compat.lua (badoption, checkint, checkstring)
(checktable, optstring): Accept and propagate new error level
parameter.
(checkselection): Use them to factor out argument checking for
doselection argchecking wrappers.
(getpasswd, getpid, stat): Simplify argchecking wrappers
accordingly.
* NEWS: Update.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>