* Varian/Versatec printer filter
int pltmode
[] = {VPLOT
, 0, 0};
int prtmode
[] = {VPRINT
, 0, 0};
int varian
= 1; /* default is the varian */
int width
= 132; /* default line length */
int length
= 58; /* 80 for 11" long paper */
char *name
; /* user's login name */
char *host
; /* user's machine name */
char *acctfile
; /* accounting information file */
if (argv
[0][strlen(argv
[0])-1] == 'W') { /* Wide: the versatec. */
if ((i
= atoi(&argv
[0][2])) > 0 && i
< LINELN
)
length
= atoi(&argv
[0][2]);
case 'c': /* Print input without throwing away
control chars and without putting
* device should be open on file descriptor 1.
ioctl(1, VSETSTATE
, prtmode
);
if (name
&& acctfile
&& access(acctfile
, 02) >= 0 &&
freopen(acctfile
, "a", stdout
) != NULL
) {
printf("%7.2f\t%s:%s\n", (float)npages
, host
, name
);
if (!literal
&& varian
&& lineno
==0 && linebuf
[0]==0 && nskipped
<3) {
if (varian
&& lineno
>= length
) {
if (literal
) /* Don't make page breaks if -l. */
putchar('\f'); /* be sure to end on a page boundary */
* Put out an extra null to ensure varian will get an even
* number of good characters.
npages
+= (lineno
+ length
- 1) / length
;
for (col
= 0; col
< width
; col
++) {
for (;;) switch (c
= getchar()) {
* lpd needs to use a different filter to print data so
* stop what we are doing and wait for lpd to restart us.
if ((c
= getchar()) == '\1') {
putchar('\0'); /* make sure even # sent */
ioctl(1, VSETSTATE
, prtmode
);
/* fall through if not stop sequence */
if (c
>= ' ' || literal
) {
if (linebuf
[col
] == '_') {
if (linebuf
[col
] != ' ') {
/* Fall through, treating a ff as a line break, too... */
ioctl(1, VSETSTATE
, pltmode
);
for (lp
= ovbuf
, i
= ov
; ov
--; ) {
ioctl(1, VSETSTATE
, prtmode
);