From 81715c31594ac2f02b1d73dc9df0a7e9a19ca9a7 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 19 Nov 2007 16:41:36 +0000 Subject: Display version on start and allow --version to work --- src/libeinfo.c | 3 +++ src/librc.c | 3 +++ src/rc.c | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libeinfo.c b/src/libeinfo.c index 97a31fed..9561028e 100644 --- a/src/libeinfo.c +++ b/src/libeinfo.c @@ -30,6 +30,9 @@ * SUCH DAMAGE. */ +const char copyright[] = "Copyright (c) 2007 Gentoo Foundation\n" + "Copyright (c) 2007 Roy Marples"; + #include #include #include diff --git a/src/librc.c b/src/librc.c index 4a2226f6..d5ab76fa 100644 --- a/src/librc.c +++ b/src/librc.c @@ -30,6 +30,9 @@ * SUCH DAMAGE. */ +const char copyright[] = "Copyright (c) 2007 Gentoo Foundation\n" + "Copyright (c) 2007 Roy Marples"; + #include "librc.h" /* usecs to wait while we poll the fifo */ diff --git a/src/rc.c b/src/rc.c index aedf3477..e7e8ad54 100644 --- a/src/rc.c +++ b/src/rc.c @@ -35,6 +35,9 @@ * SUCH DAMAGE. */ +const char copyright[] = "Copyright (c) 2007 Gentoo Foundation\n" + "Copyright (c) 2007 Roy Marples"; + #define APPLET "rc" #define SYSLOG_NAMES @@ -68,6 +71,8 @@ #include "rc-plugin.h" #include "strlist.h" +#include "version.h" + #define INITSH RC_LIBDIR "/sh/init.sh" #define INITEARLYSH RC_LIBDIR "/sh/init-early.sh" #define HALTSH RC_INITDIR "/halt.sh" @@ -796,6 +801,11 @@ int main (int argc, char **argv) if (! applet) eerrorx ("arguments required"); + if (argc > 1 && (strcmp (argv[1], "--version") == 0)) { + printf ("%s (Open RC) version " VERSION "\n", applet); + exit (EXIT_SUCCESS); + } + /* These used to be programs in their own right, so we shouldn't * touch argc or argv for them */ if (strcmp (applet, "fstabinfo") == 0) @@ -968,8 +978,9 @@ int main (int argc, char **argv) run_script (INITEARLYSH); uname (&uts); - printf (" %sOpenRC%s is starting up\n", - ecolor (ECOLOR_GOOD), ecolor (ECOLOR_NORMAL)); + printf (" %sOpenRC %s" VERSION "%s is starting up\n", + ecolor (ECOLOR_GOOD), ecolor (ECOLOR_BRACKET), + ecolor (ECOLOR_NORMAL)); if (rc_env_bool ("RC_INTERACTIVE")) printf ("Press %sI%s to enter interactive boot mode\n\n", -- cgit v1.2.3