diff --git a/src/firecfg/main.c b/src/firecfg/main.c index 0725ca79feb..c9dc27b1b6f 100644 --- a/src/firecfg/main.c +++ b/src/firecfg/main.c @@ -59,11 +59,14 @@ static char *usage_str = "License GPL version 2 or later\n" "Homepage: https://firejail.wordpress.com\n\n"; -static void usage(void) { +static void print_version(void) { printf("firecfg version %s\n\n", VERSION); - puts(usage_str); } +static void usage(void) { + print_version(); + puts(usage_str); +} static void list(void) { DIR *dir = opendir(arg_bindir); @@ -364,7 +367,7 @@ int main(int argc, char **argv) { else if (strcmp(argv[i], "--debug") == 0) arg_debug = 1; else if (strcmp(argv[i], "--version") == 0) { - printf("firecfg version %s\n\n", VERSION); + print_version(); return 0; } else if (strcmp(argv[i], "--clean") == 0) { diff --git a/src/firemon/firemon.c b/src/firemon/firemon.c index d82f387ff36..958fa1b03d9 100644 --- a/src/firemon/firemon.c +++ b/src/firemon/firemon.c @@ -145,7 +145,7 @@ int main(int argc, char **argv) { return 0; } else if (strcmp(argv[i], "--version") == 0) { - printf("firemon version %s\n\n", VERSION); + print_version(); return 0; } else if (strcmp(argv[i], "--debug") == 0) diff --git a/src/firemon/firemon.h b/src/firemon/firemon.h index 8b6e75fc3f1..be83352bbc6 100644 --- a/src/firemon/firemon.h +++ b/src/firemon/firemon.h @@ -49,6 +49,7 @@ void firemon_sleep(int st); void procevent(pid_t pid) __attribute__((noreturn)); // usage.c +void print_version(void); void usage(void); // top.c diff --git a/src/firemon/usage.c b/src/firemon/usage.c index 1cb1b7cfcb9..0fb9908c5e9 100644 --- a/src/firemon/usage.c +++ b/src/firemon/usage.c @@ -78,7 +78,11 @@ static char *help_str = "Homepage: https://firejail.wordpress.com\n" "\n"; +void print_version(void) { + printf("firemon version %s\n\n", VERSION); +} + void usage(void) { - printf("firemon version %s\n", VERSION); + print_version(); puts(help_str); } diff --git a/src/jailcheck/main.c b/src/jailcheck/main.c index e01f1ca4e8e..e30ffb274f1 100644 --- a/src/jailcheck/main.c +++ b/src/jailcheck/main.c @@ -36,9 +36,12 @@ static char *usage_str = " --help, -? - this help screen.\n" " --version - print program version and exit.\n"; +static void print_version(void) { + printf("jailcheck version %s\n\n", VERSION); +} static void usage(void) { - printf("jailcheck version %s\n\n", VERSION); + print_version(); puts(usage_str); } @@ -62,7 +65,7 @@ int main(int argc, char **argv) { return 0; } else if (strcmp(argv[i], "--version") == 0) { - printf("firetest version %s\n\n", VERSION); + print_version(); return 0; } else if (strncmp(argv[i], "--hello=", 8) == 0) { // used by noexec test