This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: The semantics of `truncate'.
- To: toon at moene dot indiv dot nluug dot nl
- Subject: Re: The semantics of `truncate'.
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Sun, 25 Feb 2001 23:15:51 -0500 (EST)
- Cc: gcc at gcc dot gnu dot org
> From: Toon Moene <toon@moene.indiv.nluug.nl>
>
> > I would try calling fflush(stream)/ftruncate(fileno(stream)) where
> > "stream" is the open FILE* on the file in question.
>
> Thanks - can I assume `fileno' exists ? Or do I have to configure-test
> for both `ftruncate' and `fileno' ?
You only need to check for ftruncate, fileno is already used elsewhere
without checks.
If you don't find ftruncate, you can immediately fallback to the copy
route or you can instead try some other ways of ftruncating a file.
There is a public domain ftruncate implementation in gnu
fileutils/lib/ftruncate.c. Perhaps we could stick it in libiberty,
though that won't help you in libf2c. You'll need to provide a
fallback ftruncate.o in there too. But that's probably more effort
than its worth.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions