From 727da58819051dccaa6df3304042de93c6a9876d Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Thu, 11 May 2023 14:36:11 -0300 Subject: Standardize version output Changes: * Only print the version line in the print_version function * Add a print_version function where missing (put it in usage.c if the file exists) * Always a blank line after the version --- src/firemon/firemon.c | 2 +- src/firemon/firemon.h | 1 + src/firemon/usage.c | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/firemon') diff --git a/src/firemon/firemon.c b/src/firemon/firemon.c index d82f387ff..958fa1b03 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 8b6e75fc3..be83352bb 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 1cb1b7cfc..0fb9908c5 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); } -- cgit v1.2.3-54-g00ecf