* Copyright (c) 1983 Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
static char sccsid
[] = "@(#)vpf.c 5.4 (Berkeley) 6/1/90";
* 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
);