Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: jaw@eos.arc.nasa.gov (James A. Woods) Newsgroups: comp.sys.sun Subject: Setting the record straight on SunOS 4.0 'fastfind' Message-ID: <2152@eos.UUCP> Date: 29 Dec 88 20:34:11 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 45 Approved: Sun-Spots@rice.edu Original-Date: 16 Dec 88 21:43:35 GMT X-Sun-Spots-Digest: Volume 7, Issue 77, message 3 of 14 Under BSD 4.3 Unix, "find filename" is short for find / -name '*filename*' -print (by far the most common usage of "find"), except that it runs in seconds rather than minutes. It is documented in the manual page. I wrote this code years ago; it was actually part of BSD 4.2, but got lost in the shuffle at Sun when they went the SVID route. Though undocumented in the manual page, it half-way works under SunOS 4.0, after first installing a nightly call to 'updatedb' from crontab. Unfortunately, as distributed, the compressed filename database is not portable across architectures because of bit-order problems with calls to putw()/getw(). [In the days of the DEC PDP, these word writes permitted the code to work on both DEC architectures-- NFS, with disparate machines reading one database, didn't yet exist.] However, the Sun 4 / Sun 3 'fastfind' problem is easily fixed by replacing the reference to c = getw(fp) in find.c with something like: c = getc (fp); c = ((unsigned char) c << 8) | getc(fp); plus a similar change to putw() in code.c. As to the syntax issues, it could be argued that filename matching "glob style" should be like 'egrep' rather than 'sh' -- this takes somewhat more work. Another area for improvement is database build time, now slow partly due to the use of 'awk'. Finally, the largest crime committed in my design of five-year old ffind is that it is not "eight-bit clean" for international character sets. I may remedy this someday (at the slight expense of compression efficiency), and donate the resulting code to the GNU project, unless someone has already done such. James A. Woods (ames!jaw) NASA Ames Research Center [[ My thanks to other readers who have also pointed out my gaffe. Good to see that everyone is still on their toes! --wnl ]]