home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / uucp / Uucp.framework / unix.subproj / bytfre.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-09  |  485 b   |  28 lines

  1. /* bytfre.c
  2.    Get the number of bytes free on a file system.  */
  3.  
  4. #include "uucp.h"
  5.  
  6. #include "system.h"
  7. #include "sysdep.h"
  8. #include "fsusg.h"
  9.  
  10. #if HAVE_LIMITS_H
  11. #include <limits.h>
  12. #else
  13. #define LONG_MAX 2147483647
  14. #endif
  15.  
  16. long
  17. csysdep_bytes_free (zfile)
  18.      const char *zfile;
  19. {
  20.   struct fs_usage s;
  21.  
  22.   if (get_fs_usage ((char *) zfile, (char *) NULL, &s) < 0)
  23.     return -1;
  24.   if (s.fsu_bavail >= LONG_MAX / (long) 512)
  25.     return LONG_MAX;
  26.   return s.fsu_bavail * (long) 512;
  27. }
  28.