Move job stdin/out/err value determination into common

Move the logic that determines stdin/out/err value out of scontrol
into an API that can be called by other commands (e.g. squeue and
sview).