according to man 3 getopt getopt returns an int which gets -1 when no more options are available. You used to store the return value of getopt in a char, which is a unsigned 8 bit integer. As such it can actually never get -1.
man 3 getopt
So on my RasPi gcc version 4.6.3 (Debian 4.6.3-14+rpi1) did not leave the while loop correctly, even when no option was specified.
gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
change getopt return from char to int
Thanks for catching this.
char is signed on x86 and amd64, I never realised it wasn't on arm with gcc! Thank you for the patch!
Merge pull request #193 from MaZderMind/getoptint
change getopt return storage from char to int