Firstly, %d is the format option for an int. You should be using %hhd or %hhu for a char (d being signed, u unsigned). Or typecasting opt to (int)opt.
Secondly, you should be using an int anyway: getopt returns int. You didn't #include unistd.h, so you may be implicitly defining getopt, and implicitly defining it to return char.
Thirdly, PowerPC vs i686: different byteorder. This may impact the result of either of these errors.
Fourthly, -1 is the unsigned char with the same binary representation as the signed char 255.
Finally: This code depends on undefined behavior. C can do absolutely anything where the standard does not define the behavior, and due to the highly optimized nature of most C code, often does something you don't expect.
no subject
Secondly, you should be using an int anyway: getopt returns int. You didn't #include unistd.h, so you may be implicitly defining getopt, and implicitly defining it to return char.
Thirdly, PowerPC vs i686: different byteorder. This may impact the result of either of these errors.
Fourthly, -1 is the unsigned char with the same binary representation as the signed char 255.
Finally: This code depends on undefined behavior. C can do absolutely anything where the standard does not define the behavior, and due to the highly optimized nature of most C code, often does something you don't expect.