* filter which reads the output of nroff and converts lines
* with ^H's to overwritten lines. Thus this works like 'ul'
* but is much better: it can handle more than 2 overwrites
* and it is written with some style.
* modified by kls to use register references instead of arrays
* to try to gain a little speed.
char buf
[MAXREP
][MAXWIDTH
];
int maxcol
[MAXREP
] = {-1};
int width
= 132; /* default line length */
int length
= 66; /* page length */
int literal
; /* print control characters */
char *name
; /* user's login name */
char *host
; /* user's machine name */
char *acctfile
; /* accounting information file */
register FILE *p
= stdin
, *o
= stdout
;
int done
, linedone
, maxrep
;
if (*(cp
= *++argv
) == '-') {
if ((i
= atoi(&cp
[2])) > 0 && i
<= MAXWIDTH
)
case 'c': /* Print control chars */
for (cp
= buf
[0], limit
= buf
[MAXREP
]; cp
< limit
; *cp
++ = ' ');
if (++lineno
>= length
) {
* lpd needs to use a different filter to
* print data so stop what we are doing and
* wait for lpd to restart us.
if ((ch
= getchar()) == '\1') {
if (col
>= width
|| !literal
&& ch
< ' ')
for (i
= 0; i
< MAXREP
; i
++) {
for (i
= 0; i
<= maxrep
; i
++) {
for (cp
= buf
[i
], limit
= cp
+maxcol
[i
]; cp
<= limit
;) {
if (lineno
) { /* be sure to end on a page boundary */
if (name
&& acctfile
&& access(acctfile
, 02) >= 0 &&
freopen(acctfile
, "a", stdout
) != NULL
) {
printf("%7.2f\t%s:%s\n", (float)npages
, host
, name
);