Build on OS X.
Merge pull request #1 from ezhuk/osx-build

Build on OS X.
Use POSIX functions to get program name and max host length