🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #262

Suggestion for locate & code

#262
From: Wilhelm B. Kloke
Date: Wed, 29 Jul 1992 13:22
28 lines
1909 bytes
Hallo,
in the GNU-find-3.7 distribution I found a bug which makes these programs
less useful in byte-sex-mixed NFS-environment.
The programs contain 1 call of getw/putw which makes them dependent on the
machine endianness. If I try to make databases for all the NFS-mounted
filesystems, I need them twice (or even more). Therefore I suggest
to change those calls. In a first try I added
int getw(FILE *fp) { register short x;
        x=fgetc(fp)<<8; return x | fgetc(fp)&0xff; }
resp.
int putw(int c,FILE *fp) { fputc(c>>8,fp); fputc(c,fp); }

into the sources, which makes the database slightly shorter on 32-bit-word
machines.

I checked the redundancy of the resulting database by applying compress on
the file. This yielded a high compression rate. I looked for a reason for this
too. One possible solution may be to look for trigrams at the end. I have a
lot of files ending in t.f (Sources of NAG-library). This led to the result 
that the most often encountered bigrams were t. and .f which are mutually
exclusive, which results in a highly suboptimal selection of bigrams.
There are some other trigrams at the end which are likely to occur:
.pk (TeX-Fonts), .3X (X11-Online-Manuals), .cc (C+-Sources), .el (EMacS). 
This is just an observation, and not very important.
But I thought of a quick hack to change this.
One could reserve a quarter or half of the bigrams for those occurring
at the end of names. Then these trigrams would less likely be doubly
counted.
Technical Details
Message-ID: <9207290940.AA21267@mail.Germany.EU.net>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ifado.UUCP!wb

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ifado.UUCP!wb
From: wb@ifado.UUCP (Wilhelm B. Kloke)
Subject: Suggestion for locate & code
Message-ID: <9207290940.AA21267@mail.Germany.EU.net>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 29 Jul 1992 13:22:17 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 29