| 1 |
– |
/* Copyright (c) 1988 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 |
|
* devcomm.c - communication routines for separate drivers. |
| 6 |
|
* |
| 7 |
< |
* 10/5/88 |
| 7 |
> |
* External symbols declared in driver.h |
| 8 |
|
*/ |
| 9 |
|
|
| 10 |
+ |
#include "copyright.h" |
| 11 |
+ |
|
| 12 |
|
#include "standard.h" |
| 13 |
|
|
| 14 |
|
#include "color.h" |
| 21 |
|
#define DEVPATH getenv("PATH") /* device search path */ |
| 22 |
|
#endif |
| 23 |
|
|
| 24 |
< |
static int comm_close(), comm_clear(), comm_paintr(), |
| 25 |
< |
comm_getcur(), comm_comout(), comm_comin(), comm_flush(); |
| 24 |
> |
static int comm_getcur(); |
| 25 |
> |
static void comm_close(), comm_clear(), comm_paintr(), |
| 26 |
> |
comm_comin(), comm_comout(), comm_flush(); |
| 27 |
|
|
| 28 |
|
struct driver comm_driver = { |
| 29 |
|
comm_close, comm_clear, comm_paintr, comm_getcur, |
| 30 |
|
comm_comout, comm_comin, comm_flush |
| 31 |
|
}; |
| 32 |
|
|
| 33 |
< |
static int mygets(), myputs(), reply_error(), getstate(); |
| 33 |
> |
static void mygets(), myputs(), reply_error(), getstate(); |
| 34 |
|
|
| 35 |
|
FILE *devin, *devout; |
| 36 |
|
|
| 69 |
|
comm_init(dname, id) /* set up and execute driver */ |
| 70 |
|
char *dname, *id; |
| 71 |
|
{ |
| 72 |
< |
char *devname; |
| 72 |
> |
char *dvcname; |
| 73 |
|
int p1[2], p2[2]; |
| 74 |
|
char pin[16], pout[16]; |
| 75 |
|
/* find driver program */ |
| 76 |
< |
if ((devname = getpath(dname, DEVPATH, X_OK)) == NULL) { |
| 76 |
> |
if ((dvcname = getpath(dname, DEVPATH, X_OK)) == NULL) { |
| 77 |
|
eputs(dname); |
| 78 |
|
eputs(": not found\n"); |
| 79 |
|
return(NULL); |
| 86 |
|
close(p2[0]); |
| 87 |
|
sprintf(pin, "%d", p1[0]); |
| 88 |
|
sprintf(pout, "%d", p2[1]); |
| 89 |
< |
execl(devname, dname, pin, pout, id, 0); |
| 90 |
< |
perror(devname); |
| 89 |
> |
execl(dvcname, dname, pin, pout, id, 0); |
| 90 |
> |
perror(dvcname); |
| 91 |
|
_exit(127); |
| 92 |
|
} |
| 93 |
|
if (devchild == -1) |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
|
| 108 |
< |
static |
| 108 |
> |
static void |
| 109 |
|
comm_close() /* done with driver */ |
| 110 |
|
{ |
| 111 |
|
int pid; |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
|
| 125 |
< |
static |
| 125 |
> |
static void |
| 126 |
|
comm_clear(xres, yres) /* clear screen */ |
| 127 |
|
int xres, yres; |
| 128 |
|
{ |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
|
| 136 |
< |
static |
| 136 |
> |
static void |
| 137 |
|
comm_paintr(col, xmin, ymin, xmax, ymax) /* paint a rectangle */ |
| 138 |
|
COLOR col; |
| 139 |
|
int xmin, ymin, xmax, ymax; |
| 147 |
|
} |
| 148 |
|
|
| 149 |
|
|
| 150 |
< |
static |
| 150 |
> |
static void |
| 151 |
|
comm_flush() /* flush output to driver */ |
| 152 |
|
{ |
| 153 |
|
putc(COM_FLUSH, devout); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
|
| 178 |
< |
static |
| 178 |
> |
static void |
| 179 |
|
comm_comout(str) /* print string to command line */ |
| 180 |
|
char *str; |
| 181 |
|
{ |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
|
| 189 |
< |
static |
| 189 |
> |
static void |
| 190 |
|
comm_comin(buf, prompt) /* read string from command line */ |
| 191 |
|
char *buf; |
| 192 |
|
char *prompt; |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
|
| 209 |
< |
static |
| 209 |
> |
static void |
| 210 |
|
mygets(s, fp) /* get string from file (with nul) */ |
| 211 |
|
register char *s; |
| 212 |
|
register FILE *fp; |
| 220 |
|
} |
| 221 |
|
|
| 222 |
|
|
| 223 |
< |
static |
| 223 |
> |
static void |
| 224 |
|
myputs(s, fp) /* put string to file (with nul) */ |
| 225 |
|
register char *s; |
| 226 |
|
register FILE *fp; |
| 231 |
|
} |
| 232 |
|
|
| 233 |
|
|
| 234 |
< |
static |
| 234 |
> |
static void |
| 235 |
|
reply_error(routine) /* what should we do here? */ |
| 236 |
|
char *routine; |
| 237 |
|
{ |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
|
| 244 |
< |
static |
| 244 |
> |
static void |
| 245 |
|
getstate() /* get driver state variables */ |
| 246 |
|
{ |
| 247 |
|
fread((char *)&comm_driver.pixaspect, |