Add NetBSD and SunOS support to cp_permissions.
Add NetBSD and SunOS support to cp_permissions.

Note that this likely won't work on Solaris without Coreutils as
Solaris lacks stat(1). SmartOS has stat from Coreutils in base
and the chmod(1) from it's OpenSolaris heritage. Using the chmod
from either Coreutils or Solaris will work the same (in this case)
on SmartOS.

unixorn/blackbox,StackExchange/blackbox,unixorn/blackbox,StackExchange/blackbox