|
|
1.1 ! root 1: lpr.c: ! 2: 2,3 c 2,5 ! 3: < * Submit a listing to the local line ! 4: < * printer spooler. ! 5: --- ! 6: > * lpr.c ! 7: > * 12/13/90 ! 8: > * Submit a listing to the line printer spooler. ! 9: > * This source produces both lpr and (compiled -DLASER) hpr. ! 10: 9 d 10 ! 11: < #ifndef TYPES_H ! 12: 11 d 11 ! 13: < #endif ! 14: 12 a 13,18 ! 15: > #ifdef LASER ! 16: > #define USAGE "Usage: %s [-Bcemnr] [-b banner] [-f fontnum] [file ...]\n" ! 17: > #else ! 18: > #define USAGE "Usage: %s [-Bcmnr] [-b banner] [file ...]\n" ! 19: > #endif ! 20: > ! 21: 26 c 32 ! 22: < #ifdef LASER ! 23: --- ! 24: > #ifdef LASER ! 25: 33 c 39 ! 26: < char tmb[] = "Too many banners, `%s' ignored"; ! 27: --- ! 28: > char tmb[] = "too many banners, '%s' ignored"; ! 29: 40 a 47,51 ! 30: > #ifdef LASER ! 31: > int eflag; /* Erase existing fonts */ ! 32: > int fflag; /* Load new fonts */ ! 33: > int fontindex; /* Current font index */ ! 34: > #endif ! 35: 42 c 53,58 ! 36: < long unique(); ! 37: --- ! 38: > extern char *ctime(); ! 39: > extern char *getenv(); ! 40: > extern char *getlogin(); ! 41: > extern char *getwd(); ! 42: > extern time_t time(); ! 43: > ! 44: 44,46 c 60,61 ! 45: < char *getwd(); ! 46: < char *ctime(); ! 47: < char *getlogin(); ! 48: --- ! 49: > void lpr(); ! 50: > void lprinit(); ! 51: 47 a 63 ! 52: > long unique(); ! 53: 49,50 c 65 ! 54: < main(argc, argv) ! 55: < char *argv[]; ! 56: --- ! 57: > main(argc, argv) int argc; char *argv[]; ! 58: 69 c 84 ! 59: < lperr("Missing banner"); ! 60: --- ! 61: > lperr("missing banner"); ! 62: 79 a 95,107 ! 63: > #ifdef LASER ! 64: > case 'e': ! 65: > eflag = 1; ! 66: > break; ! 67: > ! 68: > case 'f': ! 69: > Bflag = fflag = 1; /* -f forces -B */ ! 70: > if (++i >= argc) ! 71: > lperr("missing font index"); ! 72: > else ! 73: > fontindex = atoi(argv[i]); ! 74: > break; ! 75: > #endif ! 76: 96 a 125,128 ! 77: > #ifdef LASER ! 78: > if (eflag) ! 79: > fprintf(cfp, "E\n"); ! 80: > #endif ! 81: 99 c 131 ! 82: < for (j=i; j<argc; j++) ! 83: --- ! 84: > for (j = i; j < argc; j++) ! 85: 104 c 136 ! 86: < for (j=0; j<banno; j++) ! 87: --- ! 88: > for (j = 0; j < banno; j++) ! 89: 116 c 148 ! 90: < lperr("Cannot find daemon `%s'", lpd); ! 91: --- ! 92: > lperr("cannot find daemon '%s'", lpd); ! 93: 123,124 c 155,156 ! 94: < lprinit(ac, av) ! 95: < char **av; ! 96: --- ! 97: > void ! 98: > lprinit(ac, av) int ac; char **av; ! 99: 126 c 158 ! 100: < time_t time(), xtime; ! 101: --- ! 102: > time_t xtime; ! 103: 134 c 166 ! 104: < lperr("bad directory `%s'", spooldir); ! 105: --- ! 106: > lperr("bad directory '%s'", spooldir); ! 107: 163 c 195 ! 108: < * The NULL `file' is stdin. ! 109: --- ! 110: > * The NULL 'file' is stdin. ! 111: 165,166 c 197,198 ! 112: < lpr(file) ! 113: < char *file; ! 114: --- ! 115: > void ! 116: > lpr(file) char *file; ! 117: 180 c 212,218 ! 118: < fprintf(cfp, "A%s\nU%s\n", dfname, dfname); ! 119: --- ! 120: > #ifdef LASER ! 121: > if (fflag) ! 122: > fprintf(cfp, "F%s %d\n", dfname, fontindex++); ! 123: > else ! 124: > #endif ! 125: > fprintf(cfp, "A%s\n", dfname); ! 126: > fprintf(cfp, "U%s\n", dfname); ! 127: 182,183 c 220,227 ! 128: < } else ! 129: < fprintf(cfp, "A%s\n", abfile); ! 130: --- ! 131: > } else { ! 132: > #ifdef LASER ! 133: > if (fflag) ! 134: > fprintf(cfp, "F%s %d\n", abfile, fontindex++); ! 135: > else ! 136: > #endif ! 137: > fprintf(cfp, "A%s\n", abfile); ! 138: > } ! 139: 186 c 230 ! 140: < lperr("Cannot unlink %s", file); ! 141: --- ! 142: > lperr("cannot unlink %s", file); ! 143: 226 c 270 ! 144: < lperr("Control file I/O error"); ! 145: --- ! 146: > lperr("control file I/O error"); ! 147: 257 c 301 ! 148: < * (Uses the variable `wd' which ! 149: --- ! 150: > * (Uses the variable 'wd' which ! 151: 275 c 319 ! 152: < fprintf(stderr, "Usage: %s [-Bcmnr] [-b banner] [file ...]\n", argv0); ! 153: --- ! 154: > fprintf(stderr, USAGE, argv0); ! 155: 297 a 342,343 ! 156: > ! 157: > /* end of lpr.c */ ! 158:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.