Module Name:    src
Committed By:   dyoung
Date:           Wed Feb 16 17:53:31 UTC 2011

Modified Files:
        src/sbin/reboot: reboot.8 reboot.c
        src/sbin/shutdown: shutdown.8 shutdown.c

Log Message:
Add flags -v, -x, and -z for verbose, debug, and silent shutdowns,
respectively, by passing flags AB_VERBOSE, AB_DEBUG, and/or AB_SILENT to
reboot(2).


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sbin/reboot/reboot.8
cvs rdiff -u -r1.36 -r1.37 src/sbin/reboot/reboot.c
cvs rdiff -u -r1.28 -r1.29 src/sbin/shutdown/shutdown.8
cvs rdiff -u -r1.52 -r1.53 src/sbin/shutdown/shutdown.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/reboot/reboot.8
diff -u src/sbin/reboot/reboot.8:1.27 src/sbin/reboot/reboot.8:1.28
--- src/sbin/reboot/reboot.8:1.27	Sun Dec 12 11:38:42 2010
+++ src/sbin/reboot/reboot.8	Wed Feb 16 17:53:31 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: reboot.8,v 1.27 2010/12/12 11:38:42 pooka Exp $
+.\"	$NetBSD: reboot.8,v 1.28 2011/02/16 17:53:31 dyoung Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)reboot.8	8.1 (Berkeley) 6/9/93
 .\"
-.Dd October 21, 2008
+.Dd February 16, 2011
 .Dt REBOOT 8
 .Os
 .Sh NAME
@@ -81,6 +81,27 @@
 software powerdown, the system will halt.
 This option is only valid for
 .Nm halt .
+.It Fl v
+To enable verbose messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_VERBOSE
+to
+.Xr reboot 2 .
+.It Fl x
+To enable debugging messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_DEBUG
+to
+.Xr reboot 2 .
+.It Fl z
+To silence some shutdown messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_SILENT
+to
+.Xr reboot 2 .
 .It Fl q
 Do not give processes a chance to shut down before halting or restarting.
 This option should not normally be used.

Index: src/sbin/reboot/reboot.c
diff -u src/sbin/reboot/reboot.c:1.36 src/sbin/reboot/reboot.c:1.37
--- src/sbin/reboot/reboot.c:1.36	Sun Jul 20 01:20:23 2008
+++ src/sbin/reboot/reboot.c	Wed Feb 16 17:53:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: reboot.c,v 1.36 2008/07/20 01:20:23 lukem Exp $	*/
+/*	$NetBSD: reboot.c,v 1.37 2011/02/16 17:53:31 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)reboot.c	8.1 (Berkeley) 6/5/93";
 #else
-__RCSID("$NetBSD: reboot.c,v 1.36 2008/07/20 01:20:23 lukem Exp $");
+__RCSID("$NetBSD: reboot.c,v 1.37 2011/02/16 17:53:31 dyoung Exp $");
 #endif
 #endif /* not lint */
 
@@ -85,7 +85,7 @@
 	} else
 		howto = 0;
 	lflag = nflag = qflag = 0;
-	while ((ch = getopt(argc, argv, "dlnpq")) != -1)
+	while ((ch = getopt(argc, argv, "dlnpqvxz")) != -1)
 		switch(ch) {
 		case 'd':
 			howto |= RB_DUMP;
@@ -105,6 +105,15 @@
 		case 'q':
 			qflag = 1;
 			break;
+		case 'v':
+			howto |= AB_VERBOSE;
+			break;
+		case 'x':
+			howto |= AB_DEBUG;
+			break;
+		case 'z':
+			howto |= AB_SILENT;
+			break;
 		case '?':
 		default:
 			usage();

Index: src/sbin/shutdown/shutdown.8
diff -u src/sbin/shutdown/shutdown.8:1.28 src/sbin/shutdown/shutdown.8:1.29
--- src/sbin/shutdown/shutdown.8:1.28	Tue Oct 21 02:35:51 2008
+++ src/sbin/shutdown/shutdown.8	Wed Feb 16 17:53:31 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: shutdown.8,v 1.28 2008/10/21 02:35:51 lukem Exp $
+.\"	$NetBSD: shutdown.8,v 1.29 2011/02/16 17:53:31 dyoung Exp $
 .\"
 .\" Copyright (c) 1988, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)shutdown.8	8.2 (Berkeley) 4/27/95
 .\"
-.Dd October 21, 2008
+.Dd February 16, 2011
 .Dt SHUTDOWN 8
 .Os
 .Sh NAME
@@ -110,6 +110,27 @@
 .Ar time ,
 using
 .Xr reboot 8 .
+.It Fl v
+To enable verbose messages on the console, pass
+.Fl v
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
+.It Fl x
+To enable debugging messages on the console, pass
+.Fl x
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
+.It Fl z
+To silence some shutdown messages on the console, pass
+.Fl z
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
 .It Fl D
 Prevents
 .Nm

Index: src/sbin/shutdown/shutdown.c
diff -u src/sbin/shutdown/shutdown.c:1.52 src/sbin/shutdown/shutdown.c:1.53
--- src/sbin/shutdown/shutdown.c:1.52	Wed Jun  9 04:51:53 2010
+++ src/sbin/shutdown/shutdown.c	Wed Feb 16 17:53:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: shutdown.c,v 1.52 2010/06/09 04:51:53 riz Exp $	*/
+/*	$NetBSD: shutdown.c,v 1.53 2011/02/16 17:53:31 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)shutdown.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: shutdown.c,v 1.52 2010/06/09 04:51:53 riz Exp $");
+__RCSID("$NetBSD: shutdown.c,v 1.53 2011/02/16 17:53:31 dyoung Exp $");
 #endif
 #endif /* not lint */
 
@@ -91,6 +91,7 @@
 static int dofast, dohalt, doreboot, killflg, nofork, nosync, dodump;
 static size_t mbuflen;
 static int dopowerdown;
+static int dodebug, dosilent, doverbose;
 static const char *whom;
 static char mbuf[BUFSIZ];
 static char *bootstr;
@@ -120,7 +121,7 @@
 	if (geteuid())
 		errx(1, "%s: Not super-user", strerror(EPERM));
 #endif
-	while ((ch = getopt(argc, argv, "b:Ddfhknpr")) != -1)
+	while ((ch = getopt(argc, argv, "b:Ddfhknprvxz")) != -1)
 		switch (ch) {
 		case 'b':
 			bootstr = optarg;
@@ -149,6 +150,15 @@
 		case 'r':
 			doreboot = 1;
 			break;
+		case 'v':
+			doverbose = 1;
+			break;
+		case 'x':
+			dodebug = 1;
+			break;
+		case 'z':
+			dosilent = 1;
+			break;
 		case '?':
 		default:
 			usage();
@@ -370,7 +380,7 @@
 		doitfast();
 	dorcshutdown();
 	if (doreboot || dohalt) {
-		const char *args[16];
+		const char *args[20];
 		const char **arg, *path;
 #ifndef DEBUG
 		int serrno;
@@ -384,6 +394,12 @@
 			path = _PATH_HALT;
 			*arg++ = "halt";
 		}
+		if (doverbose)
+			*arg++ = "-v";
+		if (dodebug)
+			*arg++ = "-x";
+		if (dosilent)
+			*arg++ = "-z";
 		if (dodump)
 			*arg++ = "-d";
 		if (nosync)

Reply via email to