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 Rework "ignorefs" behaviour:



details:   https://anonhg.NetBSD.org/src/rev/2306d622cae1
branches:  trunk
changeset: 565739:2306d622cae1
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Apr 19 01:05:22 2004 +0000

description:
Rework "ignorefs" behaviour:
    *   types are added to (rather than overriding) the default list
    *   Still use "ignorefs none" to clear the list (including the default list)
    *   Fix argument parsing when using "none"
This makes "ignorefs" much more useful if you just want to add another
fstype to the default list.

Simplify variable assignment.

diffstat:

 usr.bin/locate/locate/updatedb.sh |  30 ++++++------------------------
 1 files changed, 6 insertions(+), 24 deletions(-)

diffs (72 lines):

diff -r 4c77d0a9d5e4 -r 2306d622cae1 usr.bin/locate/locate/updatedb.sh
--- a/usr.bin/locate/locate/updatedb.sh Mon Apr 19 00:32:44 2004 +0000
+++ b/usr.bin/locate/locate/updatedb.sh Mon Apr 19 01:05:22 2004 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: updatedb.sh,v 1.8 2004/02/06 14:29:51 itohy Exp $
+#      $NetBSD: updatedb.sh,v 1.9 2004/04/19 01:05:22 lukem Exp $
 #
 # Copyright (c) 1989, 1993
 #      The Regents of the University of California.  All rights reserved.
@@ -47,8 +47,7 @@
 
 PATH="/bin:/usr/bin"
 
-ignorefs_default='! -fstype local -o -fstype cd9660 -o -fstype fdesc -o -fstype kernfs -o -fstype procfs'
-ignorefs=unset
+ignorefs='! -fstype local -o -fstype cd9660 -o -fstype fdesc -o -fstype kernfs -o -fstype procfs'
 ignore=
 SRCHPATHS=
 
@@ -63,34 +62,22 @@
                        SRCHPATHS="$SRCHPATHS $args";;
                ignorefs)
                        for i in $args; do
-                               case "$args" in
+                               case "$i" in
                                none)   ignorefs=;;
                                *)      fs=`echo "$i" | sed -e 's/^!/! -fstype /' -e t -e 's/^/-fstype /'`
-                                       case "$ignorefs" in
-                                       ''|unset)
-                                               ignorefs="$fs";;
-                                       *)      ignorefs="$ignorefs -o $fs";;
-                                       esac;;
+                                       ignorefs="${ignorefs:+${ignorefs} -o }${fs}"
                                esac
                        done;;
                ignore)
                        set -f
                        for i in $args; do
-                               case "$ignore" in
-                               '')     ;;
-                               *)      ignore="$ignore -o";;
-                               esac
-                               ignore="$ignore -path $i"
+                               ignore="${ignore:+${ignore} -o }-path ${i}"
                        done
                        set +f;;
                ignorecontents)
                        set -f
                        for i in $args; do
-                               case "$ignore" in
-                               '')     ;;
-                               *)      ignore="$ignore -o";;
-                               esac
-                               ignore="$ignore -path $i -print"
+                               ignore="${ignore:+${ignore} -o }-path ${i} -print"
                        done
                        set +f;;
                workdir)
@@ -107,11 +94,6 @@
        exec <&5 5>&-
 fi
 
-# default value when "ignorefs" is absent
-case "$ignorefs" in
-unset) ignorefs=$ignorefs_default;;
-esac
-
 : ${SRCHPATHS:=/}                      # directories to be put in the database
 export TMPDIR
 



Home | Main Index | Thread Index | Old Index