proclib: fix process_open leaving pipes open on error, shrink code
if process_open() failed (e.g. due to missing +x mode) the 3 fds
used for communication stayed open. this has now been changed to
match the example code in the #ifdef TEST part, e.g. on failure all
fds are closed and the caller can just go on without calling
process_close().
additionally the API has changed and the 3 fd members in the struct
turned into an array, which makes it easier to iterate over them.
the code has been modified to use loops for all the setup steps,
which results in tighter code in the binary and in the source, at
the cost of readability.
the test code has been adapted and now calls to awk so anyone should
be able to try it out.