libinput/0001-tools-when-the-command-isn-t-installed-print-that.patch
2017-11-09 15:24:04 +10:00

47 lines
1.1 KiB
Diff

From 92aa1d14183bd88a8080be96672682a2e5696477 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 9 Nov 2017 15:17:37 +1000
Subject: [PATCH libinput] tools: when the command isn't installed, print that
Makes it more user-friendly to be able to split the tools into multiple
packages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
tools/shared.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/tools/shared.c b/tools/shared.c
index ae3287ba..962159e1 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -510,11 +510,20 @@ tools_exec_command(const char *prefix, int real_argc, char **real_argv)
setup_path();
rc = execvp(executable, argv);
- if (rc)
- fprintf(stderr,
- "Failed to execute '%s' (%s)\n",
- command,
- strerror(errno));
+ if (rc) {
+ if (errno == ENOENT) {
+ fprintf(stderr,
+ "libinput: %s is not a libinput command or not installed. "
+ "See 'libinput --help'\n",
+ command);
+
+ } else {
+ fprintf(stderr,
+ "Failed to execute '%s' (%s)\n",
+ command,
+ strerror(errno));
+ }
+ }
return EXIT_FAILURE;
}
--
2.13.6