Move login code into main.c

Removed while loop (was eating CPU); now using waitpid to block.
Currently waits on the login process. Moved login code to the main
source file so it has easy access to the host struct data.

Might be do another restructure though, using a header with extern
variable declarations so the code can be split off into multiple files
to keep the code manageable.