diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /gnu/libexec/uucp/libunix/size.c |
initial import of NetBSD tree
Diffstat (limited to 'gnu/libexec/uucp/libunix/size.c')
-rw-r--r-- | gnu/libexec/uucp/libunix/size.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/libunix/size.c b/gnu/libexec/uucp/libunix/size.c new file mode 100644 index 00000000000..8d021db3cd5 --- /dev/null +++ b/gnu/libexec/uucp/libunix/size.c @@ -0,0 +1,27 @@ +/* size.c + Get the size in bytes of a file. */ + +#include "uucp.h" + +#include "uudefs.h" +#include "sysdep.h" +#include "system.h" + +#include <errno.h> + +long +csysdep_size (zfile) + const char *zfile; +{ + struct stat s; + + if (stat ((char *) zfile, &s) < 0) + { + if (errno == ENOENT) + return -1; + ulog (LOG_ERROR, "stat (%s): %s", zfile, strerror (errno)); + return -2; + } + + return s.st_size; +} |