1 |
– |
/* Copyright (c) 1989 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* devmain.c - main for independent drivers. |
6 |
|
* |
7 |
|
* Redefine your initialization routine to dinit. |
11 |
– |
* |
12 |
– |
* 10/25/89 |
8 |
|
*/ |
9 |
|
|
10 |
+ |
#include "copyright.h" |
11 |
+ |
|
12 |
|
#include "standard.h" |
13 |
|
|
14 |
|
#include "color.h" |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
+ |
void |
70 |
|
quit(code) /* close device and exit */ |
71 |
|
int code; |
72 |
|
{ |
91 |
|
COLOR col; |
92 |
|
int xmin, ymin, xmax, ymax; |
93 |
|
|
94 |
< |
fread((char *)col, sizeof(COLOR), 1, devin); |
94 |
> |
getbinary((char *)col, sizeof(COLOR), 1, devin); |
95 |
|
xmin = getw(devin); ymin = getw(devin); |
96 |
|
xmax = getw(devin); ymax = getw(devin); |
97 |
|
(*dev->paintr)(col, xmin, ymin, xmax, ymax); |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
+ |
void |
131 |
+ |
mygets(char *s, FILE *fp) /* get string from file (with nul) */ |
132 |
+ |
{ |
133 |
+ |
int c; |
134 |
+ |
|
135 |
+ |
while ((c = getc(fp)) != EOF) |
136 |
+ |
if ((*s++ = c) == '\0') |
137 |
+ |
return; |
138 |
+ |
*s = '\0'; |
139 |
+ |
} |
140 |
+ |
|
141 |
+ |
|
142 |
+ |
void |
143 |
+ |
myputs(const char *s, FILE *fp) /* put string to file (with nul) */ |
144 |
+ |
{ |
145 |
+ |
do |
146 |
+ |
putc(*s, fp); |
147 |
+ |
while (*s++); |
148 |
+ |
} |
149 |
+ |
|
150 |
+ |
|
151 |
|
r_comout() /* print string to command line */ |
152 |
|
{ |
153 |
|
char str[256]; |
176 |
|
} |
177 |
|
|
178 |
|
|
179 |
< |
mygets(s, fp) /* get string from file (with nul) */ |
180 |
< |
register char *s; |
162 |
< |
register FILE *fp; |
179 |
> |
void |
180 |
> |
eputs(const char *s) /* put string to stderr */ |
181 |
|
{ |
164 |
– |
register int c; |
165 |
– |
|
166 |
– |
while ((c = getc(fp)) != EOF) |
167 |
– |
if ((*s++ = c) == '\0') |
168 |
– |
return; |
169 |
– |
*s = '\0'; |
170 |
– |
} |
171 |
– |
|
172 |
– |
|
173 |
– |
myputs(s, fp) /* put string to file (with nul) */ |
174 |
– |
register char *s; |
175 |
– |
register FILE *fp; |
176 |
– |
{ |
177 |
– |
do |
178 |
– |
putc(*s, fp); |
179 |
– |
while (*s++); |
180 |
– |
} |
181 |
– |
|
182 |
– |
|
183 |
– |
eputs(s) /* put string to stderr */ |
184 |
– |
register char *s; |
185 |
– |
{ |
182 |
|
static int midline = 0; |
183 |
|
|
184 |
|
if (!*s) |
197 |
|
|
198 |
|
sendstate() /* send driver state variables */ |
199 |
|
{ |
200 |
< |
fwrite((char *)&dev->pixaspect, sizeof(dev->pixaspect), 1, devout); |
200 |
> |
putbinary(&dev->pixaspect, sizeof(dev->pixaspect), 1, devout); |
201 |
|
putw(dev->xsiz, devout); |
202 |
|
putw(dev->ysiz, devout); |
203 |
|
putw(dev->inpready, devout); |