Mail Archives: djgpp-workers/2002/03/02/16:39:48
Hello.
Waldemar Schultz posted a suggested to comp.os.msdos.djgpp fixing
the example in statvfs.txh "work out of the box on large FAT32 drives".
(Thanks, Waldemar!) Presumably the example did not work before, because
the size would overflow 2GB and appear as a negative number.
Anyway, below is a patch against DJGPP CVS. I made a couple of changes:
* Use names that don't clash with reserve C symbols ("free").
* Change format string for unsigned long long from long long.
I tested the new example program, and it works. If there are no objections,
I'll commit this patch in a week.
Thanks, bye, Rich =]
--- /develop/djgpp/src/libc/compat/sys/vfs/statfs.txh Thu Jan 31 23:00:12 2002
+++ c:/develop/djgpp.rw/src/libc/compat/sys/vfs/statfs.txh Sat Mar 2 21:27:06 2002
@@ -46,7 +46,11 @@ Zero on success, nonzero on failure.
@example
struct statfs fs;
+unsigned long long bfree, bsize;
+
statfs("anything", &fs);
-printf("%d bytes left\n", fs.f_bfree * fs.f_bsize);
+bfree = fs.f_bfree;
+bsize = fs.f_bsize;
+printf("%llu bytes left\n", bfree * bsize);
@end example
- Raw text -