aboutsummaryrefslogtreecommitdiffstats
path: root/src/firemon
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-05-11 14:36:11 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-05-14 16:52:49 -0300
commit727da58819051dccaa6df3304042de93c6a9876d (patch)
tree956e70fe4579ea6aef7e85c0be0b8a43f6327001 /src/firemon
parentfirejail: simplify print_compiletime_support function (diff)
downloadfirejail-727da58819051dccaa6df3304042de93c6a9876d.tar.gz
firejail-727da58819051dccaa6df3304042de93c6a9876d.tar.zst
firejail-727da58819051dccaa6df3304042de93c6a9876d.zip
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
Diffstat (limited to 'src/firemon')
-rw-r--r--src/firemon/firemon.c2
-rw-r--r--src/firemon/firemon.h1
-rw-r--r--src/firemon/usage.c6
3 files changed, 7 insertions, 2 deletions
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) {
145 return 0; 145 return 0;
146 } 146 }
147 else if (strcmp(argv[i], "--version") == 0) { 147 else if (strcmp(argv[i], "--version") == 0) {
148 printf("firemon version %s\n\n", VERSION); 148 print_version();
149 return 0; 149 return 0;
150 } 150 }
151 else if (strcmp(argv[i], "--debug") == 0) 151 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);
49void procevent(pid_t pid) __attribute__((noreturn)); 49void procevent(pid_t pid) __attribute__((noreturn));
50 50
51// usage.c 51// usage.c
52void print_version(void);
52void usage(void); 53void usage(void);
53 54
54// top.c 55// 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 =
78 "Homepage: https://firejail.wordpress.com\n" 78 "Homepage: https://firejail.wordpress.com\n"
79 "\n"; 79 "\n";
80 80
81void print_version(void) {
82 printf("firemon version %s\n\n", VERSION);
83}
84
81void usage(void) { 85void usage(void) {
82 printf("firemon version %s\n", VERSION); 86 print_version();
83 puts(help_str); 87 puts(help_str);
84} 88}