* lpf -- Line printer filter
if ((out
= fopen("/dev/lp", "w")) == NULL
) {
fprintf(stderr
, "Can't open printer\n");
stty(fileno(out
), &ttyb
);
if ((lpack
= open("/dev/lp", 0)) < 0) {
fprintf(stderr
, "Can't open printer\n");
if (argc
> 2 && argv
[1][0]=='-' && argv
[1][1]=='b') {
if ((in
= fopen(argv
[1], "r")) == NULL
) {
fprintf(stderr
, "Can't find %s\n", argv
[1]);
stty(fileno(out
), &ttyb
);
fprintf(out
, "Printer IO error\n");
if (ban
&& access("/usr/adm/lpacct", 02)>=0
&& (out
= fopen("/usr/adm/lpacct", "a"))!=NULL
) {
fprintf(out
, "%4d %s\n", npages
, ban
);
if (lineno
==0 && linebuf
[0]==0 && nskipped
<3) {
register int col
, maxcol
, c
;
for (col
=0; col
<LINELN
; col
++) {
for (;;) switch (c
= getc(in
)) {
for (ep= &ovbuf[LINELN-1]; *ep == 0; ep--)
for (lp=ovbuf; lp <= ep; lp++)
putc(*lp ? *lp : ' ', out);
printf("Printer IO error\n");
t
= chrtab
[*sp
- ' '][i
];
for (i
= 0; i
< 8; i
++) {
fprintf(out
, (time(&timeb
), ctime(&timeb
)));
write(fileno(out
), &i
, 1);
signal(SIGALRM
, nothing
);
i
= read(lpack
, buf
, 256);