Annotation of coherent/d/bin/lpr/lpskip.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Cause the line printer daemon to
                      3:  * skip the current listing.
                      4:  * With `-r' option, make it restart the
                      5:  * current listing.
                      6:  * SIGTRAP is used for skipping; SIGREST for restarting.
                      7:  * (NOTE: this should be setuid to daemon).
                      8:  */
                      9: 
                     10: #include <stdio.h>
                     11: #include <signal.h>
                     12: 
                     13: #ifdef LASER
                     14: char   lockfile[] = "/usr/spool/hpd/dpid";
                     15: #else
                     16: char   lockfile[] = "/usr/spool/lpd/dpid";
                     17: #endif
                     18: char *argv0;
                     19: 
                     20: main(argc, argv)
                     21: char *argv[];
                     22: {
                     23:        int pid;
                     24:        register int fd;
                     25:        register int sig = SIGTRAP;
                     26: 
                     27:        argv0 = argv[0];
                     28:        if (argc>1 && *argv[1]=='-') {
                     29:                if (argv[1][1]=='r' && argv[1][2]=='\0')
                     30:                        sig = SIGREST;
                     31:                else
                     32:                        usage();
                     33:        }
                     34:        if ((fd = open(lockfile, 0)) < 0
                     35:         || read(fd, &pid, sizeof pid) != sizeof (pid)
                     36:         || kill(pid, sig) < 0) {
                     37:                fprintf(stderr, "Line printer daemon not active\n");
                     38:                exit(1);
                     39:        }
                     40: }
                     41: 
                     42: usage()
                     43: {
                     44:        fprintf(stderr, "Usage: %s [-r]\n", argv0);
                     45:        exit(1);
                     46: }

unix.superglobalmegacorp.com

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