Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Apr 1995 16:21:19 +0200 (MET DST)
From:      Andreas Klemm <andreas@knobel.gun.de>
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        ache@astral.msk.su, rpt@miles.sso.loral.com, wwanders@sci.kun.nl, freebsd-hackers@FreeBSD.org
Subject:   Re: aspfilter & stdin
Message-ID:  <199504291421.QAA02416@knobel.GUN.de>
In-Reply-To: <199504170714.JAA04550@uriah.heep.sax.de> from "J Wunsch" at Apr 17, 95 09:14:40 am

next in thread | previous in thread | raw e-mail | index | archive | help
> As Andrey A. Chernov, Black Mage wrote:
> > >#include <stdio.h>
> > 
> > >main()
> > >{
> > >	rewind(stdin);
> > >	return(0);
> > >}
> > 
> > Yet one:
> >       fpurge(stdin);
> 
> Won't help.  You didn't notice the ``main()'' above?
> 
> Boy, he tries to rewind a pipe from a separate _process_!  This is
> impossible.

I got this from someone to eliminate the need for a tmp file, when 
printing dvi files using dvips. It worked for Linux Slackware like
charm, as well as for FreeBSD 1.1.5.1.

FreeBSD 2.0 introduces something new, which made this necessary:

#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
}

Then it worked well for someone who gave me the fix. If 2.0.5 introduces
new inconsistances for rewindstdin, then I'd like to get a fix from a
kind person...

-- 
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?199504291421.QAA02416>