Added support for OSX

I've made some modifications to get this thing to compile on OSX. I've tested on OSX 10.9 and everything (file transfer ;) seems to work, even though i get the error:

    ERROR: On forking, highest fd should be 2 but it's 4

from utils.c