Replace popt with getopt

In a embedded environment you might not want to have to add yet another library dependency. This commit refactors parse_cmdline() to use getopt_long() instead och popt.