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

  1. /* size.c
  2.    Get the size in bytes of a file.  */
  3.  
  4. #include "uucp.h"
  5.  
  6. #include "uudefs.h"
  7. #include "sysdep.h"
  8. #include "system.h"
  9.  
  10. #include <errno.h>
  11.  
  12. long
  13. csysdep_size (zfile)
  14.      const char *zfile;
  15. {
  16.   struct stat s;
  17.  
  18.   if (stat ((char *) zfile, &s) < 0)
  19.     {
  20.       if (errno == ENOENT)
  21.     return -1;
  22.       ulog (LOG_ERROR, "stat (%s): %s", zfile, strerror (errno));
  23.       return -2;
  24.     }
  25.  
  26.   return s.st_size;
  27. }
  28.