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
16long
17csysdep_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