summaryrefslogtreecommitdiffstats
path: root/sbin/shutdown/shutdown.c
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>1999-06-21 06:21:05 +0000
committerjkoshy <jkoshy@FreeBSD.org>1999-06-21 06:21:05 +0000
commitf4b6c01b897e0897a4f08dc0bea7b5ebd8b5340f (patch)
tree259c9db0f0097db189dccaf59b23d39e439fe0fb /sbin/shutdown/shutdown.c
parent196a4d4309a59da00ff90c59c9060393d4e7e00e (diff)
downloadFreeBSD-src-f4b6c01b897e0897a4f08dc0bea7b5ebd8b5340f.zip
FreeBSD-src-f4b6c01b897e0897a4f08dc0bea7b5ebd8b5340f.tar.gz
Minor cleanups to shutdown(8):
- Make the -k "don't actually halt" flag incompatible with the halt/reboot options -h, -p, and -r. - The -n "don't sync" option is ignored if -k is specified. Issue a warning message. - Compute the actual shutdown time written to /var/run/nologin correctly in the case of "now" being specified.
Diffstat (limited to 'sbin/shutdown/shutdown.c')
-rw-r--r--sbin/shutdown/shutdown.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/shutdown/shutdown.c b/sbin/shutdown/shutdown.c
index 03a1866..8f9e7c8 100644
--- a/sbin/shutdown/shutdown.c
+++ b/sbin/shutdown/shutdown.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)shutdown.c 8.4 (Berkeley) 4/28/95";
#endif
static const char rcsid[] =
- "$Id: shutdown.c,v 1.16 1998/12/11 11:21:47 bde Exp $";
+ "$Id: shutdown.c,v 1.17 1999/06/18 14:26:07 ru Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -151,10 +151,14 @@ main(argc, argv)
if (argc < 1)
usage();
- if (doreboot + dohalt + dopower > 1) {
- warnx("incompatible switches -h, -p and -r");
+ if (killflg + doreboot + dohalt + dopower > 1) {
+ warnx("incompatible switches -h, -k, -p and -r");
usage();
}
+
+ if (killflg && nosync)
+ warnx("option -n ignored with -k");
+
getoffset(*argv++);
if (*argv) {
@@ -383,12 +387,14 @@ getoffset(timearg)
time_t now;
int this_year;
+ (void)time(&now);
+
if (!strcasecmp(timearg, "now")) { /* now */
offset = 0;
+ shuttime = now;
return;
}
- (void)time(&now);
if (*timearg == '+') { /* +minutes */
if (!isdigit(*++timearg))
badtime();
OpenPOWER on IntegriCloud