3BSD/usr/man/man4/vp.4

Compare this file to the similar file:
Show the results in this format:

.TH VP 4 2/24/79 4
.UC
.SH NAME
vp \- Versatec interface
.SH SYNOPSIS
.B /dev/vp0
.SH DESCRIPTION
The Versatec printer/plotter in normally used with the programs
.IR vprint (1)
or
.IR vtroff (1).
This description is designed for those who wish to drive the Versatec directly.
.PP
The Versatec at Berkeley is 36'' wide, and has 440 characters per line
and 7040 dot per line in plot mode (this is actually slightly less than
36'' of dots.)
The paper used is continuous roll paper, and comes in 500' rolls.
.PP
To use the Versatec yourself, you must realize that you cannot open the
device,
.I /dev/vp0
if there is a daemon active.
You can see if there is a daemon active by doing a
.IR ps (1),
or by looking in the directory
.I /usr/spool/vpd.
If there is a file
.I lock
there, then there is probably a daemon
.IR vpd (1)
running.
If not, you should remove the
.I lock.
.PP
In any case, when your program tries to open the device
.I /dev/vp0
you may get one of two errors.
The first of these
ENXIO
indicates that the Versatec is already in use.
Your program can then
.IR sleep (2)
and try again in a while, or give up.
The second is
EIO
and indicates that the Versatec is offline.
.PP
To set the Versatec into plot mode you can use the following
.IR ioctl (2)
call
.IP
ioctl(fileno(vp), SETSTATE, plotmd);
.PP
where SETSTATE must be defined to be ``('v'<<8) | 1'' and
.B plotmd
is defined by
.IP
\fBint\fR plotmd[] = { 0200, 0, 0 };
.PP
and
.I vp
is the result of a call to
.I 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
.sp .1i
'nf
\fBint\fR prtmd[] = { 0100, 0, 0 };
\&...
fflush(vp); ioctl(fileno(vp), SETSTATE, prtmd); write(fileno(vp), "\e04", 1);
.fi
.PP
.B "\s+2Very important point:\s0"
If you use the standard I/O library with the Versatec you
.B must
do
.IP
setbuf(vp, vpbuf);
.PP
where
.I vpbuf
is declared
.IP
\fBchar\fR vpbuf[BUFSIZ];
.PP
otherwise the standard I/O library, thinking that the Versatec
is a terminal (since it is a character special file) will not buffer
the data you are sending to the Versatec.
This will cause it to run
.B extremely
slowly and tends to grind the system to a halt.
.SH FILES
/dev/vp0
.SH SEE ALSO
vcat(1), vfont(5), vpr(1), vprint(1), vstat(1), vtroff(1)
.SH BUGS