hackrf_operacake: make main options mutually exclusive

ref #930
This commit is contained in:
Mike Walters
2021-09-11 00:08:54 +01:00
parent 4ecbd5d2c9
commit f5a7132805

View File

@ -313,7 +313,11 @@ int main(int argc, char** argv) {
}
}
if(!(list || set_mode || set_ports || range_idx || gpio_test)) {
// Any operations that set a parameter on an Opera Cake board.
bool set_params = set_mode || set_ports || range_idx || dwell_idx;
// Error out unless exactly one option is selected.
if (list + set_params + gpio_test != 1) {
fprintf(stderr, "Specify either list, mode, or GPIO test option.\n");
usage();
return EXIT_FAILURE;