|
|
1.1 ! root 1: char dpd[] = "/usr/spool/lab"; ! 2: char dfname[30] = "/usr/spool/lab/"; ! 3: char lock[] = "/usr/spool/lab/lock"; ! 4: char lp[] = "/dev/lab"; ! 5: ! 6: /* ! 7: * lab - label maker dispatcher for DataSouth DS180 matrix printer ! 8: */ ! 9: ! 10: #include <ctype.h> ! 11: #include <sgtty.h> ! 12: ! 13: #define SPIDER 0 ! 14: #define PHONE 0 ! 15: #define LPD 1 ! 16: ! 17: #include "daemon.c" ! 18: ! 19: /* ! 20: * The remaining part is the line printer interface. ! 21: */ ! 22: ! 23: FILE *lpf = NULL; ! 24: ! 25: #define LINESIZE 1000 ! 26: ! 27: char buf[LINESIZE], ubuf[LINESIZE]; ! 28: int ulen, blen; ! 29: ! 30: dem_con() ! 31: { ! 32: return(0); ! 33: } ! 34: ! 35: dem_dis() ! 36: { ! 37: FCLOSE(lpf); ! 38: FCLOSE(dfb); ! 39: } ! 40: ! 41: dem_open(file) ! 42: char *file; ! 43: { ! 44: struct sgttyb tb; ! 45: static char iobuf[BUFSIZ]; ! 46: int ld = 0; ! 47: extern int tty_ld; ! 48: ! 49: if((lpf = fopen(lp, "w")) == NULL) ! 50: trouble("Can't open %s", lp); ! 51: ! 52: if (ioctl(fileno(lpf), FIOLOOKLD, &ld)<0 || ld!=tty_ld) ! 53: ioctl(fileno(lpf), FIOPUSHLD, &tty_ld); ! 54: ! 55: if (gtty(fileno(lpf),&tb) < 0) ! 56: trouble("Can't do gtty(%s)\n", lp); ! 57: ! 58: tb.sg_ispeed = tb.sg_ospeed = B9600; ! 59: tb.sg_flags &= ~ALLDELAY; ! 60: tb.sg_flags |= XTABS; ! 61: ! 62: if (stty(fileno(lpf),&tb) < 0) ! 63: trouble("Can't do stty(%s)\n", lp); ! 64: ! 65: setbuf (lpf, iobuf); ! 66: } ! 67: ! 68: ! 69: dem_close() ! 70: { ! 71: dem_dis(); ! 72: } ! 73: ! 74: get_snumb() ! 75: { ! 76: } ! 77: ! 78: lwrite() ! 79: { ! 80: /* banner(lpf, &line[1]); */ ! 81: } ! 82: ! 83: ! 84: FILE *ibuf; ! 85: ! 86: sascii(fc) ! 87: char fc; ! 88: { ! 89: register int c, nblank; ! 90: ! 91: if((ibuf = fopen(&line[1], "r")) == NULL) ! 92: return(0); ! 93: ! 94: putc(ff, lpf); ! 95: ! 96: nblank = 0; ! 97: while ((c = getc (ibuf)) != EOF) { ! 98: switch (c) { ! 99: case ' ': ! 100: nblank++; ! 101: break; ! 102: ! 103: case '-': ! 104: if (nblank >= 1) { ! 105: c = getc (ibuf); ! 106: if (c == '\n') { ! 107: putc ('\r', lpf); ! 108: c = ff; ! 109: } else ! 110: putc ('-', lpf); ! 111: } ! 112: /* no break */ ! 113: default: ! 114: nblank = 0; ! 115: } ! 116: putc (c, lpf); ! 117: } ! 118: ! 119: for (c = 0; c < 6; c++) ! 120: putc (ff, lpf); ! 121: ! 122: fflush(lpf); ! 123: fclose(ibuf); ! 124: return(0); ! 125: } ! 126: ! 127: etcp1() ! 128: { ! 129: } ! 130: ! 131: /* VARARGS */ ! 132: trouble(s, a1, a2, a3, a4) ! 133: char *s; ! 134: { ! 135: if(retcode != 0){ ! 136: dem_dis(); ! 137: } ! 138: logerr(s, a1, a2, a3, a4); ! 139: longjmp(env, 1); ! 140: } ! 141: ! 142: /* VARARGS */ ! 143: logerr(s, a1, a2, a3, a4) ! 144: char *s; ! 145: int a1, a2, a3, a4; ! 146: { ! 147: #ifdef DEBUG ! 148: fprintf(stderr, s, a1, a2, a3, a4); ! 149: putc('\n', stderr); ! 150: #endif ! 151: } ! 152: ! 153: getowner() ! 154: { ! 155: } ! 156: ! 157: maildname() ! 158: { ! 159: fprintf(pmail, "Your %s job for file %s is finished.\n", DAEMNAM, mailfname); ! 160: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.