caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Unix.stats?
@ 2003-03-22  8:18 Johann Spies
  2003-03-22 11:10 ` Maxence Guesdon
  2003-03-22 11:11 ` Ceri Storey
  0 siblings, 2 replies; 4+ messages in thread
From: Johann Spies @ 2003-03-22  8:18 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Unix.stats?
  2003-03-22  8:18 [Caml-list] Unix.stats? Johann Spies
@ 2003-03-22 11:10 ` Maxence Guesdon
  2003-03-22 11:11 ` Ceri Storey
  1 sibling, 0 replies; 4+ messages in thread
From: Maxence Guesdon @ 2003-03-22 11:10 UTC (permalink / raw)
  To: caml-list

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

Use Unix.lstat.

-- 
Maxence Guesdon

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Unix.stats?
  2003-03-22  8:18 [Caml-list] Unix.stats? Johann Spies
  2003-03-22 11:10 ` Maxence Guesdon
@ 2003-03-22 11:11 ` Ceri Storey
  2003-03-22 12:45   ` Johann Spies
  1 sibling, 1 reply; 4+ messages in thread
From: Ceri Storey @ 2003-03-22 11:11 UTC (permalink / raw)
  To: Johann Spies, caml-list

On Sat, Mar 22, 2003 at 10:18:32AM +0200, Johann Spies wrote:
> And how do I get it to recognize the link?

Use lstat instead. The ocaml functions are merely a wrapper around the
posix functions, so the system manual pages will probbaly of use also.
-- 
Ceri Storey <cez@necrofish.org.uk>

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Unix.stats?
  2003-03-22 11:11 ` Ceri Storey
@ 2003-03-22 12:45   ` Johann Spies
  0 siblings, 0 replies; 4+ messages in thread
From: Johann Spies @ 2003-03-22 12:45 UTC (permalink / raw)
  To: caml-list

On Sat, Mar 22, 2003 at 11:11:17AM +0000, Ceri Storey wrote:
> On Sat, Mar 22, 2003 at 10:18:32AM +0200, Johann Spies wrote:
> > And how do I get it to recognize the link?
> 
> Use lstat instead. The ocaml functions are merely a wrapper around the
> posix functions, so the system manual pages will probbaly of use also.

Thanks (to Markus also).

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-22 21:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-22  8:18 [Caml-list] Unix.stats? Johann Spies
2003-03-22 11:10 ` Maxence Guesdon
2003-03-22 11:11 ` Ceri Storey
2003-03-22 12:45   ` Johann Spies

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).