* Copyright (c) 1983 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at 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'' without express or implied warranty.
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
static char sccsid
[] = "@(#)vpsf.c 5.2 (Berkeley) %G%";
* 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
);