Fix all issues with sample code

The getopts sample program now compiles and runs. Additionally I made
all of the indentation uniformly four spaces.