Bug789 v0.6

Here's a PR for the suricata startup cleaning. I did not manage to get as far as I wanted. This PR is a good first step but the main() function remains complex.
I've rebased this branch on lastest master and this was really painful as a lot of modification have been done. This explains why I propose this PR now. An other reason is that making it go "public" will maybe result in someone having better ideas than me on factorization of this code.