In an effort to make this utility easier to work with at a source level, move out the parse loop to a seperate function, and move local variables around as is needed.  To keep the state of some variables and keep from having huge arg lists to functions, make a bunch global.
In an effort to make this utility easier to work with at a source level, move
out the parse loop to a seperate function, and move local variables around as
is needed.  To keep the state of some variables and keep from having huge arg
lists to functions, make a bunch global.

Change use of err(3) in situations where malloc(3) will be setting errno to
errx(3) since assuming malloc(3) sets errno is non-portable, and provides no
more useful information in the context of FreeBSD.

Submitted by:	bde (err/errx), Carl Schmidt <cschmidt@slackerbsd.org> (some
		of the movement of the input loop to a function)
Approved by:	src/tools/regression/usr.bin/xargs

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase