Source-Changes-HG archive

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

[src/trunk]: src/etc - prefix some more local variables with `_' (when you ha...



details:   https://anonhg.NetBSD.org/src/rev/e2db2313cf3b
branches:  trunk
changeset: 485529:e2db2313cf3b
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sun Apr 30 13:16:47 2000 +0000

description:
- prefix some more local variables with `_' (when you have a convention,
  stick to it :-)
- simplify run_rc_script (no need to support fast* or force* here...)
- clarify some comments

diffstat:

 etc/rc.subr |  38 ++++++++++++++------------------------
 1 files changed, 14 insertions(+), 24 deletions(-)

diffs (88 lines):

diff -r 3b50862d9484 -r e2db2313cf3b etc/rc.subr
--- a/etc/rc.subr       Sun Apr 30 12:39:56 2000 +0000
+++ b/etc/rc.subr       Sun Apr 30 13:16:47 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rc.subr,v 1.16 2000/04/30 12:19:07 lukem Exp $
+# $NetBSD: rc.subr,v 1.17 2000/04/30 13:16:47 lukem Exp $
 #
 # Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -80,16 +80,16 @@
        else
                _fslist=$critical_filesystems
        fi
-       for fs in $_fslist; do
+       for _fs in $_fslist; do
                mount | (
-                       ismounted=no
+                       _ismounted=no
                        while read what _on on _type type; do
-                               if [ $on = $fs ]; then
-                                       ismounted=yes
+                               if [ $on = $_fs ]; then
+                                       _ismounted=yes
                                fi
                        done
-                       if [ $ismounted = no ]; then 
-                               mount $fs >/dev/null 2>&1
+                       if [ $_ismounted = no ]; then 
+                               mount $_fs >/dev/null 2>&1
                        fi
                )  
        done
@@ -245,6 +245,7 @@
        esac
 
        _keywords="start stop restart rcvar $extra_commands"
+       _pid=
        _pidcmd=
        if [ -z "$_rc_fast_run" ]; then
                if [ -n "$pidfile" ]; then
@@ -261,7 +262,7 @@
                rc_usage "$_keywords"
        fi
 
-       if [ -n "$flags" ]; then
+       if [ -n "$flags" ]; then        # allow override from environment
                _flags=$flags
        else
                eval _flags=\$${name}_flags
@@ -402,9 +403,10 @@
 #
 # run_rc_script file arg
 #      Start the script `file' with `arg', and correctly handle the
-#      return value from the script. If `file' ends with `.sh', it's
-#      sourced into the current environment. Otherwise it's run as
+#      return value from the script.  If `file' ends with `.sh', it's
+#      sourced into the current environment.  Otherwise it's run as
 #      a child process.
+#
 #      Note: because `.sh' files are sourced into the current environment
 #      run_rc_command shouldn't be used because its difficult to ensure
 #      that the global variable state before and after the sourcing of 
@@ -418,23 +420,11 @@
                err 3 'USAGE: run_rc_script file arg'
        fi
 
-       _narg=$_arg
-       case "$_narg" in
-       fast*)
-               _narg=${_narg#fast}
-               ;;
-       force*)
-               _narg=${_narg#force}
-               ;;
-       esac
-       eval ${_narg}_precmd=""
-       eval ${_narg}_cmd=""
-
        case "$_file" in
-       *.sh)                                   # run in current shell
+       *.sh)                           # run in current shell
                set $_arg ; . $_file
                ;;
-       *)                                      # run in subshell
+       *)                              # run in subshell
                ( set $_arg ; . $_file )
                ;;
        esac



Home | Main Index | Thread Index | Old Index