mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-31 05:20:08 +01:00
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>
This commit is contained in:
parent
a2a8db261a
commit
fd4427e4ec
1 changed files with 10 additions and 9 deletions
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue