Add testMain file to test src/main.cc

First step, I have added include files and licence display.
Fix typo.

errorno.h -> errno.h
Change function name.

parseForegroundCommandLineArgument -> isForegroundOptionIncluded
switchDaemon -> Daemonize