Merge pull request #887 from henriknil/early_version_usage
Return EXIT_WITH_SUCCESS on early exit on version (`–version` or `-V`) and help (`–help` or `-h`) arguments.
This commit is contained in:
+12
-12
@@ -1363,6 +1363,18 @@ void exit_function() {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
/* Check if we are called with -V or --version parameter */
|
||||
if (argc >= 2 && ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0))) {
|
||||
print_version();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Check if we are called with -h or --help parameter */
|
||||
if (argc >= 2 && ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0))) {
|
||||
usage(argv[0]);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LIBDAEMON
|
||||
pid = getpid();
|
||||
#endif
|
||||
@@ -1468,18 +1480,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
r64arrayinit();
|
||||
|
||||
/* Check if we are called with -V or --version parameter */
|
||||
if (argc >= 2 && ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0))) {
|
||||
print_version();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Check if we are called with -h or --help parameter */
|
||||
if (argc >= 2 && ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0))) {
|
||||
usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LIBDAEMON
|
||||
|
||||
/* Reset signal handlers */
|
||||
|
||||
Reference in New Issue
Block a user