Index: sbin/shutdown/shutdown.8 =================================================================== --- sbin/shutdown/shutdown.8 (wersja 215409) +++ sbin/shutdown/shutdown.8 (kopia robocza) @@ -32,7 +32,8 @@ .Dt SHUTDOWN 8 .Os .Sh NAME -.Nm shutdown +.Nm shutdown , +.Nm poweroff .Nd "close down the system at a given time" .Sh SYNOPSIS .Nm @@ -47,6 +48,7 @@ .Oc .Ar time .Op Ar warning-message ... +.Nm poweroff .Sh DESCRIPTION The .Nm @@ -173,6 +175,13 @@ utility will place the system into single user mode at the .Ar time specified. +.Pp +Calling utility as +.Nm poweroff +is equivalent of calling: +.Bd -literal -offset indent +shutdown -p now +.Ed .Sh FILES .Bl -tag -width /var/run/nologin -compact .It Pa /var/run/nologin Index: sbin/shutdown/shutdown.c =================================================================== --- sbin/shutdown/shutdown.c (wersja 215409) +++ sbin/shutdown/shutdown.c (kopia robocza) @@ -115,8 +115,31 @@ if (geteuid()) errx(1, "NOT super-user"); #endif + nosync = NULL; readstdin = 0; + + /* + * Test for the special case where the utility is called as + * "poweroff", for which it runs 'shutdown -p now'. + */ + if ((p = rindex(argv[0], '/')) == NULL) + p = argv[0]; + else + ++p; + if (strcmp(p, "poweroff") == 0) { + if (getopt(argc, argv, "") != -1) + usage((char *)NULL); + argc -= optind; + argv += optind; + if (argc != 0) + usage((char *)NULL); + dopower = 1; + offset = 0; + (void)time(&shuttime); + goto poweroff; + } + while ((ch = getopt(argc, argv, "-hknopr")) != -1) switch (ch) { case '-': @@ -161,6 +184,7 @@ getoffset(*argv++); +poweroff: if (*argv) { for (p = mbuf, len = sizeof(mbuf); *argv; ++argv) { arglen = strlen(*argv); @@ -510,7 +534,7 @@ if (cp != NULL) warnx("%s", cp); (void)fprintf(stderr, - "usage: shutdown [-] [-h | -p | -r | -k] [-o [-n]]" - " time [warning-message ...]\n"); + "usage: shutdown [-] [-h | -p | -r | -k] [-o [-n]] time [warning-message ...]\n" + " poweroff\n"); exit(1); } Index: sbin/shutdown/Makefile =================================================================== --- sbin/shutdown/Makefile (wersja 215409) +++ sbin/shutdown/Makefile (kopia robocza) @@ -3,6 +3,8 @@ PROG= shutdown MAN= shutdown.8 +LINKS= ${BINDIR}/shutdown ${BINDIR}/poweroff +MLINKS= shutdown.8 poweroff.8 BINOWN= root BINGRP= operator