Annotation of 40BSD/cmd/halt.c, revision 1.1.1.1

1.1       root        1: static char *sccsid = "@(#)halt.c      4.2 (Berkeley) 11/10/80";
                      2: /*
                      3:  * Halt
                      4:  */
                      5: #include <stdio.h>
                      6: #include <sys/reboot.h>
                      7: 
                      8: main(argc, argv)
                      9:        int argc;
                     10:        char **argv;
                     11: {
                     12:        int howto;
                     13:        char *ttyn = (char *)ttyname(2);
                     14: 
                     15:        howto = RB_HALT;
                     16:        argc--, argv++;
                     17:        while (argc > 0) {
                     18:                if (!strcmp(*argv, "-n"))
                     19:                        howto |= RB_NOSYNC;
                     20:                else if (!strcmp(*argv, "-y"))
                     21:                        ttyn = 0;
                     22:                else {
                     23:                        fprintf(stderr, "usage: halt [ -n ]\n");
                     24:                        exit(1);
                     25:                }
                     26:                argc--, argv++;
                     27:        }
                     28:        if (ttyn && *(ttyn+strlen("/dev/tty")) == 'd') {
                     29:                fprintf(stderr, "halt: dangerous on a dialup; use ``halt -y'' if you are really sure\n");
                     30:                exit(1);
                     31:        }
                     32:        syscall(55, howto);
                     33:        perror("reboot");
                     34: }

unix.superglobalmegacorp.com

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