Mark Kettenis: > I'm fine with makeing "shutdown -p" equivalent to "shutdown -hp", but > I don't see why we have to break the latter.
Due to overwhelming demand, "shutdown -hp" is now still accepted in place of "shutdown -p". ok? Index: shutdown.8 =================================================================== RCS file: /cvs/src/sbin/shutdown/shutdown.8,v retrieving revision 1.39 diff -u -p -r1.39 shutdown.8 --- shutdown.8 19 Nov 2007 08:51:49 -0000 1.39 +++ shutdown.8 20 Jan 2015 22:13:36 -0000 @@ -58,7 +58,8 @@ The options are as follows: .Bl -tag -width Ds .It Fl d When used with -.Fl h +.Fl h , +.Fl p , or .Fl r causes system to perform a dump. @@ -93,13 +94,16 @@ does not actually halt the system, but l system multi-user with logins disabled (for all but superuser). .It Fl n When used with -.Fl h +.Fl h , +.Fl p , or .Fl r prevents the normal .Xr sync 2 before stopping the system. .It Fl p +The system is powered down at the specified +.Ar time . The .Fl p flag is passed on to Index: shutdown.c =================================================================== RCS file: /cvs/src/sbin/shutdown/shutdown.c,v retrieving revision 1.38 diff -u -p -r1.38 shutdown.c --- shutdown.c 16 Jan 2015 06:40:01 -0000 1.38 +++ shutdown.c 20 Jan 2015 22:08:31 -0000 @@ -158,9 +158,9 @@ main(int argc, char *argv[]) "shutdown: incompatible switches -h and -r.\n"); usage(); } - if (dopower && !dohalt) { + if (doreboot && dopower) { (void)fprintf(stderr, - "shutdown: switch -p must be used with -h.\n"); + "shutdown: incompatible switches -p and -r.\n"); usage(); } getoffset(*argv++); @@ -333,7 +333,8 @@ die_you_gravy_sucking_pig_dog(void) { syslog(LOG_NOTICE, "%s by %s: %s", - doreboot ? "reboot" : dohalt ? "halt" : "shutdown", whom, mbuf); + doreboot ? "reboot" : dopower ? "power-down" : dohalt ? "halt" : + "shutdown", whom, mbuf); (void)sleep(2); (void)printf("\r\nSystem shutdown time has arrived\007\007\r\n"); @@ -346,6 +347,8 @@ die_you_gravy_sucking_pig_dog(void) #ifdef DEBUG if (doreboot) (void)printf("reboot"); + else if (dopower) + (void)printf("power-down"); else if (dohalt) (void)printf("halt"); if (nosync) @@ -363,7 +366,7 @@ die_you_gravy_sucking_pig_dog(void) syslog(LOG_ERR, "shutdown: can't exec %s: %m.", _PATH_REBOOT); warn(_PATH_REBOOT); } - else if (dohalt) { + else if (dohalt || dopower) { execle(_PATH_HALT, "halt", "-l", (dopower ? "-p" : (nosync ? "-n" : (dodump ? "-d" : NULL))), (nosync ? "-n" : (dodump ? "-d" : NULL)), @@ -546,6 +549,7 @@ badtime(void) void usage(void) { - fprintf(stderr, "usage: shutdown [-] [-dfhknpr] time [warning-message ...]\n"); + fprintf(stderr, + "usage: shutdown [-] [-dfhknpr] time [warning-message ...]\n"); exit(1); } -- Christian "naddy" Weisgerber na...@mips.inka.de