* Copyright (c) 1983 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
static char sccsid
[] = "@(#)vpf.c 5.3 (Berkeley) 6/30/88";
* Varian/Versatec printer filter
int prtmode
[] = {VPRINT
};
int varian
= 1; /* default is the varian */
int width
= 132; /* default line length */
int indent
= 0; /* default indent 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]);
if ((i
= atoi(&argv
[0][2])) >= 0 &&
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 (varian
&& !literal
&& lineno
>= length
) {
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.
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... */
if (++lineno
% length
== 0)
ioctl(1, VSETSTATE
, pltmode
);
for (lp
= ovbuf
, i
= ov
; ov
--; ) {
ioctl(1, VSETSTATE
, prtmode
);