diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2021-03-26 08:37:30 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-03-26 10:12:40 +1000 |
commit | 8b822a84c444f074d493bb3314c741a9bb03134c (patch) | |
tree | 8928d1d04101869edefa9db18236d2837280bf31 | |
parent | 0828fdcea03a51309436e00c0b9e9823d37e91fe (diff) | |
download | libinput-8b822a84c444f074d493bb3314c741a9bb03134c.tar.gz |
tools/record: de-duplicate an error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | tools/libinput-record.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/tools/libinput-record.c b/tools/libinput-record.c index f493e784..1566b10e 100644 --- a/tools/libinput-record.c +++ b/tools/libinput-record.c @@ -2782,17 +2782,17 @@ main(int argc, char **argv) ctx.outfile = safe_strdup(output_arg); + if (output_arg == NULL && (all || ndevices > 1)) { + fprintf(stderr, + "Recording multiple devices requires an output file\n"); + rc = EXIT_INVALID_USAGE; + goto out; + } + if (all) { char **devices; /* NULL-terminated */ char **d; - if (output_arg == NULL) { - fprintf(stderr, - "Option --all requires an output file\n"); - rc = EXIT_INVALID_USAGE; - goto out; - } - devices = all_devices(); d = devices; @@ -2806,13 +2806,6 @@ main(int argc, char **argv) strv_free(devices); } else if (ndevices > 1) { - if (ndevices > 1 && output_arg == NULL) { - fprintf(stderr, - "Recording multiple devices requires an output file\n"); - rc = EXIT_INVALID_USAGE; - goto out; - } - for (int i = ndevices; i > 0; i -= 1) { char *devnode = safe_strdup(argv[optind + i - 1]); |