aboutsummaryrefslogtreecommitdiff
path: root/syslogd
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-09-01 17:22:24 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-09-01 17:22:24 +0200
commit42fba964c9e23830454fbfdd3895da315356bd27 (patch)
tree6d5a54554ae318d0b87cc7dfe2290447c3b37832 /syslogd
parent3b8764b9d21009d7e163bdc20e4a80fb765bbdfc (diff)
Centralize/unify version string printing
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'syslogd')
-rw-r--r--syslogd/Makemodule.am1
-rw-r--r--syslogd/klogd.c11
-rw-r--r--syslogd/syslogd.c14
3 files changed, 4 insertions, 22 deletions
diff --git a/syslogd/Makemodule.am b/syslogd/Makemodule.am
index ab61b87..f6c19fd 100644
--- a/syslogd/Makemodule.am
+++ b/syslogd/Makemodule.am
@@ -14,6 +14,7 @@ klogd_SOURCES = syslogd/klogd.c
klogd_CPPFLAGS = $(AM_CPPFLAGS)
klogd_CFLAGS = $(AM_CFLAGS)
klogd_LDFLAGS = $(AM_LDFLAGS)
+klogd_LDADD = libinit.a
sbin_PROGRAMS += klogd
endif
diff --git a/syslogd/klogd.c b/syslogd/klogd.c
index ca16e4e..d2301ee 100644
--- a/syslogd/klogd.c
+++ b/syslogd/klogd.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include "config.h"
+#include "util.h"
enum {
KLOG_CLOSE = 0,
@@ -48,13 +49,6 @@ static const struct option options[] = {
static const char *shortopt = "hVl:";
-static const char *versiontext =
-"klogd (Pygos init) "PACKAGE_VERSION"\n"
-"Copyright (C) 2018 David Oberhollenzer\n"
-"License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
-"This is free software: you are free to change and redistribute it.\n"
-"There is NO WARRANTY, to the extent permitted by law.\n";
-
static const char *helptext =
"Usage: klogd [OPTION]... \n\n"
"Collect printk() messages from the kernel and forward them to syslogd.\n"
@@ -82,8 +76,7 @@ static void process_options(int argc, char **argv)
fputs(helptext, stdout);
exit(EXIT_SUCCESS);
case 'V':
- fputs(versiontext, stdout);
- exit(EXIT_SUCCESS);
+ print_version("klogd");
default:
fputs("Try `klogd --help' for more information\n",
stderr);
diff --git a/syslogd/syslogd.c b/syslogd/syslogd.c
index d2433e9..3b88299 100644
--- a/syslogd/syslogd.c
+++ b/syslogd/syslogd.c
@@ -32,10 +32,6 @@
#include "syslogd.h"
#include "util.h"
-
-#define GPL_URL "https://gnu.org/licenses/gpl.html"
-
-
static const struct option long_opts[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
@@ -49,13 +45,6 @@ static const struct option long_opts[] = {
static const char *short_opts = "hVcrm:u:g:";
-const char *version_string =
-"usyslogd (pygos init) " PACKAGE_VERSION "\n"
-"Copyright (C) 2018 David Oberhollenzer\n\n"
-"License GPLv3+: GNU GPL version 3 or later <" GPL_URL ">.\n"
-"This is free software: you are free to change and redistribute it.\n"
-"There is NO WARRANTY, to the extent permitted by law.\n";
-
const char *usage_string =
"Usage: usyslogd [OPTIONS..]\n\n"
"The following options are supported:\n"
@@ -183,8 +172,7 @@ static void process_options(int argc, char **argv)
fputs(usage_string, stdout);
exit(EXIT_SUCCESS);
case 'V':
- fputs(version_string, stdout);
- exit(EXIT_SUCCESS);
+ print_version("usyslogd");
default:
goto fail;
}