This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: The semantics of `truncate'.


 > 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]