/* VDMP: version 4.4 updated %G%
* reads raster file created by cifplot and dumps it onto the
* Varian or Versatec plotter.
* Must be called with vcontrol or by vpd/vad daemon since
* it assumes plotter is already opened as device 3.
#define MAGIC_WORD 0xA5CF4DFA
char *Sid
= "@(#)vdmp.c 4.4\t%G%";
int plotmd
[] = { VPLOT
, 0, 0};
int prtmd
[] = { VPRINT
, 0, 0};
int inbuf
[BLOCK
/sizeof(int)];
int device
= VARIAN
; /* Indicate which device */
int BytesPerLine
= 264; /* Number of bytes per raster line of the output device */
for(b
=0; argv
[1][0] == '-';b
++) {
ioctl(3, VSETSTATE
,prtmd
);
ioctl(3, VSETSTATE
,prtmd
);
write(3,"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",16);
sprintf(str
,"%s: No such file\n\n\n",argv
[1]);
ioctl(3, VSETSTATE
,prtmd
);
write(3,str
, strlen(str
));
sprintf(str
,"%s:%s%s",name
,ctime(&clock
),banner
);
ioctl(3, VSETSTATE
,prtmd
);
write(3,str
,(strlen(str
)+1) & 0xfffffffe); /*makes strlen even*/
/* open file for reading */
if(inbuf
[0] == MAGIC_WORD
&& b
== BLOCK
) {
/* we have a formatted dump file */
inbuf
[(BLOCK
/sizeof(int))-1] = 0; /* make sure string terminates */
write(3,&(inbuf
[4]),(strlen(&(inbuf
[4]))+1) & 0xfffe);
ioctl(3, VSETSTATE
,prtmd
);
else { /* dump file not formatted */
/* reset in's seek pointer and plot */
ioctl(3, VSETSTATE
,prtmd
);
write(3,"\n\n\n\n\n\n\n",8);
/* vpd has already opened the Versatec as device 3 */
ioctl(3, VSETSTATE
, plotmd
);
while( (i
=read(in
,buf
, BUFSIZE
)) > 0)
if(write(3,buf
,i
)!=i
) exit(1);