Annotation of coherent/b/etc/reboot.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Here is the source for fixed reboot.c - it needs to be linked with
        !             3:  * cohcall.o.
        !             4:  */
        !             5: /*
        !             6:  * reboot.c - command to reboot the system
        !             7:  *
        !             8:  * "-p" option prompts and will sync before rebooting.
        !             9:  *
        !            10:  * Revised: Fri May 14 08:57:34 1993 CDT
        !            11:  */
        !            12: 
        !            13: #include <stdio.h>
        !            14: #include <signal.h>
        !            15: #include <sys/param.h>
        !            16: 
        !            17: sigquiet(sig)
        !            18: int sig;
        !            19: {
        !            20:        signal(sig, sigquiet);
        !            21: }
        !            22: 
        !            23: main (argc, argv) int argc; char *argv[];
        !            24: {
        !            25:        char buf[80];
        !            26: 
        !            27:        if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'p') {
        !            28:                /* Prompt before reboot. */
        !            29:                printf("Hit <Enter> and your system will reboot automatically... ");
        !            30:                fflush(stdout);
        !            31:                sync();
        !            32:                fgets(buf, sizeof buf, stdin);
        !            33:        }
        !            34:                
        !            35:        /*
        !            36:         * Trap alarm signals.
        !            37:         */
        !            38:        signal(SIGALRM, sigquiet);
        !            39: 
        !            40:        /*
        !            41:         * Wait at least 4 seconds for drives to turn off, etc.
        !            42:         */
        !            43:        alarm(5);
        !            44:        pause();
        !            45: 
        !            46:        /*
        !            47:         * Reboot the processor.
        !            48:         */
        !            49:        if (cohcall(COH_REBOOT) == -1)
        !            50:                perror(argv[0]);
        !            51: 
        !            52:        /*
        !            53:         * Should never reach here.
        !            54:         */
        !            55:        exit(1);
        !            56: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.