Allow obfsproxy to daemonize
I've been working on setting up obfsproxy and I ran into a minor issue: It doesn't seem possible to send the obfsproxy process into the background (i.e. daemonize it) if I'm running it as an external server and not in managed mode. If I want to be able to specify the listening port for a bridge server I don't think there's a way to do this without running obfsproxy as an external server (please correct me if I'm wrong). However, there's no option to fork/detach from the terminal in the case of an external server, which seems a rather significant issue.
I've written a small patch for main.c that seems to correct this problem (see attached). This implements two command line arguments, "--daemonize", which, when specified will just send the program into the background and "--daemonize_with_pid=<pid_file>", which will daemonize and write the process id to the specified file. This patch only works on unix systems, but I've added #ifdef directives that only enable this code if unistd.h is defined, otherwise it will be completely ignored.