summaryrefslogtreecommitdiff
path: root/otherlibs/unix/stat.c
diff options
context:
space:
mode:
authorNo author <no_author@ocaml.org>1995-06-15 08:17:30 +0000
committerNo author <no_author@ocaml.org>1995-06-15 08:17:30 +0000
commitf0a0321f07084edd6d4b4761b855d74e0521a86a (patch)
tree1a49ecaa36e8d05f8171b3395e46f69e24e94462 /otherlibs/unix/stat.c
parent3ceaa85c72b2094bb090a1819b65a2792cf2d3c1 (diff)
downloadocaml-unlabeled-1.1.2.tar.gz
This commit was manufactured by cvs2svn to create branchunlabeled-1.1.2
'unlabeled-1.1.2'. git-svn-id: http://caml.inria.fr/svn/ocaml/branches/unlabeled-1.1.2@35 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix/stat.c')
-rw-r--r--otherlibs/unix/stat.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/otherlibs/unix/stat.c b/otherlibs/unix/stat.c
deleted file mode 100644
index 5b19049b36..0000000000
--- a/otherlibs/unix/stat.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <mlvalues.h>
-#include <alloc.h>
-#include "unix.h"
-#include "cst2constr.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef S_IFLNK
-#define S_IFLNK 0
-#endif
-#ifndef S_IFIFO
-#define S_IFIFO 0
-#endif
-#ifndef S_IFSOCK
-#define S_IFSOCK 0
-#endif
-
-static int file_kind_table[] = {
- S_IFREG, S_IFDIR, S_IFCHR, S_IFBLK, S_IFLNK, S_IFIFO, S_IFSOCK
-};
-
-static value stat_aux(buf)
- struct stat * buf;
-{
- value v;
-
- v = alloc_tuple(12);
- Field (v, 0) = Val_int (buf->st_dev);
- Field (v, 1) = Val_int (buf->st_ino);
- Field (v, 2) = cst_to_constr(buf->st_mode & S_IFMT, file_kind_table,
- sizeof(file_kind_table) / sizeof(int), 0);
- Field (v, 3) = Val_int(buf->st_mode & 07777);
- Field (v, 4) = Val_int (buf->st_nlink);
- Field (v, 5) = Val_int (buf->st_uid);
- Field (v, 6) = Val_int (buf->st_gid);
- Field (v, 7) = Val_int (buf->st_rdev);
- Field (v, 8) = Val_int (buf->st_size);
- Field (v, 9) = Val_int (buf->st_atime);
- Field (v, 10) = Val_int (buf->st_mtime);
- Field (v, 11) = Val_int (buf->st_ctime);
- return v;
-}
-
-value unix_stat(path) /* ML */
- value path;
-{
- int ret;
- struct stat buf;
- ret = stat(String_val(path), &buf);
- if (ret == -1) uerror("stat", path);
- return stat_aux(&buf);
-}
-
-value unix_lstat(path) /* ML */
- value path;
-{
- int ret;
- struct stat buf;
-#ifdef HAS_SYMLINK
- ret = lstat(String_val(path), &buf);
-#else
- ret = stat(String_val(path), &buf);
-#endif
- if (ret == -1) uerror("lstat", path);
- return stat_aux(&buf);
-}
-
-value unix_fstat(fd) /* ML */
- value fd;
-{
- int ret;
- struct stat buf;
- ret = fstat(Int_val(fd), &buf);
- if (ret == -1) uerror("fstat", Nothing);
- return stat_aux(&buf);
-}