system() source bugfixes and enhancements from PE

This fixes HP-UX, so it reads from /dev/log instead of /dev/pipe, and also from /dev/klog. With this patch, the system() source is in line with the version in PE.