Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Unix.stats?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Johann Spies <jhspies@a...>
Subject: [Caml-list] Unix.stats?
I am trying to build an Ocaml function which can produce the same
result as Unix's "find <dir> -f f" and when my function started to go
into an endless loop I found the following:

Consider the following:

-rw-r--r--    2 js       js       186322944 Mar 21 23:53 3
-rw-r--r--    2 js       js       186322944 Mar 21 23:53 1
lrwxrwxrwx    1 js       js              1 Mar 22 00:26 2 -> 1

1 is the original text file.
2 a symlink
3 a hardlink

# Unix.stat "/tmp/2";;
- : Unix.stats =
{Unix.st_dev = 774; Unix.st_ino = 459846; Unix.st_kind = Unix.S_REG;
 Unix.st_perm = 420; Unix.st_nlink = 1; Unix.st_uid = 1000;
 Unix.st_gid = 1000; Unix.st_rdev = 0; Unix.st_size = 186322944;
 Unix.st_atime = 1048284710; Unix.st_mtime = 1048283603;
 Unix.st_ctime = 1048283603}
# Unix.stat "/tmp/3";;
- : Unix.stats =
{Unix.st_dev = 774; Unix.st_ino = 459846; Unix.st_kind = Unix.S_REG;
 Unix.st_perm = 420; Unix.st_nlink = 2; Unix.st_uid = 1000;
 Unix.st_gid = 1000; Unix.st_rdev = 0; Unix.st_size = 186322944;
 Unix.st_atime = 1048284710; Unix.st_mtime = 1048283603;
 Unix.st_ctime = 1048285609}

Why did Unix.stat.Unix.st_kind not show Unix.S_LNK ?  I am using Ocaml
3.04 in this case.

And how do I get it to recognize the link?

Regards.

Johann
-- 
J.H. Spies - Tel. 021-982 2694 / 082 782 0336 / 021-808 4036(w)  
             Posbus 4668, Tygervallei 7536
     "Every good gift and every perfect gift is from above, 
      coming down from the Father of the heavenly lights,
      who does not change like shifting shadows."       
                             James 1:17 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners