David Mitchell wrote: > Does anyone know how to detect a link in Linux using J601? I get this: > 1!:0 <'/var/lib/ntp/var/lib/ntp' > +---+------------------+---+---+------+----------+ > |ntp|2006 9 27 16 28 10|144|r-x|r---d-|drwxr-xr-x| > +---+------------------+---+---+------+----------+ > > ls -l /var/lib/ntp/var/lib/ntp > lrwxrwxrwx 1 root root 5 Apr 11 2005 ntp -> ../..
The problem with links is that they have two identities: their identity as a link, and their identity as whatever they link to. To make links function reliably, their usual identity is the identity of whatever they link to -- a special system call is needed to detect that they are anything else (lstat instead of stat). One approach: invoke another program, which uses lstat. If ls is not available, you can assume that no links are present. You could also use cd to call out to lstat(), if you prefer. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
