BSD 3 development
[unix-history] / .ref-BSD-2 / src / saveboottime.c
CommitLineData
ea69094f
BJ
1/* Copyright (c) 1979 Regents of the University of California */
2#include <utmp.h>
3
4struct utmp reboot;
5
6main()
7{
8
9 if (getuid())
10 exit(1);
11 close(1);
12 open("/usr/adm/wtmp", 1);
13 strcpy(reboot.ut_line, "tty~");
14 strcpy(reboot.ut_name, "reboot");
15 time(&reboot.ut_time);
16 lseek(1, (long) 0, 2);
17 write(1, (char *) &reboot, sizeof reboot);
18 exit(0);
19}