Added --version flag to init and updated manual page.

This commit is contained in:
Jesse Smith 2018-06-22 17:04:47 -03:00
parent 2a61e2b029
commit 4438de4e50
3 changed files with 17 additions and 0 deletions

View File

@ -5,6 +5,8 @@ sysvinit (2.91) UNRELEASED; urgency=low
* Adjusted order of compile flags to make it easier for downstream * Adjusted order of compile flags to make it easier for downstream
to adjust optimization level. Patch provided by Matias Fonzo. to adjust optimization level. Patch provided by Matias Fonzo.
Can now set optimization level in CFLAGS variable. 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 sysvinit (2.90) world; urgency=low

View File

@ -32,6 +32,9 @@ init, telinit \- process control initialization
[ \fB\-z\fP \fIxxx\fP ] [ \fB\-z\fP \fIxxx\fP ]
.RB [ " 0123456Ss " ] .RB [ " 0123456Ss " ]
.br .br
.B /sbin/init
.RB [ " --version " ]
.br
.B /sbin/telinit .B /sbin/telinit
[ \fB\-t\fP \fISECONDS\fP ] [ \fB\-t\fP \fISECONDS\fP ]
.RB [ " 0123456sSQqabcUu " ] .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 can then manipulate the command line so that \fBps\fP(1) shows
the current runlevel. the current runlevel.
.PP .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 .SH INTERFACE
Init listens on a \fIfifo\fP in /dev, \fI/run/initctl\fP, for messages. 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 \fBTelinit\fP uses this to communicate with init. The interface is not

View File

@ -3000,6 +3000,12 @@ int main(int argc, char **argv)
else else
p = argv[0]; p = argv[0];
if ( (argc == 2) && (! strcmp(argv[1], "--version") ) )
{
printf("SysV init version: %s\n\n", VERSION);
exit(0);
}
/* Common umask */ /* Common umask */
umask(umask(077) | 022); umask(umask(077) | 022);