Annotation of 3BSD/cmd/kill.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * kill - send signal to process
                      3:  */
                      4: 
                      5: #include <signal.h>
                      6: 
                      7: main(argc, argv)
                      8: char **argv;
                      9: {
                     10:        register signo, pid, res;
                     11:        int errlev;
                     12:        extern char *sys_errlist[];
                     13:        extern errno;
                     14: 
                     15:        errlev = 0;
                     16:        if (argc <= 1) {
                     17:        usage:
                     18:                printf("usage: kill [ -signo ] pid ...\n");
                     19:                exit(2);
                     20:        }
                     21:        if (*argv[1] == '-') {
                     22:                signo = atoi(argv[1]+1);
                     23:                argc--;
                     24:                argv++;
                     25:        } else
                     26:                signo = SIGTERM;
                     27:        argv++;
                     28:        while (argc > 1) {
                     29:                if (**argv<'0' || **argv>'9')
                     30:                        goto usage;
                     31:                res = kill(pid = atoi(*argv), signo);
                     32:                if (res<0) {
                     33:                        printf("%u: %s\n", pid, sys_errlist[errno]);
                     34:                        errlev = 1;
                     35:                }
                     36:                argc--;
                     37:                argv++;
                     38:        }
                     39:        return(errlev);
                     40: }

unix.superglobalmegacorp.com

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