Skip to content

Tools don't work on rpi

The three tools have a line of code like,

while ((c = (char)getopt_long(argc, argv, "i:o:b:s:e:t:p:S:v:h:u", long_options, &option_index)) != -1)
  • getopt_long returns (signed) int
  • char is not guaranteed to be signed
  • char specifically isn't signed when compiling for rpi, for example (and in that case, the compiler complains that the != -1 comparison can never fail.
  • the resulting executable will always print the help text and not actually do anything useful (super confusing 😀)

I think that c needs to be int, not char