|
|
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 <sys/ttyio.h>
12: #include <sys/filio.h>
13:
14: #define SPIDER 0
15: #define PHONE 0
16: #define LPD 1
17:
18: #include "daemon.c"
19:
20: /*
21: * The remaining part is the line printer interface.
22: */
23:
24: FILE *lpf = NULL;
25:
26: #define LINESIZE 1000
27:
28: char buf[LINESIZE], ubuf[LINESIZE];
29: int ulen, blen;
30:
31: dem_con()
32: {
33: return(0);
34: }
35:
36: dem_dis()
37: {
38: FCLOSE(lpf);
39: FCLOSE(dfb);
40: }
41:
42: dem_open(file)
43: char *file;
44: {
45: struct sgttyb tb;
46: struct ttydevb grime;
47: static char iobuf[BUFSIZ];
48: int ld = 0;
49: extern int tty_ld;
50:
51: if((lpf = fopen(lp, "w")) == NULL)
52: trouble("Can't open %s", lp);
53: if (ioctl(fileno(lpf), FIOLOOKLD, &ld)<0 || ld!=tty_ld)
54: ioctl(fileno(lpf), FIOPUSHLD, &tty_ld);
55: if (ioctl(fileno(lpf), TIOCGETP, &tb) < 0)
56: trouble("Can't do gtty(%s)\n", lp);
57: ioctl(fileno(lpf), TIOCGDEV, &grime);
58: tb.sg_ispeed = tb.sg_ospeed = B9600; /* obsolescent */
59: tb.sg_flags &= ~ALLDELAY;
60: tb.sg_flags |= XTABS|TANDEM;
61: if (ioctl(fileno(lpf), TIOCSETP, &tb) < 0)
62: trouble("Can't do stty(%s)\n", lp);
63: grime.ispeed = grime.ospeed = B9600;
64: ioctl(fileno(lpf), TIOCSDEV, &grime);
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, Jim.\n", DAEMNAM, mailfname);
160: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.