[fpc-pascal]Detecting (sym)link in fpc/Linux

Mirek Novak mirek.novak at auto.cz
Wed Sep 5 16:46:19 CEST 2001


Hi,

in fpc unit linux there are defined 'POSIX macros' (as said in 'man fstat')
for checking filetype
what U need is 'S_ISLNK()' see units.pdf

M.N.

Cor Slot píše:

> Hi
>
> How can see if a file is a link on a linux filesystem?
>
> I'm trying to create a routine that recursively scans the filesystem
> with findfirst, findnext, findclose. For each file I use fstat to get
> info about the file.
>
> When the program encounters a link to a directory it recurses into that
> directory. When the link points to the same directory as the link is in
> this gives an endless loop.
>
> With the data I have from searchrec and stat, how can I determine that
> the current file is a link? Or do I need another function to do that?
>
> Thanx!
>
> Cheers,
> Cor.
> cslot at xs4all.nl
> ==============================
> Cor.J. Slot     Rotterdam [NL]
> Voice/FAXmail +31 84 851 04 78
> ==============================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mirek.novak.vcf
Type: text/x-vcard
Size: 287 bytes
Desc: Vizitka - Mirek Novak
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20010905/e3a80d99/attachment.vcf>


More information about the fpc-pascal mailing list