home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Distributions / ucb / spencer_2bsd.tar.gz / 2bsd.tar / src / saveboottime.c < prev    next >
C/C++ Source or Header  |  1980-02-17  |  351b  |  20 lines

  1. /* Copyright (c) 1979 Regents of the University of California */
  2. #include <utmp.h>
  3.  
  4. struct utmp reboot;
  5.  
  6. main()
  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. }
  20.