Package: sane-utils Version: 1.3.1-3 Severity: wishlist
As of now, scanimage -d 'unavailable scanner interface' … and scanimage --optionname_with_a_typo … return the same error code, namely, 1. The situations are, however, of different nature. The first situation (scanner interface not found) might be repaired by getting the list of scanner names again and retrying with a newly obtained scanner name, as the scanner name is not stable and may change every couple of minutes (so the new name even may be the same as the old one); cf. https://unix.stackexchange.com/questions/795029/how-to-get-a-stable-scanner-name-for-scanimage . The second situation (bad option) is irreparable: the user has to change the argument name (say, --output-file and not --output_file). Therefore, we ask to differentiate between these two options by exit code. The way I interpret the comments in sysexits.h, EX_UNAVAILABLE is for “A service is unavailable.”, and EX_USAGE is for “a bad syntax in a parameter”. Not being a developer, I would carefully suggest considering returning EX_UNAVAILABLE when a scanner is unavailable and EX_USAGE if an option is unrecognized. If both situations occur simultaneously, the bitwise disjunction EX_UNAVAILABLE | EX_USAGE should do in general (however, this yields 69|64 = 69 on my system).

