Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cuae2!ihnp4!gargoyle.uchicago.edu!sphinx!kdw1 From: kdw1@sphinx.UUCP Newsgroups: net.sources Subject: Re: lln - a routine to list all links to a file Message-ID: <933@sphinx.UChicago.UUCP> Date: Sun, 4-Jan-87 15:34:51 EST Article-I.D.: sphinx.933 Posted: Sun Jan 4 15:34:51 1987 Date-Received: Mon, 5-Jan-87 03:03:34 EST References: <263@bsdpkh.UUCP> <659@instable.UUCP> Reply-To: kdw1@sphinx.UUCP (Keith Waclena) Followup-To: net.sources.bugs Organization: University of Chicago, Graduate Library School Lines: 47 (I'm directing followups to net.sources.bugs, which I gather is what corresponds to net.sources.d under the new naming scheme...) In net.sources, in reference to the recently posted lln program (which lists all files linked to a particular file), amos@instable.UUCP (Amos Shapir) writes: >What's wrong with: > >set `ls -id file` >find / -inum $1 -print > >It's much more portable than the given program, can limit the search >to any dir instead of /, and is probably faster on most machines. >The moral is: before writing your own utilities [...] I have a few comments in support of the author and poster of lln. I am using System V on an AT&T 3B5. 1. Our man page for find does not list -inum as an option. I tried it anyway, and was surprised to find that it works as I expect it's supposed to. But it seems a bit harsh to blame the author of lln for not knowing about what is (for some SysV users, at least) an undocumented feature. 2. Lln may be non-portable, but assuming that the options of Unix utilities act the same way on different flavors of Unix is too. Witness the differences between SysV and BSD greps and awk, to name just a couple. 3. On my system, lln is 9 times as fast as the find -inum suggestion. 4. The find -inum suggestion doesn't work. I-nodes are only unique within a file-system. The find technique, if rooted at / as suggested, will find all files with the same i-node. This is not the same as finding all links to a file, which is what lln does. When I tried the code above on a file which I knew to have two links (and which lln properly reports), find listed the two files, plus three totallly different files from two other file systems! I've already found lln to be quite useful; thanks to the author! keith-- Keith Waclena BITNET: xrtkdw1@uchimvs1.bitnet University of Chicago UUCP: ...ihnp4!gargoyle!sphinx!kdw1 Graduate Library School