How do you find the symbolic links to files.

Marcus J. Ranum mjr at hussar.dco.dec.com
Tue Nov 27 06:33:24 AEST 1990


jonb at specialix.co.uk (Jon Brawn) writes:

>[...] How do I access a symbolic link
>file to find out that it IS a symbolic link (I mean from within C, I
>assume stat( char *filename ) is going to stat the pointed too file?)

	use lstat(2), of course.

>Does 'find' have a wonderful flag for finding symlinks?

	read the manual page on find(1).

>Also, what about old crusties like 'tar' and 'cpio'? What do they do?

	tar and cpio [assuming on cpio - I don't use it] use lstat(2)
instead of stat(2), as they should. tar also keeps a table of the inode
#s of files it has already dumped, and makes a note to make a hard link
to the file instead of just storing 2 copies.

mjr.
-- 
	Good software will grow smaller and faster as time goes by and
the code is improved and features that proved to be less useful are
weeded out.	[from the programming notebooks of a heretic, 1990]



More information about the Comp.unix.internals mailing list