shutdown.c revision 1.9 1 1.9 cgd /* $NetBSD: shutdown.c,v 1.9 1995/03/18 15:01:09 cgd Exp $ */
2 1.9 cgd
3 1.1 cgd /*
4 1.7 mycroft * Copyright (c) 1988, 1990, 1993
5 1.7 mycroft * The Regents of the University of California. All rights reserved.
6 1.1 cgd *
7 1.1 cgd * Redistribution and use in source and binary forms, with or without
8 1.1 cgd * modification, are permitted provided that the following conditions
9 1.1 cgd * are met:
10 1.1 cgd * 1. Redistributions of source code must retain the above copyright
11 1.1 cgd * notice, this list of conditions and the following disclaimer.
12 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 cgd * notice, this list of conditions and the following disclaimer in the
14 1.1 cgd * documentation and/or other materials provided with the distribution.
15 1.1 cgd * 3. All advertising materials mentioning features or use of this software
16 1.1 cgd * must display the following acknowledgement:
17 1.1 cgd * This product includes software developed by the University of
18 1.1 cgd * California, Berkeley and its contributors.
19 1.1 cgd * 4. Neither the name of the University nor the names of its contributors
20 1.1 cgd * may be used to endorse or promote products derived from this software
21 1.1 cgd * without specific prior written permission.
22 1.1 cgd *
23 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 cgd * SUCH DAMAGE.
34 1.1 cgd */
35 1.1 cgd
36 1.1 cgd #ifndef lint
37 1.7 mycroft static char copyright[] =
38 1.7 mycroft "@(#) Copyright (c) 1988, 1990, 1993\n\
39 1.7 mycroft The Regents of the University of California. All rights reserved.\n";
40 1.1 cgd #endif /* not lint */
41 1.1 cgd
42 1.1 cgd #ifndef lint
43 1.9 cgd #if 0
44 1.9 cgd static char sccsid[] = "@(#)shutdown.c 8.2 (Berkeley) 2/16/94";
45 1.9 cgd #else
46 1.9 cgd static char rcsid[] = "$NetBSD: shutdown.c,v 1.9 1995/03/18 15:01:09 cgd Exp $";
47 1.9 cgd #endif
48 1.1 cgd #endif /* not lint */
49 1.1 cgd
50 1.1 cgd #include <sys/param.h>
51 1.1 cgd #include <sys/time.h>
52 1.1 cgd #include <sys/resource.h>
53 1.1 cgd #include <sys/syslog.h>
54 1.7 mycroft
55 1.7 mycroft #include <ctype.h>
56 1.7 mycroft #include <fcntl.h>
57 1.7 mycroft #include <pwd.h>
58 1.1 cgd #include <setjmp.h>
59 1.7 mycroft #include <signal.h>
60 1.7 mycroft #include <stdio.h>
61 1.7 mycroft #include <stdlib.h>
62 1.7 mycroft #include <string.h>
63 1.1 cgd #include <tzfile.h>
64 1.7 mycroft #include <unistd.h>
65 1.7 mycroft
66 1.1 cgd #include "pathnames.h"
67 1.1 cgd
68 1.1 cgd #ifdef DEBUG
69 1.1 cgd #undef _PATH_NOLOGIN
70 1.1 cgd #define _PATH_NOLOGIN "./nologin"
71 1.1 cgd #undef _PATH_FASTBOOT
72 1.1 cgd #define _PATH_FASTBOOT "./fastboot"
73 1.1 cgd #endif
74 1.1 cgd
75 1.1 cgd #define H *60*60
76 1.1 cgd #define M *60
77 1.1 cgd #define S *1
78 1.1 cgd #define NOLOG_TIME 5*60
79 1.1 cgd struct interval {
80 1.1 cgd int timeleft, timetowait;
81 1.1 cgd } tlist[] = {
82 1.1 cgd 10 H, 5 H, 5 H, 3 H, 2 H, 1 H, 1 H, 30 M,
83 1.1 cgd 30 M, 10 M, 20 M, 10 M, 10 M, 5 M, 5 M, 3 M,
84 1.1 cgd 2 M, 1 M, 1 M, 30 S, 30 S, 30 S,
85 1.1 cgd 0, 0,
86 1.7 mycroft };
87 1.1 cgd #undef H
88 1.1 cgd #undef M
89 1.1 cgd #undef S
90 1.1 cgd
91 1.1 cgd static time_t offset, shuttime;
92 1.1 cgd static int dofast, dohalt, doreboot, killflg, mbuflen;
93 1.1 cgd static char *nosync, *whom, mbuf[BUFSIZ];
94 1.1 cgd
95 1.7 mycroft void badtime __P((void));
96 1.7 mycroft void die_you_gravy_sucking_pig_dog __P((void));
97 1.7 mycroft void doitfast __P((void));
98 1.7 mycroft void finish __P((int));
99 1.7 mycroft void getoffset __P((char *));
100 1.7 mycroft void loop __P((void));
101 1.7 mycroft void nolog __P((void));
102 1.7 mycroft void timeout __P((int));
103 1.7 mycroft void timewarn __P((int));
104 1.7 mycroft void usage __P((void));
105 1.5 cgd
106 1.7 mycroft int
107 1.1 cgd main(argc, argv)
108 1.1 cgd int argc;
109 1.7 mycroft char *argv[];
110 1.1 cgd {
111 1.1 cgd extern int optind;
112 1.1 cgd register char *p, *endp;
113 1.7 mycroft struct passwd *pw;
114 1.1 cgd int arglen, ch, len, readstdin;
115 1.1 cgd
116 1.1 cgd #ifndef DEBUG
117 1.1 cgd if (geteuid()) {
118 1.1 cgd (void)fprintf(stderr, "shutdown: NOT super-user\n");
119 1.1 cgd exit(1);
120 1.1 cgd }
121 1.1 cgd #endif
122 1.1 cgd nosync = NULL;
123 1.1 cgd readstdin = 0;
124 1.1 cgd while ((ch = getopt(argc, argv, "-fhknr")) != EOF)
125 1.1 cgd switch (ch) {
126 1.1 cgd case '-':
127 1.1 cgd readstdin = 1;
128 1.1 cgd break;
129 1.1 cgd case 'f':
130 1.1 cgd dofast = 1;
131 1.1 cgd break;
132 1.1 cgd case 'h':
133 1.1 cgd dohalt = 1;
134 1.1 cgd break;
135 1.1 cgd case 'k':
136 1.1 cgd killflg = 1;
137 1.1 cgd break;
138 1.1 cgd case 'n':
139 1.1 cgd nosync = "-n";
140 1.1 cgd break;
141 1.1 cgd case 'r':
142 1.1 cgd doreboot = 1;
143 1.1 cgd break;
144 1.1 cgd case '?':
145 1.1 cgd default:
146 1.1 cgd usage();
147 1.1 cgd }
148 1.1 cgd argc -= optind;
149 1.1 cgd argv += optind;
150 1.1 cgd
151 1.1 cgd if (argc < 1)
152 1.1 cgd usage();
153 1.1 cgd
154 1.1 cgd if (dofast && nosync) {
155 1.1 cgd (void)fprintf(stderr,
156 1.1 cgd "shutdown: incompatible switches -f and -n.\n");
157 1.1 cgd usage();
158 1.1 cgd }
159 1.1 cgd if (doreboot && dohalt) {
160 1.1 cgd (void)fprintf(stderr,
161 1.1 cgd "shutdown: incompatible switches -h and -r.\n");
162 1.1 cgd usage();
163 1.1 cgd }
164 1.1 cgd getoffset(*argv++);
165 1.1 cgd
166 1.1 cgd if (*argv) {
167 1.1 cgd for (p = mbuf, len = sizeof(mbuf); *argv; ++argv) {
168 1.1 cgd arglen = strlen(*argv);
169 1.1 cgd if ((len -= arglen) <= 2)
170 1.1 cgd break;
171 1.1 cgd if (p != mbuf)
172 1.1 cgd *p++ = ' ';
173 1.8 mycroft memcpy(p, *argv, arglen);
174 1.1 cgd p += arglen;
175 1.1 cgd }
176 1.1 cgd *p = '\n';
177 1.1 cgd *++p = '\0';
178 1.1 cgd }
179 1.1 cgd
180 1.1 cgd if (readstdin) {
181 1.1 cgd p = mbuf;
182 1.1 cgd endp = mbuf + sizeof(mbuf) - 2;
183 1.1 cgd for (;;) {
184 1.1 cgd if (!fgets(p, endp - p + 1, stdin))
185 1.1 cgd break;
186 1.1 cgd for (; *p && p < endp; ++p);
187 1.1 cgd if (p == endp) {
188 1.1 cgd *p = '\n';
189 1.1 cgd *++p = '\0';
190 1.1 cgd break;
191 1.1 cgd }
192 1.1 cgd }
193 1.1 cgd }
194 1.1 cgd mbuflen = strlen(mbuf);
195 1.1 cgd
196 1.1 cgd if (offset)
197 1.1 cgd (void)printf("Shutdown at %.24s.\n", ctime(&shuttime));
198 1.1 cgd else
199 1.1 cgd (void)printf("Shutdown NOW!\n");
200 1.1 cgd
201 1.1 cgd if (!(whom = getlogin()))
202 1.1 cgd whom = (pw = getpwuid(getuid())) ? pw->pw_name : "???";
203 1.1 cgd
204 1.1 cgd #ifdef DEBUG
205 1.1 cgd (void)putc('\n', stdout);
206 1.1 cgd #else
207 1.1 cgd (void)setpriority(PRIO_PROCESS, 0, PRIO_MIN);
208 1.1 cgd {
209 1.1 cgd int forkpid;
210 1.1 cgd
211 1.1 cgd forkpid = fork();
212 1.1 cgd if (forkpid == -1) {
213 1.1 cgd perror("shutdown: fork");
214 1.1 cgd exit(1);
215 1.1 cgd }
216 1.1 cgd if (forkpid) {
217 1.1 cgd (void)printf("shutdown: [pid %d]\n", forkpid);
218 1.1 cgd exit(0);
219 1.1 cgd }
220 1.1 cgd }
221 1.1 cgd #endif
222 1.1 cgd openlog("shutdown", LOG_CONS, LOG_AUTH);
223 1.1 cgd loop();
224 1.7 mycroft /* NOTREACHED */
225 1.1 cgd }
226 1.1 cgd
227 1.7 mycroft void
228 1.1 cgd loop()
229 1.1 cgd {
230 1.7 mycroft struct interval *tp;
231 1.1 cgd u_int sltime;
232 1.1 cgd int logged;
233 1.1 cgd
234 1.1 cgd if (offset <= NOLOG_TIME) {
235 1.1 cgd logged = 1;
236 1.1 cgd nolog();
237 1.1 cgd }
238 1.1 cgd else
239 1.1 cgd logged = 0;
240 1.1 cgd tp = tlist;
241 1.1 cgd if (tp->timeleft < offset)
242 1.1 cgd (void)sleep((u_int)(offset - tp->timeleft));
243 1.1 cgd else {
244 1.1 cgd while (offset < tp->timeleft)
245 1.1 cgd ++tp;
246 1.1 cgd /*
247 1.7 mycroft * Warn now, if going to sleep more than a fifth of
248 1.1 cgd * the next wait time.
249 1.1 cgd */
250 1.1 cgd if (sltime = offset - tp->timeleft) {
251 1.1 cgd if (sltime > tp->timetowait / 5)
252 1.7 mycroft timewarn(offset);
253 1.1 cgd (void)sleep(sltime);
254 1.1 cgd }
255 1.1 cgd }
256 1.1 cgd for (;; ++tp) {
257 1.7 mycroft timewarn(tp->timeleft);
258 1.1 cgd if (!logged && tp->timeleft <= NOLOG_TIME) {
259 1.1 cgd logged = 1;
260 1.1 cgd nolog();
261 1.1 cgd }
262 1.1 cgd (void)sleep((u_int)tp->timetowait);
263 1.1 cgd if (!tp->timeleft)
264 1.1 cgd break;
265 1.1 cgd }
266 1.1 cgd die_you_gravy_sucking_pig_dog();
267 1.1 cgd }
268 1.1 cgd
269 1.1 cgd static jmp_buf alarmbuf;
270 1.1 cgd
271 1.7 mycroft void
272 1.7 mycroft timewarn(timeleft)
273 1.5 cgd int timeleft;
274 1.1 cgd {
275 1.1 cgd static int first;
276 1.1 cgd static char hostname[MAXHOSTNAMELEN + 1];
277 1.7 mycroft FILE *pf;
278 1.1 cgd char wcmd[MAXPATHLEN + 4];
279 1.1 cgd
280 1.1 cgd if (!first++)
281 1.1 cgd (void)gethostname(hostname, sizeof(hostname));
282 1.1 cgd
283 1.1 cgd /* undoc -n option to wall suppresses normal wall banner */
284 1.7 mycroft (void)snprintf(wcmd, sizeof(wcmd), "%s -n", _PATH_WALL);
285 1.1 cgd if (!(pf = popen(wcmd, "w"))) {
286 1.1 cgd syslog(LOG_ERR, "shutdown: can't find %s: %m", _PATH_WALL);
287 1.1 cgd return;
288 1.1 cgd }
289 1.1 cgd
290 1.1 cgd (void)fprintf(pf,
291 1.1 cgd "\007*** %sSystem shutdown message from %s@%s ***\007\n",
292 1.5 cgd timeleft ? "": "FINAL ", whom, hostname);
293 1.1 cgd
294 1.5 cgd if (timeleft > 10*60)
295 1.1 cgd (void)fprintf(pf, "System going down at %5.5s\n\n",
296 1.1 cgd ctime(&shuttime) + 11);
297 1.5 cgd else if (timeleft > 59)
298 1.1 cgd (void)fprintf(pf, "System going down in %d minute%s\n\n",
299 1.5 cgd timeleft / 60, (timeleft > 60) ? "s" : "");
300 1.5 cgd else if (timeleft)
301 1.1 cgd (void)fprintf(pf, "System going down in 30 seconds\n\n");
302 1.1 cgd else
303 1.1 cgd (void)fprintf(pf, "System going down IMMEDIATELY\n\n");
304 1.1 cgd
305 1.1 cgd if (mbuflen)
306 1.1 cgd (void)fwrite(mbuf, sizeof(*mbuf), mbuflen, pf);
307 1.1 cgd
308 1.1 cgd /*
309 1.1 cgd * play some games, just in case wall doesn't come back
310 1.1 cgd * probably unecessary, given that wall is careful.
311 1.1 cgd */
312 1.1 cgd if (!setjmp(alarmbuf)) {
313 1.1 cgd (void)signal(SIGALRM, timeout);
314 1.1 cgd (void)alarm((u_int)30);
315 1.1 cgd (void)pclose(pf);
316 1.1 cgd (void)alarm((u_int)0);
317 1.1 cgd (void)signal(SIGALRM, SIG_DFL);
318 1.1 cgd }
319 1.1 cgd }
320 1.1 cgd
321 1.1 cgd void
322 1.7 mycroft timeout(signo)
323 1.7 mycroft int signo;
324 1.1 cgd {
325 1.1 cgd longjmp(alarmbuf, 1);
326 1.1 cgd }
327 1.1 cgd
328 1.7 mycroft void
329 1.1 cgd die_you_gravy_sucking_pig_dog()
330 1.1 cgd {
331 1.1 cgd
332 1.1 cgd syslog(LOG_NOTICE, "%s by %s: %s",
333 1.1 cgd doreboot ? "reboot" : dohalt ? "halt" : "shutdown", whom, mbuf);
334 1.1 cgd (void)sleep(2);
335 1.1 cgd
336 1.1 cgd (void)printf("\r\nSystem shutdown time has arrived\007\007\r\n");
337 1.1 cgd if (killflg) {
338 1.1 cgd (void)printf("\rbut you'll have to do it yourself\r\n");
339 1.7 mycroft finish(0);
340 1.1 cgd }
341 1.1 cgd if (dofast)
342 1.1 cgd doitfast();
343 1.1 cgd #ifdef DEBUG
344 1.1 cgd if (doreboot)
345 1.1 cgd (void)printf("reboot");
346 1.1 cgd else if (dohalt)
347 1.1 cgd (void)printf("halt");
348 1.1 cgd if (nosync)
349 1.1 cgd (void)printf(" no sync");
350 1.1 cgd if (dofast)
351 1.1 cgd (void)printf(" no fsck");
352 1.1 cgd (void)printf("\nkill -HUP 1\n");
353 1.1 cgd #else
354 1.1 cgd if (doreboot) {
355 1.1 cgd execle(_PATH_REBOOT, "reboot", "-l", nosync, 0);
356 1.1 cgd syslog(LOG_ERR, "shutdown: can't exec %s: %m.", _PATH_REBOOT);
357 1.1 cgd perror("shutdown");
358 1.1 cgd }
359 1.1 cgd else if (dohalt) {
360 1.1 cgd execle(_PATH_HALT, "halt", "-l", nosync, 0);
361 1.1 cgd syslog(LOG_ERR, "shutdown: can't exec %s: %m.", _PATH_HALT);
362 1.1 cgd perror("shutdown");
363 1.1 cgd }
364 1.1 cgd (void)kill(1, SIGTERM); /* to single user */
365 1.1 cgd #endif
366 1.7 mycroft finish(0);
367 1.1 cgd }
368 1.1 cgd
369 1.1 cgd #define ATOI2(p) (p[0] - '0') * 10 + (p[1] - '0'); p += 2;
370 1.1 cgd
371 1.7 mycroft void
372 1.1 cgd getoffset(timearg)
373 1.1 cgd register char *timearg;
374 1.1 cgd {
375 1.1 cgd register struct tm *lt;
376 1.1 cgd register char *p;
377 1.7 mycroft time_t now;
378 1.1 cgd
379 1.1 cgd if (!strcasecmp(timearg, "now")) { /* now */
380 1.1 cgd offset = 0;
381 1.1 cgd return;
382 1.1 cgd }
383 1.1 cgd
384 1.1 cgd (void)time(&now);
385 1.1 cgd if (*timearg == '+') { /* +minutes */
386 1.1 cgd if (!isdigit(*++timearg))
387 1.1 cgd badtime();
388 1.1 cgd offset = atoi(timearg) * 60;
389 1.1 cgd shuttime = now + offset;
390 1.1 cgd return;
391 1.1 cgd }
392 1.1 cgd
393 1.1 cgd /* handle hh:mm by getting rid of the colon */
394 1.1 cgd for (p = timearg; *p; ++p)
395 1.1 cgd if (!isascii(*p) || !isdigit(*p))
396 1.1 cgd if (*p == ':' && strlen(p) == 3) {
397 1.1 cgd p[0] = p[1];
398 1.1 cgd p[1] = p[2];
399 1.1 cgd p[2] = '\0';
400 1.1 cgd }
401 1.1 cgd else
402 1.1 cgd badtime();
403 1.1 cgd
404 1.1 cgd unsetenv("TZ"); /* OUR timezone */
405 1.1 cgd lt = localtime(&now); /* current time val */
406 1.1 cgd
407 1.1 cgd switch(strlen(timearg)) {
408 1.1 cgd case 10:
409 1.1 cgd lt->tm_year = ATOI2(timearg);
410 1.1 cgd /* FALLTHROUGH */
411 1.1 cgd case 8:
412 1.1 cgd lt->tm_mon = ATOI2(timearg);
413 1.1 cgd if (--lt->tm_mon < 0 || lt->tm_mon > 11)
414 1.1 cgd badtime();
415 1.1 cgd /* FALLTHROUGH */
416 1.1 cgd case 6:
417 1.1 cgd lt->tm_mday = ATOI2(timearg);
418 1.1 cgd if (lt->tm_mday < 1 || lt->tm_mday > 31)
419 1.1 cgd badtime();
420 1.1 cgd /* FALLTHROUGH */
421 1.1 cgd case 4:
422 1.1 cgd lt->tm_hour = ATOI2(timearg);
423 1.1 cgd if (lt->tm_hour < 0 || lt->tm_hour > 23)
424 1.1 cgd badtime();
425 1.1 cgd lt->tm_min = ATOI2(timearg);
426 1.1 cgd if (lt->tm_min < 0 || lt->tm_min > 59)
427 1.1 cgd badtime();
428 1.1 cgd lt->tm_sec = 0;
429 1.1 cgd if ((shuttime = mktime(lt)) == -1)
430 1.1 cgd badtime();
431 1.1 cgd if ((offset = shuttime - now) < 0) {
432 1.1 cgd (void)fprintf(stderr,
433 1.1 cgd "shutdown: that time is already past.\n");
434 1.1 cgd exit(1);
435 1.1 cgd }
436 1.1 cgd break;
437 1.1 cgd default:
438 1.1 cgd badtime();
439 1.1 cgd }
440 1.1 cgd }
441 1.1 cgd
442 1.1 cgd #define FSMSG "fastboot file for fsck\n"
443 1.7 mycroft void
444 1.1 cgd doitfast()
445 1.1 cgd {
446 1.1 cgd int fastfd;
447 1.1 cgd
448 1.1 cgd if ((fastfd = open(_PATH_FASTBOOT, O_WRONLY|O_CREAT|O_TRUNC,
449 1.1 cgd 0664)) >= 0) {
450 1.1 cgd (void)write(fastfd, FSMSG, sizeof(FSMSG) - 1);
451 1.1 cgd (void)close(fastfd);
452 1.1 cgd }
453 1.1 cgd }
454 1.1 cgd
455 1.1 cgd #define NOMSG "\n\nNO LOGINS: System going down at "
456 1.7 mycroft void
457 1.1 cgd nolog()
458 1.1 cgd {
459 1.1 cgd int logfd;
460 1.7 mycroft char *ct;
461 1.1 cgd
462 1.1 cgd (void)unlink(_PATH_NOLOGIN); /* in case linked to another file */
463 1.1 cgd (void)signal(SIGINT, finish);
464 1.1 cgd (void)signal(SIGHUP, finish);
465 1.1 cgd (void)signal(SIGQUIT, finish);
466 1.1 cgd (void)signal(SIGTERM, finish);
467 1.1 cgd if ((logfd = open(_PATH_NOLOGIN, O_WRONLY|O_CREAT|O_TRUNC,
468 1.1 cgd 0664)) >= 0) {
469 1.1 cgd (void)write(logfd, NOMSG, sizeof(NOMSG) - 1);
470 1.1 cgd ct = ctime(&shuttime);
471 1.1 cgd (void)write(logfd, ct + 11, 5);
472 1.1 cgd (void)write(logfd, "\n\n", 2);
473 1.1 cgd (void)write(logfd, mbuf, strlen(mbuf));
474 1.1 cgd (void)close(logfd);
475 1.1 cgd }
476 1.1 cgd }
477 1.1 cgd
478 1.1 cgd void
479 1.7 mycroft finish(signo)
480 1.7 mycroft int signo;
481 1.1 cgd {
482 1.6 mycroft if (!killflg)
483 1.6 mycroft (void)unlink(_PATH_NOLOGIN);
484 1.1 cgd exit(0);
485 1.1 cgd }
486 1.1 cgd
487 1.7 mycroft void
488 1.1 cgd badtime()
489 1.1 cgd {
490 1.1 cgd (void)fprintf(stderr, "shutdown: bad time format.\n");
491 1.1 cgd exit(1);
492 1.1 cgd }
493 1.1 cgd
494 1.7 mycroft void
495 1.1 cgd usage()
496 1.1 cgd {
497 1.1 cgd fprintf(stderr, "usage: shutdown [-fhknr] shutdowntime [ message ]\n");
498 1.1 cgd exit(1);
499 1.1 cgd }
500