Correct forking inside the daemon function, correct the error messages
printed, and add two new options for controlling working directory
change and redirection of the standard file descriptors.
Move the source code to the src dir, the man pages to the doc dir, and
the example configuration files to the samples dir, and update all
relevant files to reflect the changes.