diff --git a/doc/Changelog b/doc/Changelog index 8112ec4..85a8bcb 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,8 @@ sysvinit (2.91) UNRELEASED; urgency=low * Adjusted order of compile flags to make it easier for downstream to adjust optimization level. Patch provided by Matias Fonzo. Can now set optimization level in CFLAGS variable. + * Added --version command line flag to display current version info. + Updated manual page for init.8 to match. sysvinit (2.90) world; urgency=low diff --git a/man/init.8 b/man/init.8 index 2741595..11a4423 100644 --- a/man/init.8 +++ b/man/init.8 @@ -32,6 +32,9 @@ init, telinit \- process control initialization [ \fB\-z\fP \fIxxx\fP ] .RB [ " 0123456Ss " ] .br +.B /sbin/init +.RB [ " --version " ] +.br .B /sbin/telinit [ \fB\-t\fP \fISECONDS\fP ] .RB [ " 0123456sSQqabcUu " ] @@ -247,6 +250,12 @@ line a bit, so that it takes some more space on the stack. \fBInit\fP can then manipulate the command line so that \fBps\fP(1) shows the current runlevel. .PP +.TP 0.5i +.BI "--version " +This argument, when used on its own, displays the current version of init +to the console/stdout. It is a quick way to determine which init software and +version is being used. +.PP .SH INTERFACE Init listens on a \fIfifo\fP in /dev, \fI/run/initctl\fP, for messages. \fBTelinit\fP uses this to communicate with init. The interface is not diff --git a/src/init.c b/src/init.c index 01ec191..efc40dd 100644 --- a/src/init.c +++ b/src/init.c @@ -3000,6 +3000,12 @@ int main(int argc, char **argv) else p = argv[0]; + if ( (argc == 2) && (! strcmp(argv[1], "--version") ) ) + { + printf("SysV init version: %s\n\n", VERSION); + exit(0); + } + /* Common umask */ umask(umask(077) | 022);