|
|
1.1 ! root 1: /* ! 2: * Reboot the processor by transferring to the reset vector of the 8088. ! 3: * ! 4: * $Log: /usr/src.inetco/etc/reboot.c,v $ ! 5: * Revision 1.3 90/04/17 14:56:54 root ! 6: * steve 4/17/90 ! 7: * Added sync() after prompt with -p option. ! 8: * ! 9: * Revision 1.2 90/04/17 14:48:29 root ! 10: * steve 4/17/90 ! 11: * Added "-p" option to prompt user to hit <Enter> before rebooting, ! 12: * for use during installation. ! 13: * ! 14: * Revision 1.1 90/04/17 14:34:11 root ! 15: * Initial revision ! 16: * ! 17: * 86/12/19 Allan Cornish /usr/src/cmd/etc/reboot.c ! 18: * reboot.s converted into reboot.c and rebootas.s to provide time for ! 19: * disk drives to turn off before initiating reboot. ! 20: */ ! 21: ! 22: #include <stdio.h> ! 23: #include <signal.h> ! 24: ! 25: sigquiet( sig ) ! 26: int sig; ! 27: { ! 28: signal( sig, sigquiet ); ! 29: } ! 30: ! 31: main (argc, argv) int argc; char *argv[]; ! 32: { ! 33: char buf[80]; ! 34: ! 35: if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'p') { ! 36: /* Prompt before reboot. */ ! 37: printf("Hit <Enter> and your system will reboot automatically... "); ! 38: fflush(stdout); ! 39: sync(); ! 40: fgets(buf, sizeof buf, stdin); ! 41: } ! 42: ! 43: /* ! 44: * Trap alarm signals. ! 45: */ ! 46: signal( SIGALRM, sigquiet ); ! 47: ! 48: /* ! 49: * Wait at least 4 seconds for drives to turn off, etc. ! 50: */ ! 51: alarm( 5 ); ! 52: pause(); ! 53: ! 54: /* ! 55: * Reboot the processor. ! 56: */ ! 57: reboot(); ! 58: ! 59: /* ! 60: * Should never reach here. ! 61: */ ! 62: exit(1); ! 63: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.