From owner-freebsd-hackers Sun Apr 16 17:10:53 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id RAA02197 for hackers-outgoing; Sun, 16 Apr 1995 17:10:53 -0700 Received: from UUCP-GW.CC.UH.EDU (root@UUCP-GW.CC.UH.EDU [129.7.1.11]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id RAA02191 for ; Sun, 16 Apr 1995 17:10:50 -0700 Received: from Taronga.COM by UUCP-GW.CC.UH.EDU with UUCP id AA18745 (5.67a/IDA-1.5); Sun, 16 Apr 1995 19:00:43 -0500 Received: by bonkers.taronga.com (smail2.5p) id AA02558; 16 Apr 95 18:59:54 CDT (Sun) Received: (from peter@localhost) by bonkers.taronga.com (8.6.11/8.6.6) id SAA02555; Sun, 16 Apr 1995 18:59:53 -0500 From: Peter da Silva Message-Id: <199504162359.SAA02555@bonkers.taronga.com> Subject: Re: aspfilter & stdin To: rpt@miles.sso.loral.com (Richard Toren) Date: Sun, 16 Apr 1995 18:59:52 -0500 (CDT) Cc: hackers@FreeBSD.org In-Reply-To: from "Richard Toren" at Apr 16, 95 05:54:29 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 992 Sender: hackers-owner@FreeBSD.org Precedence: bulk > I have modified the 'rewindstdin.c' as: > #include > #include > main() > { > return lseek(0,0L,SEEK_SET) < 0; > } > Giving the following results: > # make > cc -s -O -o rewindstdin rewindstdin.c > # cat rewindstdin.c | (file -; ./rewindstdin ;file -) > standard input: c program text > standard input: empty You can't rewind a pipe. Period. Try "(file - ; ./rewindstdin ; file -) < rewindstdin.c". > ?? why the '< 0' of the return code?? RETURN VALUES Upon successful completion, lseek() returns the resulting offset location as measured in bytes from the beginning of the file. Otherwise, a value of -1 is returned and errno is set to indicate the error. It should be "return lseek(0,0L,SEEK_SET) == -1;" I don't believe that any other nonzero result is possible in this case, but it's always better to check for the documented return value.