All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
@(#)vp.4 5.1 (Berkeley) 05/15/85
To use the Versatec yourself, you must realize that you cannot open the device, /dev/vp0 if there is a daemon active. You can see if there is a daemon active by doing a lpq (1), and seeing if there are any files being sent.
To set the Versatec into plot mode you should include < sys/vcmd.h > and use the ioctl (2) call
ioctl(fileno(vp), VSETSTATE, plotmd);where plotmd is defined to be
int plotmd[] = { VPLOT, 0, 0 };and vp is the result of a call to fopen on stdio. When you finish using the Versatec in plot mode you should eject paper by sending it a EOT after putting it back into print mode, i.e. by
'nf int prtmd[] = { VPRINT, 0, 0 }; ... fflush(vp); ioctl(fileno(vp), VSETSTATE, prtmd); write(fileno(vp), "\e04", 1);
N.B. : If you use the standard I/O library with the Versatec you must do
setbuf(vp, vpbuf);where vpbuf is declared
char vpbuf[BUFSIZ];otherwise the standard I/O library, thinking that the Versatec is a terminal (since it is a character special file) will not adequately buffer the data you are sending to the Versatec. This will cause it to run extremely slowly and tends to grind the system to a halt.
10 [ENXIO] The device is already in use.
[EIO] The device is offline.