Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/locate/locate Convert updatedb script from C-shell t...



details:   https://anonhg.NetBSD.org/src/rev/72b9beade124
branches:  trunk
changeset: 485152:72b9beade124
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu Apr 20 15:40:28 2000 +0000

description:
Convert updatedb script from C-shell to bourne shell.

diffstat:

 usr.bin/locate/locate/Makefile     |   4 +-
 usr.bin/locate/locate/updatedb.csh |  71 ------------------------------------
 usr.bin/locate/locate/updatedb.sh  |  74 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+), 73 deletions(-)

diffs (168 lines):

diff -r fea3f706256b -r 72b9beade124 usr.bin/locate/locate/Makefile
--- a/usr.bin/locate/locate/Makefile    Thu Apr 20 15:40:02 2000 +0000
+++ b/usr.bin/locate/locate/Makefile    Thu Apr 20 15:40:28 2000 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: Makefile,v 1.6 1997/10/19 04:11:55 lukem Exp $
+#      $NetBSD: Makefile,v 1.7 2000/04/20 15:40:28 jdolecek Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/6/93
 
 PROG=  locate
 
-FILES=updatedb.csh
+FILES=updatedb.sh
 FILESNAME=locate.updatedb
 FILESDIR=/usr/libexec
 FILESMODE=${BINMODE}
diff -r fea3f706256b -r 72b9beade124 usr.bin/locate/locate/updatedb.csh
--- a/usr.bin/locate/locate/updatedb.csh        Thu Apr 20 15:40:02 2000 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#!/bin/csh -f
-#
-#      $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.
-#
-# This code is derived from software contributed to Berkeley by
-# James A. Woods.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-#    must display the following acknowledgement:
-#      This product includes software developed by the University of
-#      California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-#    may be used to endorse or promote products derived from this software
-#    without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#      @(#)updatedb.csh        8.4 (Berkeley) 10/27/94
-#
-
-set SRCHPATHS = "/"                    # directories to be put in the database
-set LIBDIR = /usr/libexec              # for subprograms
-                                       # for temp files
-if (! $?TMPDIR) setenv TMPDIR /tmp
-set FCODES = /var/db/locate.database   # the database
-
-set path = ( /bin /usr/bin )
-set filelist = $TMPDIR/locate.list.$$
-
-# Make a file list and compute common bigrams.
-# Entries of each directory shall be sorted (find -s).
-
-# search locally or everything
-# find -s ${SRCHPATHS} -print \
-find -s ${SRCHPATHS} \( ! -fstype local -o -fstype fdesc -o -fstype kernfs \) \
-               -a -prune -o -print \
-       > $filelist
-
-set bigrams = `$LIBDIR/locate.bigram < $filelist`
-
-# code the file list
-
-if { test -z "$bigrams" } then
-       printf 'locate: updatedb failed\n\n'
-else
-       $LIBDIR/locate.code $bigrams < $filelist > $FCODES
-       chmod 644 $FCODES
-endif
-
-rm $filelist
diff -r fea3f706256b -r 72b9beade124 usr.bin/locate/locate/updatedb.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/locate/locate/updatedb.sh Thu Apr 20 15:40:28 2000 +0000
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+#      $NetBSD: updatedb.sh,v 1.1 2000/04/20 15:40:28 jdolecek Exp $
+#
+# Copyright (c) 1989, 1993
+#      The Regents of the University of California.  All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# James A. Woods.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#      This product includes software developed by the University of
+#      California, Berkeley and its contributors.
+# 4. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+#      @(#)updatedb.csh        8.4 (Berkeley) 10/27/94
+#
+
+SRCHPATHS="/"                          # directories to be put in the database
+LIBDIR="/usr/libexec"                  # for subprograms
+                                       # for temp files
+TMPDIR="${TMPDIR:-/tmp}"
+export TMPDIR
+FCODES="/var/db/locate.database"       # the database
+
+PATH="/bin:/usr/bin"
+FILELIST="$TMPDIR/locate.list.$$"
+
+# remove temporary file if ended prematurely
+trap 'echo $0: KILLED; /bin/rm -f $FILELIST; exit 1' 2 15
+
+# Make a file list and compute common bigrams.
+# Entries of each directory shall be sorted (find -s).
+
+# search locally or everything
+# find -s ${SRCHPATHS} -print \
+find -s ${SRCHPATHS} \( ! -fstype local -o -fstype fdesc -o -fstype kernfs \) \
+               -a -prune -o -print \
+       > $FILELIST
+
+BIGRAMS=`$LIBDIR/locate.bigram < $FILELIST`
+
+# code the file list
+if [ -z "$BIGRAMS" ]; then
+       echo 'locate: updatedb failed' >&2
+else
+       $LIBDIR/locate.code $BIGRAMS < $FILELIST > $FCODES
+       chmod 644 $FCODES
+fi
+
+rm -f $FILELIST



Home | Main Index | Thread Index | Old Index