This script has an option called -presort or -nosort, that appears to
never be used, so remove it. This makes the $sort* options unneeded,
remove them too.

The script itself is used by updatedb and pkg_mklocatedb.

Comments? OK?

Index: usr.bin/locate/locate/mklocatedb.sh
===================================================================
RCS file: /cvs/src/usr.bin/locate/locate/mklocatedb.sh,v
retrieving revision 1.13
diff -u -p -r1.13 mklocatedb.sh
--- usr.bin/locate/locate/mklocatedb.sh 18 Mar 2007 20:13:49 -0000      1.13
+++ usr.bin/locate/locate/mklocatedb.sh 12 Jun 2017 20:30:53 -0000
@@ -28,7 +28,7 @@
 #
 # mklocatedb - build locate database
 # 
-# usage: mklocatedb [-presort] < filelist > database
+# usage: mklocatedb < filelist > database
 #
 # $Id: mklocatedb.sh,v 1.13 2007/03/18 20:13:49 otto Exp $
 
@@ -48,15 +48,6 @@ fi
 # utilities to built locate database
 : ${bigram=locate.bigram}
 : ${code=locate.code}
-: ${sort=sort -H}
-
-sortopt="-u -T $TMPDIR"
-sortcmd="$sort"
-
-# Input already sorted
-case X"$1" in 
-       X-nosort|X-presort) sortcmd=cat; sortopt=;shift;; 
-esac
 
 bigrams=`mktemp ${TMPDIR=/tmp}/_bigrams.XXXXXXXXXX` || exit 1
 trap 'rm -f $bigrams' 0 1 2 3 5 10 15
@@ -66,8 +57,8 @@ filelist=`mktemp ${TMPDIR=/tmp}/_filelis
 }
 trap 'rm -f $bigrams $filelist' 0 1 2 3 5 10 15
 
-if $sortcmd $sortopt > $filelist; then
-        $bigram < $filelist | $sort -nr | 
+if sort -HuT "$TMPDIR" > $filelist; then
+        $bigram < $filelist | sort -Hnr | 
                 awk -Ft 'BEGIN { ORS = "" } NR <= 128 { print $2 }' > $bigrams 
&&
         $code $bigrams < $filelist 
 else

-- 
Michal Mazurek

Reply via email to