Dave Burt wrote:
> In the above code, what's hd? And would this be more or less portable
> than my suggestion?
> 
>   `df -k #{dir}`[/\n.{20} (\d+)/, 1].to_i * 1024
> 
> (Does this work on your *nix?)
> 
> Cheers,
> Dave
The hd is the mount point read from /etc/mtab

More or less portable is a difficult question, especially since I only 
have linux experience. A quick google has turned up that syscall 99 is 
the stafs syscall and that these are (at the least) available on Linux, 
SunOS,  HPUX, 4.4BSD and AIX. I don't know if it works precisely the 
same on all of them, but as far as I can see df also uses statfs to get 
it's info from.

I think it is at least as portable as using df, and probably more 
portable, because it is not dependent on df syntax. My knowledge of 
windows is very limited, but don't they have limited posix support since 
win NT?

On linux all system calls are defined here:
/usr/include/asm/unistd.h
As you can see 99 is statfs.

Edwin


-- 
Posted via http://www.ruby-forum.com/.