From 79176095e846ab788190b2c7e2caa10133793757 Mon Sep 17 00:00:00 2001 From: jdolecek Date: Mon, 20 Mar 2000 19:22:55 +0000 Subject: [PATCH] locate.bigram does all the bigram processing itself now; store it's result in local variable and pass the value to locate.code directly instead of using temporary file always remove $filelist, even if an error is encountered --- usr.bin/locate/locate/updatedb.csh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/usr.bin/locate/locate/updatedb.csh b/usr.bin/locate/locate/updatedb.csh index 95c628cd6932..6d2b600f613f 100644 --- a/usr.bin/locate/locate/updatedb.csh +++ b/usr.bin/locate/locate/updatedb.csh @@ -1,6 +1,6 @@ #!/bin/csh -f # -# $NetBSD: updatedb.csh,v 1.9 2000/03/10 11:51:25 itohy Exp $ +# $NetBSD: updatedb.csh,v 1.10 2000/03/20 19:22:55 jdolecek Exp $ # # Copyright (c) 1989, 1993 # The Regents of the University of California. All rights reserved. @@ -46,9 +46,7 @@ if (! $?TMPDIR) setenv TMPDIR /tmp set FCODES = /var/db/locate.database # the database set path = ( /bin /usr/bin ) -set bigrams = $TMPDIR/locate.bigrams.$$ set filelist = $TMPDIR/locate.list.$$ -set errs = $TMPDIR/locate.errs.$$ # Make a file list and compute common bigrams. # Entries of each directory shall be sorted (find -s). @@ -59,17 +57,15 @@ find -s ${SRCHPATHS} \( ! -fstype local -o -fstype fdesc -o -fstype kernfs \) \ -a -prune -o -print \ > $filelist -$LIBDIR/locate.bigram < $filelist | \ - (sort -T "$TMPDIR"; echo $status >> $errs) | \ - uniq -c | sort -T "$TMPDIR" -nr | \ - awk '{ if (NR <= 128) print $2 }' | tr -d '\012' > $bigrams +set bigrams = `$LIBDIR/locate.bigram < $filelist` # code the file list -if { grep -s -v 0 $errs } then +if { test -z "$bigrams" } then printf 'locate: updatedb failed\n\n' else $LIBDIR/locate.code $bigrams < $filelist > $FCODES chmod 644 $FCODES - rm $bigrams $filelist $errs endif + +rm $filelist