Bug789 v0.4

So here's a pull request for bug 789. It improves main() function of Suricata by using functions and structure. It is far more readable now but it does not fix the complexity introduced when adding unix socket running mode support.
I will discuss this point on a separate channel and provide a separate incremental pull request once we've decided what to do.