Add a -p option to halt(8), specifying that the system should be powered

down.
This commit is contained in:
thorpej 1998-06-06 21:05:41 +00:00
parent fe17c44d6c
commit 5f9840e94e
2 changed files with 19 additions and 7 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: reboot.8,v 1.8 1998/01/20 23:43:41 mycroft Exp $
.\" $NetBSD: reboot.8,v 1.9 1998/06/06 21:05:41 thorpej Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -43,7 +43,7 @@
stopping and restarting the system
.Sh SYNOPSIS
.Nm halt
.Op Fl dlnq
.Op Fl dlnpq
.Nm ""
.Op Fl dlnq
.Sh DESCRIPTION
@ -70,6 +70,11 @@ before halting or restarting.
.It Fl n
Do not flush the file system cache.
This option should be used with extreme caution.
.It Fl p
Attempt to powerdown the system. If the powerdown fails, or the system
does not support software powerdown, the system will halt. This option
is only valid for
.Nm halt .
.It Fl q
Do not give processes a chance to shut down before halting or restarting.
This option should not normally be used.

View File

@ -1,4 +1,4 @@
/* $NetBSD: reboot.c,v 1.18 1998/01/20 23:41:57 mycroft Exp $ */
/* $NetBSD: reboot.c,v 1.19 1998/06/06 21:05:41 thorpej Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\n"
#if 0
static char sccsid[] = "@(#)reboot.c 8.1 (Berkeley) 6/5/93";
#else
__RCSID("$NetBSD: reboot.c,v 1.18 1998/01/20 23:41:57 mycroft Exp $");
__RCSID("$NetBSD: reboot.c,v 1.19 1998/06/06 21:05:41 thorpej Exp $");
#endif
#endif /* not lint */
@ -84,7 +84,7 @@ main(argc, argv)
} else
howto = 0;
lflag = nflag = qflag = 0;
while ((ch = getopt(argc, argv, "dlnq")) != -1)
while ((ch = getopt(argc, argv, "dlnpq")) != -1)
switch(ch) {
case 'd':
howto |= RB_DUMP;
@ -96,6 +96,11 @@ main(argc, argv)
nflag = 1;
howto |= RB_NOSYNC;
break;
case 'p':
if (dohalt == 0)
usage();
howto |= RB_POWERDOWN;
break;
case 'q':
qflag = 1;
break;
@ -211,7 +216,9 @@ restart:
void
usage()
{
(void)fprintf(stderr, "usage: %s [-dlnq] [-- <boot string>]\n",
__progname);
const char *pflag = dohalt ? "p" : "";
(void)fprintf(stderr, "usage: %s [-dln%sq] [-- <boot string>]\n",
__progname, pflag);
exit(1);
}