shutdown.c revision 1.11 1 1.11 mikel /* $NetBSD: shutdown.c,v 1.11 1997/01/23 05:48:06 mikel 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.11 mikel static char rcsid[] = "$NetBSD: shutdown.c,v 1.11 1997/01/23 05:48:06 mikel 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.11 mikel static int dofast, dohalt, doreboot, killflg, mbuflen, nosync;
93 1.11 mikel static char *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 readstdin = 0;
123 1.1 cgd while ((ch = getopt(argc, argv, "-fhknr")) != EOF)
124 1.1 cgd switch (ch) {
125 1.1 cgd case '-':
126 1.1 cgd readstdin = 1;
127 1.1 cgd break;
128 1.1 cgd case 'f':
129 1.1 cgd dofast = 1;
130 1.1 cgd break;
131 1.1 cgd case 'h':
132 1.1 cgd dohalt = 1;
133 1.1 cgd break;
134 1.1 cgd case 'k':
135 1.1 cgd killflg = 1;
136 1.1 cgd break;
137 1.1 cgd case 'n':
138 1.11 mikel nosync = 1;
139 1.1 cgd break;
140 1.1 cgd case 'r':
141 1.1 cgd doreboot = 1;
142 1.1 cgd break;
143 1.1 cgd case '?':
144 1.1 cgd default:
145 1.1 cgd usage();
146 1.1 cgd }
147 1.1 cgd argc -= optind;
148 1.1 cgd argv += optind;
149 1.1 cgd
150 1.1 cgd if (argc < 1)
151 1.1 cgd usage();
152 1.1 cgd
153 1.1 cgd if (dofast && nosync) {
154 1.1 cgd (void)fprintf(stderr,
155 1.1 cgd "shutdown: incompatible switches -f and -n.\n");
156 1.1 cgd usage();
157 1.1 cgd }
158 1.1 cgd if (doreboot && dohalt) {
159 1.1 cgd (void)fprintf(stderr,
160 1.1 cgd "shutdown: incompatible switches -h and -r.\n");
161 1.1 cgd usage();
162 1.1 cgd }
163 1.1 cgd getoffset(*argv++);
164 1.1 cgd
165 1.1 cgd if (*argv) {
166 1.1 cgd for (p = mbuf, len = sizeof(mbuf); *argv; ++argv) {
167 1.1 cgd arglen = strlen(*argv);
168 1.1 cgd if ((len -= arglen) <= 2)
169 1.1 cgd break;
170 1.1 cgd if (p != mbuf)
171 1.1 cgd *p++ = ' ';
172 1.8 mycroft memcpy(p, *argv, arglen);
173 1.1 cgd p += arglen;
174 1.1 cgd }
175 1.1 cgd *p = '\n';
176 1.1 cgd *++p = '\0';
177 1.1 cgd }
178 1.1 cgd
179 1.1 cgd if (readstdin) {
180 1.1 cgd p = mbuf;
181 1.1 cgd endp = mbuf + sizeof(mbuf) - 2;
182 1.1 cgd for (;;) {
183 1.1 cgd if (!fgets(p, endp - p + 1, stdin))
184 1.1 cgd break;
185 1.1 cgd for (; *p && p < endp; ++p);
186 1.1 cgd if (p == endp) {
187 1.1 cgd *p = '\n';
188 1.1 cgd *++p = '\0';
189 1.1 cgd break;
190 1.1 cgd }
191 1.1 cgd }
192 1.1 cgd }
193 1.1 cgd mbuflen = strlen(mbuf);
194 1.1 cgd
195 1.1 cgd if (offset)
196 1.1 cgd (void)printf("Shutdown at %.24s.\n", ctime(&shuttime));
197 1.1 cgd else
198 1.1 cgd (void)printf("Shutdown NOW!\n");
199 1.1 cgd
200 1.1 cgd if (!(whom = getlogin()))
201 1.1 cgd whom = (pw = getpwuid(getuid())) ? pw->pw_name : "???";
202 1.1 cgd
203 1.1 cgd #ifdef DEBUG
204 1.1 cgd (void)putc('\n', stdout);
205 1.1 cgd #else
206 1.1 cgd (void)setpriority(PRIO_PROCESS, 0, PRIO_MIN);
207 1.1 cgd {
208 1.1 cgd int forkpid;
209 1.1 cgd
210 1.1 cgd forkpid = fork();
211 1.1 cgd if (forkpid == -1) {
212 1.1 cgd perror("shutdown: fork");
213 1.1 cgd exit(1);
214 1.1 cgd }
215 1.1 cgd if (forkpid) {
216 1.1 cgd (void)printf("shutdown: [pid %d]\n", forkpid);
217 1.1 cgd exit(0);
218 1.1 cgd }
219 1.1 cgd }
220 1.1 cgd #endif
221 1.1 cgd openlog("shutdown", LOG_CONS, LOG_AUTH);
222 1.1 cgd loop();
223 1.7 mycroft /* NOTREACHED */
224 1.1 cgd }
225 1.1 cgd
226 1.7 mycroft void
227 1.1 cgd loop()
228 1.1 cgd {
229 1.7 mycroft struct interval *tp;
230 1.1 cgd u_int sltime;
231 1.1 cgd int logged;
232 1.1 cgd
233 1.1 cgd if (offset <= NOLOG_TIME) {
234 1.1 cgd logged = 1;
235 1.1 cgd nolog();
236 1.1 cgd }
237 1.1 cgd else
238 1.1 cgd logged = 0;
239 1.1 cgd tp = tlist;
240 1.1 cgd if (tp->timeleft < offset)
241 1.1 cgd (void)sleep((u_int)(offset - tp->timeleft));
242 1.1 cgd else {
243 1.1 cgd while (offset < tp->timeleft)
244 1.1 cgd ++tp;
245 1.1 cgd /*
246 1.7 mycroft * Warn now, if going to sleep more than a fifth of
247 1.1 cgd * the next wait time.
248 1.1 cgd */
249 1.1 cgd if (sltime = offset - tp->timeleft) {
250 1.1 cgd if (sltime > tp->timetowait / 5)
251 1.7 mycroft timewarn(offset);
252 1.1 cgd (void)sleep(sltime);
253 1.1 cgd }
254 1.1 cgd }
255 1.1 cgd for (;; ++tp) {
256 1.7 mycroft timewarn(tp->timeleft);
257 1.1 cgd if (!logged && tp->timeleft <= NOLOG_TIME) {
258 1.1 cgd logged = 1;
259 1.1 cgd nolog();
260 1.1 cgd }
261 1.1 cgd (void)sleep((u_int)tp->timetowait);
262 1.1 cgd if (!tp->timeleft)
263 1.1 cgd break;
264 1.1 cgd }
265 1.1 cgd die_you_gravy_sucking_pig_dog();
266 1.1 cgd }
267 1.1 cgd
268 1.1 cgd static jmp_buf alarmbuf;
269 1.1 cgd
270 1.7 mycroft void
271 1.7 mycroft timewarn(timeleft)
272 1.5 cgd int timeleft;
273 1.1 cgd {
274 1.1 cgd static int first;
275 1.1 cgd static char hostname[MAXHOSTNAMELEN + 1];
276 1.7 mycroft FILE *pf;
277 1.1 cgd char wcmd[MAXPATHLEN + 4];
278 1.1 cgd
279 1.1 cgd if (!first++)
280 1.1 cgd (void)gethostname(hostname, sizeof(hostname));
281 1.1 cgd
282 1.1 cgd /* undoc -n option to wall suppresses normal wall banner */
283 1.7 mycroft (void)snprintf(wcmd, sizeof(wcmd), "%s -n", _PATH_WALL);
284 1.1 cgd if (!(pf = popen(wcmd, "w"))) {
285 1.1 cgd syslog(LOG_ERR, "shutdown: can't find %s: %m", _PATH_WALL);
286 1.1 cgd return;
287 1.1 cgd }
288 1.1 cgd
289 1.1 cgd (void)fprintf(pf,
290 1.1 cgd "\007*** %sSystem shutdown message from %s@%s ***\007\n",
291 1.5 cgd timeleft ? "": "FINAL ", whom, hostname);
292 1.1 cgd
293 1.5 cgd if (timeleft > 10*60)
294 1.1 cgd (void)fprintf(pf, "System going down at %5.5s\n\n",
295 1.1 cgd ctime(&shuttime) + 11);
296 1.5 cgd else if (timeleft > 59)
297 1.1 cgd (void)fprintf(pf, "System going down in %d minute%s\n\n",
298 1.5 cgd timeleft / 60, (timeleft > 60) ? "s" : "");
299 1.5 cgd else if (timeleft)
300 1.1 cgd (void)fprintf(pf, "System going down in 30 seconds\n\n");
301 1.1 cgd else
302 1.1 cgd (void)fprintf(pf, "System going down IMMEDIATELY\n\n");
303 1.1 cgd
304 1.1 cgd if (mbuflen)
305 1.1 cgd (void)fwrite(mbuf, sizeof(*mbuf), mbuflen, pf);
306 1.1 cgd
307 1.1 cgd /*
308 1.1 cgd * play some games, just in case wall doesn't come back
309 1.1 cgd * probably unecessary, given that wall is careful.
310 1.1 cgd */
311 1.1 cgd if (!setjmp(alarmbuf)) {
312 1.1 cgd (void)signal(SIGALRM, timeout);
313 1.1 cgd (void)alarm((u_int)30);
314 1.1 cgd (void)pclose(pf);
315 1.1 cgd (void)alarm((u_int)0);
316 1.1 cgd (void)signal(SIGALRM, SIG_DFL);
317 1.1 cgd }
318 1.1 cgd }
319 1.1 cgd
320 1.1 cgd void
321 1.7 mycroft timeout(signo)
322 1.7 mycroft int signo;
323 1.1 cgd {
324 1.1 cgd longjmp(alarmbuf, 1);
325 1.1 cgd }
326 1.1 cgd
327 1.7 mycroft void
328 1.1 cgd die_you_gravy_sucking_pig_dog()
329 1.1 cgd {
330 1.1 cgd
331 1.1 cgd syslog(LOG_NOTICE, "%s by %s: %s",
332 1.1 cgd doreboot ? "reboot" : dohalt ? "halt" : "shutdown", whom, mbuf);
333 1.1 cgd (void)sleep(2);
334 1.1 cgd
335 1.1 cgd (void)printf("\r\nSystem shutdown time has arrived\007\007\r\n");
336 1.1 cgd if (killflg) {
337 1.1 cgd (void)printf("\rbut you'll have to do it yourself\r\n");
338 1.7 mycroft finish(0);
339 1.1 cgd }
340 1.1 cgd if (dofast)
341 1.1 cgd doitfast();
342 1.1 cgd #ifdef DEBUG
343 1.1 cgd if (doreboot)
344 1.1 cgd (void)printf("reboot");
345 1.1 cgd else if (dohalt)
346 1.1 cgd (void)printf("halt");
347 1.1 cgd if (nosync)
348 1.1 cgd (void)printf(" no sync");
349 1.1 cgd if (dofast)
350 1.1 cgd (void)printf(" no fsck");
351 1.1 cgd (void)printf("\nkill -HUP 1\n");
352 1.1 cgd #else
353 1.1 cgd if (doreboot) {
354 1.11 mikel execle(_PATH_REBOOT, "reboot", nosync ? "-ln" : "-l",
355 1.11 mikel (char *)0, (char **)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.11 mikel execle(_PATH_HALT, "halt", nosync ? "-ln" : "-l",
361 1.11 mikel (char *)0, (char **)0);
362 1.1 cgd syslog(LOG_ERR, "shutdown: can't exec %s: %m.", _PATH_HALT);
363 1.1 cgd perror("shutdown");
364 1.1 cgd }
365 1.1 cgd (void)kill(1, SIGTERM); /* to single user */
366 1.1 cgd #endif
367 1.7 mycroft finish(0);
368 1.1 cgd }
369 1.1 cgd
370 1.1 cgd #define ATOI2(p) (p[0] - '0') * 10 + (p[1] - '0'); p += 2;
371 1.1 cgd
372 1.7 mycroft void
373 1.1 cgd getoffset(timearg)
374 1.1 cgd register char *timearg;
375 1.1 cgd {
376 1.1 cgd register struct tm *lt;
377 1.1 cgd register char *p;
378 1.7 mycroft time_t now;
379 1.1 cgd
380 1.1 cgd if (!strcasecmp(timearg, "now")) { /* now */
381 1.1 cgd offset = 0;
382 1.1 cgd return;
383 1.1 cgd }
384 1.1 cgd
385 1.1 cgd (void)time(&now);
386 1.1 cgd if (*timearg == '+') { /* +minutes */
387 1.1 cgd if (!isdigit(*++timearg))
388 1.1 cgd badtime();
389 1.1 cgd offset = atoi(timearg) * 60;
390 1.1 cgd shuttime = now + offset;
391 1.1 cgd return;
392 1.1 cgd }
393 1.1 cgd
394 1.1 cgd /* handle hh:mm by getting rid of the colon */
395 1.1 cgd for (p = timearg; *p; ++p)
396 1.1 cgd if (!isascii(*p) || !isdigit(*p))
397 1.1 cgd if (*p == ':' && strlen(p) == 3) {
398 1.1 cgd p[0] = p[1];
399 1.1 cgd p[1] = p[2];
400 1.1 cgd p[2] = '\0';
401 1.1 cgd }
402 1.1 cgd else
403 1.1 cgd badtime();
404 1.1 cgd
405 1.1 cgd unsetenv("TZ"); /* OUR timezone */
406 1.1 cgd lt = localtime(&now); /* current time val */
407 1.1 cgd
408 1.1 cgd switch(strlen(timearg)) {
409 1.1 cgd case 10:
410 1.1 cgd lt->tm_year = ATOI2(timearg);
411 1.1 cgd /* FALLTHROUGH */
412 1.1 cgd case 8:
413 1.1 cgd lt->tm_mon = ATOI2(timearg);
414 1.1 cgd if (--lt->tm_mon < 0 || lt->tm_mon > 11)
415 1.1 cgd badtime();
416 1.1 cgd /* FALLTHROUGH */
417 1.1 cgd case 6:
418 1.1 cgd lt->tm_mday = ATOI2(timearg);
419 1.1 cgd if (lt->tm_mday < 1 || lt->tm_mday > 31)
420 1.1 cgd badtime();
421 1.1 cgd /* FALLTHROUGH */
422 1.1 cgd case 4:
423 1.1 cgd lt->tm_hour = ATOI2(timearg);
424 1.1 cgd if (lt->tm_hour < 0 || lt->tm_hour > 23)
425 1.1 cgd badtime();
426 1.1 cgd lt->tm_min = ATOI2(timearg);
427 1.1 cgd if (lt->tm_min < 0 || lt->tm_min > 59)
428 1.1 cgd badtime();
429 1.1 cgd lt->tm_sec = 0;
430 1.1 cgd if ((shuttime = mktime(lt)) == -1)
431 1.1 cgd badtime();
432 1.1 cgd if ((offset = shuttime - now) < 0) {
433 1.1 cgd (void)fprintf(stderr,
434 1.1 cgd "shutdown: that time is already past.\n");
435 1.1 cgd exit(1);
436 1.1 cgd }
437 1.1 cgd break;
438 1.1 cgd default:
439 1.1 cgd badtime();
440 1.1 cgd }
441 1.1 cgd }
442 1.1 cgd
443 1.1 cgd #define FSMSG "fastboot file for fsck\n"
444 1.7 mycroft void
445 1.1 cgd doitfast()
446 1.1 cgd {
447 1.1 cgd int fastfd;
448 1.1 cgd
449 1.1 cgd if ((fastfd = open(_PATH_FASTBOOT, O_WRONLY|O_CREAT|O_TRUNC,
450 1.1 cgd 0664)) >= 0) {
451 1.1 cgd (void)write(fastfd, FSMSG, sizeof(FSMSG) - 1);
452 1.1 cgd (void)close(fastfd);
453 1.1 cgd }
454 1.1 cgd }
455 1.1 cgd
456 1.1 cgd #define NOMSG "\n\nNO LOGINS: System going down at "
457 1.7 mycroft void
458 1.1 cgd nolog()
459 1.1 cgd {
460 1.1 cgd int logfd;
461 1.7 mycroft char *ct;
462 1.1 cgd
463 1.1 cgd (void)unlink(_PATH_NOLOGIN); /* in case linked to another file */
464 1.1 cgd (void)signal(SIGINT, finish);
465 1.1 cgd (void)signal(SIGHUP, finish);
466 1.1 cgd (void)signal(SIGQUIT, finish);
467 1.1 cgd (void)signal(SIGTERM, finish);
468 1.1 cgd if ((logfd = open(_PATH_NOLOGIN, O_WRONLY|O_CREAT|O_TRUNC,
469 1.1 cgd 0664)) >= 0) {
470 1.1 cgd (void)write(logfd, NOMSG, sizeof(NOMSG) - 1);
471 1.1 cgd ct = ctime(&shuttime);
472 1.1 cgd (void)write(logfd, ct + 11, 5);
473 1.1 cgd (void)write(logfd, "\n\n", 2);
474 1.1 cgd (void)write(logfd, mbuf, strlen(mbuf));
475 1.1 cgd (void)close(logfd);
476 1.1 cgd }
477 1.1 cgd }
478 1.1 cgd
479 1.1 cgd void
480 1.7 mycroft finish(signo)
481 1.7 mycroft int signo;
482 1.1 cgd {
483 1.6 mycroft if (!killflg)
484 1.6 mycroft (void)unlink(_PATH_NOLOGIN);
485 1.1 cgd exit(0);
486 1.1 cgd }
487 1.1 cgd
488 1.7 mycroft void
489 1.1 cgd badtime()
490 1.1 cgd {
491 1.1 cgd (void)fprintf(stderr, "shutdown: bad time format.\n");
492 1.1 cgd exit(1);
493 1.1 cgd }
494 1.1 cgd
495 1.7 mycroft void
496 1.1 cgd usage()
497 1.1 cgd {
498 1.1 cgd fprintf(stderr, "usage: shutdown [-fhknr] shutdowntime [ message ]\n");
499 1.1 cgd exit(1);
500 1.1 cgd }
501