Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Apr 1995 16:12:58 +0200 (MET DST)
From:      Andreas Klemm <andreas@knobel.gun.de>
To:        rgrimes@gndrsh.aac.dev.com (Rodney W. Grimes)
Cc:        rpt@miles.sso.loral.com, hackers@FreeBSD.org
Subject:   Re: aspfilter & stdin
Message-ID:  <199504291412.QAA02380@knobel.GUN.de>
In-Reply-To: <199504161930.MAA07697@gndrsh.aac.dev.com> from "Rodney W. Grimes" at Apr 16, 95 12:30:23 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > Gentlemen,
> >   For the last three days I have been trying to make 'apsfilter' work
> > on my 2.0R system. I have learned a lot, but have hit a final sticking
> > point.
> > 
> >   'apsfilter' is started by the lpd. It tries to determine the type of 
> >   file that is being printed. Unfortunately, it uses `file -` to determine
> >   the type of file. A companion program is supplied called 'rewindstdin'.
> >     
> >     main()
> >     {
> >      return lseek(0,0L,0) < 0;
> >     }
> 
> Is that the sole content of the file?  No #includes??  If so try this
> program:
> 
> #include <unistd.h>
> int
> main()
> {
> 	return (lseek(0,0L,0) < 0);
> }
> 
> The problem could be that without including unistd.h the arg types to
> the lseek call are wrong (FreeBSD uses a 64Bit offset).  Thus the third
> argument to lseek was trash, and that is the whence argument :-(.

Apsfilter 4.9 delta (newest one):

#ifdef __FreeBSD__
#include <unistd.h>
#endif

main()
{
#ifdef __FreeBSD__
        return lseek(STDIN_FILENO, (off_t)0, SEEK_SET) < 0;
#else
        return lseek(0,0L,0) < 0;
#endif
}

Apsfilter worked ok for 1.1.5.1 and 2.0 that way.

-- 
andreas@knobel.gun.de         /\/\___ Wiechers & Partner Datentechnik GmbH
   Andreas Klemm          ___/\/\/       - Support Unix - akl@wup.de - 

                  *** apsfilter - irgendwie clever ***
ftp.informatik.rwth-aachen.de:/pub/Linux/local/packs/APSfilter/aps-49...:-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504291412.QAA02380>