|
|
1.1 ! root 1: /* ! 2: * Submit an off-line print request ! 3: * Select the appropriate spooler for ! 4: * the specified printer location. ! 5: */ ! 6: ! 7: #include <stdio.h> ! 8: ! 9: struct dests { ! 10: char *d_name; ! 11: char *d_comm; ! 12: } dests[] = { ! 13: "-lp", "/bin/lpr", ! 14: "-vp", "/bin/vpr", ! 15: }; ! 16: ! 17: #define NDEST (sizeof(dests)/sizeof(dests[0])) ! 18: ! 19: main(argc, argv) ! 20: char *argv[]; ! 21: { ! 22: register struct dests *dp, *xdp; ! 23: ! 24: dp = dests; ! 25: if (argc>1 && *argv[1]=='-') ! 26: for (xdp = dests; xdp < &dests[NDEST]; xdp++) ! 27: if (strcmp(xdp->d_name, argv[1]) == 0) { ! 28: argc--; ! 29: argv++; ! 30: dp = xdp; ! 31: } ! 32: argv[0] = dp->d_comm; ! 33: execv(dp->d_comm, argv); ! 34: fprintf(stderr, "opr: %s unavailable\n", dp->d_name); ! 35: exit(1); ! 36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.