Annotation of 43BSD/usr.bin/find/updatedb.csh, revision 1.1.1.1

1.1       root        1: #!/bin/csh -f
                      2: #
                      3: #      @(#)updatedb.csh        4.6     (Berkeley)      85/04/22
                      4: #
                      5: set SRCHPATHS = "/"                    # directories to be put in the database
                      6: set LIBDIR = /usr/lib/find             # for subprograms
                      7: set FINDHONCHO = root                  # for error messages
                      8: set FCODES = /usr/lib/find/find.codes  # the database 
                      9: 
                     10: set path = ( $LIBDIR /usr/ucb /bin /usr/bin )
                     11: set bigrams = /tmp/f.bigrams$$
                     12: set filelist = /tmp/f.list$$
                     13: set errs = /tmp/f.errs$$
                     14: 
                     15: # Make a file list and compute common bigrams.
                     16: # Alphabetize '/' before any other char with 'tr'.
                     17: # If the system is very short of sort space, 'bigram' can be made
                     18: # smarter to accumulate common bigrams directly without sorting
                     19: # ('awk', with its associative memory capacity, can do this in several
                     20: # lines, but is too slow, and runs out of string space on small machines).
                     21: 
                     22: nice +10
                     23: find ${SRCHPATHS} -print | tr '/' '\001' | \
                     24:    (sort -f; echo $status > $errs) | \
                     25:    tr '\001' '/' >$filelist
                     26: $LIBDIR/bigram <$filelist | \
                     27:    (sort; echo $status >> $errs) | uniq -c | sort -nr | \
                     28:    awk '{ if (NR <= 128) print $2 }' | tr -d '\012' > $bigrams
                     29: 
                     30: # code the file list
                     31: 
                     32: if { grep -s -v 0 $errs } then
                     33:        echo 'squeeze error: out of sort space' | mail $FINDHONCHO
                     34: else
                     35:        $LIBDIR/code $bigrams < $filelist > $FCODES
                     36:        chmod 644 $FCODES
                     37:        rm $bigrams $filelist $errs
                     38: endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.