* 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
[] = "@(#)vpsf.c 5.4 (Berkeley) 6/1/90";
* Versatec printer filter
* make wide listings by placing pages side by side
int prtmode
[] = {VPRINT
};
char screen
[PAGELN
][LINELN
];
int origin
; /* first column of a page */
int origin_ind
; /* origin plus indent */
int outline
; /* current line number */
int outcol
; /* current column number */
int width
= 106; /* default page width */
int length
= 86; /* default page length */
int indent
= 0; /* default indent */
char *name
; /* user's login name */
char *host
; /* user's machine name */
char *acctfile
; /* accounting information file */
if ((i
= atoi(&argv
[0][2])) > 0 && i
<= LINELN
)
if ((i
= atoi(&argv
[0][2])) > 0 && i
<= PAGELN
)
if ((i
= atoi(&argv
[0][2])) >= 0 &&
case 'c': /* Print input without throwing away
control chars and without putting
indent
+= literal
? 1 : LMARG
;
* input file is open on file descriptor 0.
* vp should be open on file descriptor 1.
* The error log file is open on file descriptor 2.
ioctl(1, VSETSTATE
, prtmode
);
* Put out an extra null to ensure versatec will get an even
* number of good characters.
if (name
&& acctfile
&& access(acctfile
, 02) >= 0 &&
freopen(acctfile
, "a", stdout
) != NULL
) {
printf("%7.2f\t%s:%s\n", (float)npages
, host
, name
);
printf("%7.2f\t%s\n", (float)npages
, name
);
clear(screen
, sizeof(screen
));
origin_ind
= outcol
= origin
+ indent
;
while ((c
= getchar()) != EOF
)
outcol
= ((outcol
- origin_ind
) | 07) + origin_ind
+ 1;
if (++outline
>= length
) {
if (origin
+ width
+ 1 >= LINELN
) {
cutmark(origin
+ width
+ 1);
if (!literal
&& (c
< 040 || c
>= 0177))
if (outcol
>= origin
+ width
+ 1) {
cp
= &screen
[outline
][outcol
];
if (d
== '_' || c
== '_') {
clear(ul
[outline
], LINELN
);
ul
[outline
][outcol
] = 0377;
register int i
, j
, oc
, dc
, c
;
for (i
= 0; i
< length
; i
++)
for (i
= 0; i
< LINELN
; i
++)
screen
[length
- 1][o
] = '|';
screen
[length
- 2][o
] = '|';
fwrite(screen
[n
], sizeof(char), sizeof(screen
[0]), stdout
);
ioctl(1, VSETSTATE
, pltmode
);
ioctl(1, VSETSTATE
, prtmode
);