summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-05-25 09:32:13 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-05-26 11:15:01 +1000
commitfd4427e4ec9305ad57a007858b2f37a400a1deac (patch)
treeed64b4af9c59e2edd6af761c45acfe8433db9e59 /tools
parenta2a8db261aa65dae1d657a37533b4a99d711b668 (diff)
tools: fix return codes on failure
Leftovers from an earlier version where we had booleans and more function nesting in the mix. Fix to return integers, and also rename the function name accordingly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/libinput-tool.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/libinput-tool.c b/tools/libinput-tool.c
index 12204ab..1485419 100644
--- a/tools/libinput-tool.c
+++ b/tools/libinput-tool.c
@@ -76,8 +76,8 @@ enum global_opts {
GOPT_VERBOSE,
};
-static bool
-parse_args_cmd(enum command cmd,
+static int
+run_args_cmd(enum command cmd,
struct global_options *global_options,
int argc, char *argv[])
{
@@ -91,7 +91,8 @@ parse_args_cmd(enum command cmd,
case COMMAND_DEBUG_EVENTS:
return libinput_debug_events(global_options, argc, argv);
}
- return true;
+
+ return EXIT_FAILURE;
}
int
@@ -104,7 +105,7 @@ main(int argc, char **argv)
if (argc == 1) {
libinput_tool_usage();
- return false;
+ return EXIT_FAILURE;
}
while (1) {
@@ -125,10 +126,10 @@ main(int argc, char **argv)
case 'h':
case GOPT_HELP:
libinput_tool_usage();
- exit(0);
+ return EXIT_SUCCESS;
case GOPT_VERSION:
printf("%s\n", LIBINPUT_VERSION);
- exit(0);
+ return EXIT_SUCCESS;
case GOPT_VERBOSE:
global_options.verbose = true;
break;
@@ -137,13 +138,13 @@ main(int argc, char **argv)
break;
default:
libinput_tool_usage();
- return false;
+ return EXIT_FAILURE;
}
}
if (optind > argc) {
libinput_tool_usage();
- return false;
+ return EXIT_FAILURE;
}
command = argv[optind];
@@ -157,5 +158,5 @@ main(int argc, char **argv)
return EXIT_FAILURE;
}
- return parse_args_cmd(cmd, &global_options, argc - optind, &argv[optind]);
+ return run_args_cmd(cmd, &global_options, argc - optind, &argv[optind]);
}