*BSD News Article 73950


Return to BSD News archive

#! rnews 3506 bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.unimelb.EDU.AU!inferno.mpx.com.au!news.mel.aone.net.au!imci4!newsfeed.internetmci.com!info.ucla.edu!unixg.ubc.ca!van-bc!n1van.istar!van.istar!west.istar!ott.istar!istar.net!news.nstn.ca!coranto.ucs.mun.ca!news.unb.ca!usenet
From: Peter Howlett <Peter.Howlett@ASG.unb.ca>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Printer filter file error
Date: Tue, 16 Jul 1996 18:14:06 +0000
Organization: Atlantic Systems Group
Lines: 74
Message-ID: <31EBDBEE.167EB0E7@ASG.unb.ca>
References: <4sd8g1$ruk@slowmo.techfak.uni-kiel.de> <31EB1D42.493B@www.play-hookey.com>
NNTP-Posting-Host: 198.164.16.51
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.02 (X11; I; FreeBSD 2.1.0-RELEASE i386)

Ken Bigelow wrote:
> 
> Maciej Wiatr wrote:
> >
> > Salute,
> >
> > I use freeBSD with a HP DJ500C and a proper (as I think) filter file, which
> > has woreked. Yesterday I got to know it does not work any more.
> > As I could understand, there is an error by the execution of the filter file.
> > I have to tell my printer to use CR+LF, when it receives LF by
> > printf "\033&k2G", but it is not accepted. Printf (as well as cat)
> > do not send the first character of the given string to the printer,
> > so it cannot interprete the above string as a command.
> >
> > In my case the sh shell is used. Despite the error it isw possible to print
> > text files by sending a blank space before the command line, but ps files
> > don't work.
> >
> > Does anybody know the reason ? What happens with the first character ?
> >
> > Please HELP !
> >
> 
> I can't say what happens to that first character; there are several
> possibilities. However, here's a suggestion for an alternative filter:
> 
> Read the source (STDIN for the filter) one character at a time. If the
> character is LF, send CR to the printer (STDOUT). In any case, then send
> the character itself to STDOUT.
> 
> This filter is real simple in C or any language that can read the input
> stream by characters, and won't skip any.

Indeed, I did this just a few days ago...
-------- lpfilter.c ---------------
#include <stdio.h>
int main()
{
    int c;

    for(c = fgetc(stdin); !feof(stdin); c = fgetc(stdin)) {
        if ( c == 0x0a )
            fputc( 0x0d, stdout );

        fputc( c, stdout );
    }

    return 0;
}
-----------------------------------

gcc -o lpfilter lpfilter.c

I have another interesting question though... I have a print file 
created with ghostscript (cdj550 driver) that I can send to my
deskjet 680c from dos with no problem. When I boot FreeBSD (2.1)
the file gets queued, then sits for a while, then spits out a blank
page (with 5 or 10 random chars at the top), then sits for a while
longer (1/2 to 1 hour for a full one page of text converted from
postscript text) then proceeds to print the page _very_ slowly. 
Anyone ever seen this before?

BTW, I took out the descriptions for lpt1 and lpt2 in my kernel 
config file, leaving only:

device          lpt0    at isa? port? tty irq 7 vector lptintr

This shouldnt matter should it?

--------------------------------------------------------------------
Peter Howlett                           Atlantic Systems Group
E-Mail: Peter.Howlett@ASG.unb.ca        Fredericton, N.B. Canada
http://www.ASG.unb.ca/personal/ph.html  Phone: (506) 447-3050
PGP Key ID: 60F2EEC1                    Fax:   (506) 453-5004