Add support to halt, to allow it to request that the power be turned off

(the RB_POWEROFF flag)
This commit is contained in:
julian 1996-08-24 01:40:02 +00:00
parent 0e2e248b09
commit 918f04c032
2 changed files with 18 additions and 6 deletions

View File

@ -41,13 +41,13 @@
stopping and restarting the system
.Sh SYNOPSIS
.Nm halt
.Op Fl nq
.Op Fl nqp
.Nm reboot
.Op Fl nq
.Op Fl nqp
.Nm fasthalt
.Op Fl nq
.Op Fl nqp
.Nm fastboot
.Op Fl nq
.Op Fl nqp
.Sh DESCRIPTION
The
.Nm halt
@ -74,6 +74,14 @@ option is specified,
the system is halted or restarted quickly and ungracefully, and only
the flushing of the file system cache is performed.
This option should probably not be used.
.It Fl p
If the
.Fl p
option is specified, then the system will turn off the power
if it can. This is of course likely to make
.Nm reboot
rather similar to
.Nm halt.
.El
.Pp
The

View File

@ -63,7 +63,7 @@ main(argc, argv)
{
register int i;
struct passwd *pw;
int ch, howto, lflag, nflag, qflag, sverrno;
int ch, howto, lflag, nflag, qflag, pflag, sverrno;
char *p, *user;
if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) {
@ -72,7 +72,7 @@ main(argc, argv)
} else
howto = 0;
lflag = nflag = qflag = 0;
while ((ch = getopt(argc, argv, "lnq")) != EOF)
while ((ch = getopt(argc, argv, "lnpq")) != EOF)
switch(ch) {
case 'l': /* Undocumented; used by shutdown. */
lflag = 1;
@ -81,6 +81,10 @@ main(argc, argv)
nflag = 1;
howto |= RB_NOSYNC;
break;
case 'p':
pflag = 1;
howto |= (RB_POWEROFF | RB_HALT);
break;
case 'q':
qflag = 1;
break;