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 Comments and white space changes, insp...



details:   https://anonhg.NetBSD.org/src/rev/678a6a0879a4
branches:  trunk
changeset: 767244:678a6a0879a4
user:      apb <apb%NetBSD.org@localhost>
date:      Wed Jul 13 07:58:35 2011 +0000

description:
Comments and white space changes, inspired by Greg Woods' remarks
in PR 45130, but not directly copied from the patch in the PR.

diffstat:

 usr.bin/locate/locate/updatedb.sh |  40 ++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 15 deletions(-)

diffs (101 lines):

diff -r a8bc6a028a4b -r 678a6a0879a4 usr.bin/locate/locate/updatedb.sh
--- a/usr.bin/locate/locate/updatedb.sh Wed Jul 13 07:52:48 2011 +0000
+++ b/usr.bin/locate/locate/updatedb.sh Wed Jul 13 07:58:35 2011 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: updatedb.sh,v 1.13 2011/07/13 07:48:19 apb Exp $
+#      $NetBSD: updatedb.sh,v 1.14 2011/07/13 07:58:35 apb Exp $
 #
 # Copyright (c) 1989, 1993
 #      The Regents of the University of California.  All rights reserved.
@@ -83,34 +83,42 @@
                ''|'#'*)
                        continue ;;     # skip blank lines and comment lines
                esac
-               eval "set -- $args"
+               eval "set -- $args"     # set "$@" from $args, obeying quotes
                case "$com" in
                searchpath)
-                       SRCHPATHS="${SRCHPATHS}${SRCHPATHS:+ }$(shell_quote "$@")";;
+                       SRCHPATHS="${SRCHPATHS}${SRCHPATHS:+ }$(shell_quote "$@")"
+                       ;;
                ignorefs)
                        for i in "$@"; do
                                q="$(shell_quote "${i#\!}")"
                                fs=
                                case "$i" in
-                               none)   ignorefs=;;
-                               \!*)    fs="! -fstype $q";;
-                               *)      fs="-fstype $q";;
+                               none)   ignorefs=
+                                       ;;
+                               \!*)    fs="! -fstype $q"
+                                       ;;
+                               *)      fs="-fstype $q"
+                                       ;;
                                esac
                                case "$fs" in
                                '')     ;;
-                               *)      ignorefs="${ignorefs:+${ignorefs} -o }${fs}";;
+                               *)      ignorefs="${ignorefs:+${ignorefs} -o }${fs}"
+                                       ;;
                                esac
-                       done;;
+                       done
+                       ;;
                ignore)
                        for i in "$@"; do
                                q="$(shell_quote "$i")"
                                ignore="${ignore:+${ignore} -o }-path ${q}"
-                       done;;
+                       done
+                       ;;
                ignorecontents)
                        for i in "$@"; do
                                q="$(shell_quote "$i")"
                                ignore="${ignore:+${ignore} -o }-path ${q} -print"
-                       done;;
+                       done
+                       ;;
                workdir)
                        if [ $# -ne 1 ]; then
                                echo "$CONF: workdir takes exactly one argument" >&2
@@ -118,10 +126,12 @@
                                TMPDIR="$1"
                        else
                                echo "$CONF: workdir: $1 nonexistent" >&2
-                       fi;;
+                       fi
+                       ;;
                *)
                        echo "$CONF: $com: unknown config command" >&2
-                       exit 1;;
+                       exit 1
+                       ;;
                esac
        done < "$CONF"
 fi
@@ -137,7 +147,7 @@
 # insert '-o' if neither $ignorefs or $ignore are empty
 case "$ignorefs $ignore" in
 ' '*|*' ')     ;;
-*)             ignore="-o $ignore";;
+*)             ignore="-o $ignore" ;;
 esac
 
 FILELIST=$(mktemp -t locate.list) || exit 1
@@ -146,11 +156,11 @@
 
 # Make a file list and compute common bigrams.
 # Entries of each directory shall be sorted (find -s).
+# The "cat" process is not useless; it lets us detect write errors.
 
 (eval "find -s ${SRCHPATHS} $lp $ignorefs $ignore $rp -print"; true) \
        | cat >> "$FILELIST"
-if [ $? != 0 ]
-then
+if [ $? != 0 ]; then
        exit 1
 fi
 



Home | Main Index | Thread Index | Old Index