Switched all to getopt.

Hi,

we had the interview today.  I added getopt support for better and cleaner option parsing.  Review it and merge it if you want.

Kind regards,
 Frank.